From b4b13fdf2e2050bfcd2245a678385c4beb180b86 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 6 Dec 2026 02:19:45 -0800 Subject: [PATCH] seaweed-block: a rack outage test asserts the model's answers and its recovery During the outage the snapshot stops at its resumable stalled state and the CLI asked again with the same request id answers no_progress, retryable; the restore answers outcome_unknown, retryable, with its target listed as a dependent of the source snapshot; the plain detach answers 503 cut_stalled, retryable, "I/O stays stopped", and a guest write after it does not complete. A recovery phase follows: the stopped volume server restarts with its directory, port and rack, and once a placement of three copies is writable each interrupted request is repeated as it was asked. The snapshot resumes by its request id before the plain detach (a detached volume admits no snapshot), the repeated plain detach answers 200, and the repeated restore succeeds. The final checks before recovery report and continue, so the recovery is always measured. Co-Authored-By: Claude Opus 5.5 --- .../e9_rack_outage_integration_test.go | 338 +++++++++++++++--- 1 file changed, 281 insertions(+), 57 deletions(-) diff --git a/seaweed-block/cmd/blockvolume/e9_rack_outage_integration_test.go b/seaweed-block/cmd/blockvolume/e9_rack_outage_integration_test.go index 76ca2b2878..721bac2844 100644 --- a/seaweed-block/cmd/blockvolume/e9_rack_outage_integration_test.go +++ b/seaweed-block/cmd/blockvolume/e9_rack_outage_integration_test.go @@ -9,14 +9,17 @@ import ( "errors" "fmt" "io" + "net" "net/http" "net/url" "sort" "strings" + "sync" "testing" "time" "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore" + "github.com/seaweedfs/seaweed-block/core/frontend/nvme" "github.com/seaweedfs/seaweed-block/internal/weedtest" ) @@ -37,12 +40,22 @@ import ( // Order: a baseline cut and a snapshot with every rack up; guest load; the // outage; guest load; then, during the outage, a cut, a snapshot, a restore // of the pre-outage snapshot into a new volume, and a plain detach last. +// Then recovery: rackC's server restarts, and each interrupted request is +// repeated as it was asked (the snapshot resumed by its request id before +// the plain detach, since a detached volume admits no snapshot; the +// restore last). // -// Asserted (the model's hard claims): during the outage the cut, the -// snapshot, the restore and the plain detach each answer within the bound -// and none succeeds; the detach answers a typed detach answer; HEAD's -// committed image (current root and position) and the pre-outage -// snapshot's root are unchanged. Recorded, one grep-able "E9-OUTAGE step N" +// Asserted (the model's answers): during the outage the cut, the snapshot, +// the restore and the plain detach each answer within the bound and none +// succeeds; the snapshot stops at its resumable "stalled" state and the +// CLI resuming it answers no_progress, retryable; the restore answers +// outcome_unknown, retryable, with its target listed as a dependent of the +// source snapshot; the plain detach answers 503 cut_stalled, retryable, +// "I/O stays stopped", and a guest write after it does not complete; +// HEAD's committed image (current root and position) and the pre-outage +// snapshot's root are unchanged. After recovery the same requests +// complete: the snapshot succeeds and is listed, the plain detach answers +// 200, the restore succeeds. Recorded, one grep-able "E9-OUTAGE step N" // line per step: guest write and flush latency before and during the // outage, each answer and the time to it, HEAD, the snapshot list and the // orphan count. @@ -54,7 +67,7 @@ import ( // Per-attempt upload timing (the 30 s CutRequestTimeout of each chunk // upload) has no typed surface; only the final answer is observed. // -// About 10-16 minutes, at most about 35: go test -timeout 45m. +// About 15-25 minutes, at most about 60: go test -timeout 75m. const ( e9Window = 90 * time.Second e9IOBound = 20 * time.Second // one guest command's answer bound @@ -70,22 +83,28 @@ func TestE9RackOutageOnAReleasedStore(t *testing.T) { cluster := startWorkspaceWeedWith(t, t.TempDir(), w4WeedOpts{VolumeSizeLimitMB: 256, Volumes: vols}) // The harness's readiness probe asks for the default placement; wait // until a 020 placement is writable too (every server registered). - probe, err := chunkstore.DialSWFS(chunkstore.SWFSConfig{FilerGRPC: cluster.filerGRPC, Collection: "swblock", Replication: "020", AssignPath: "/swblock/vols/probe"}) - if err != nil { - t.Fatal(err) - } - for end := time.Now().Add(60 * time.Second); ; time.Sleep(500 * time.Millisecond) { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - _, err := probe.Put(ctx, []byte("probe-020")) - cancel() - if err == nil { - break + await020 := func(within time.Duration) (time.Duration, error) { + start := time.Now() + probe, err := chunkstore.DialSWFS(chunkstore.SWFSConfig{FilerGRPC: cluster.filerGRPC, Collection: "swblock", Replication: "020", AssignPath: "/swblock/vols/probe"}) + if err != nil { + return 0, err } - if time.Now().After(end) { - t.Fatalf("no 020 placement writable within 60s of the cluster start: %v", err) + defer probe.Close() + for end := start.Add(within); ; time.Sleep(500 * time.Millisecond) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + _, err := probe.Put(ctx, []byte("probe-020")) + cancel() + if err == nil { + return time.Since(start), nil + } + if time.Now().After(end) { + return time.Since(start), err + } } } - _ = probe.Close() + if _, err := await020(60 * time.Second); err != nil { + t.Fatalf("no 020 placement writable within 60s of the cluster start: %v", err) + } // No mutual TLS: the test speaks to the holder's chunk control over HTTP. env := startHandoffEnvOnCluster(t, 1, []string{"v2"}, nil, false, cluster, "--chunk-replication", "020") env.volExtra = []string{"--chunk-capture-interval", "0", "--chunk-snapshot-schedule", "off", "--chunk-replication", "020"} @@ -127,8 +146,8 @@ func TestE9RackOutageOnAReleasedStore(t *testing.T) { t.Fatalf("baseline cut with every rack up: HTTP %d %s: %s", baseCut.status, baseCut.code, baseCut.message) } baseSnapshot := e9Snapshot(t, status, baseSnap) - if baseSnapshot.status != http.StatusOK { - t.Fatalf("baseline snapshot with every rack up: HTTP %d %s: %s", baseSnapshot.status, baseSnapshot.code, baseSnapshot.message) + if baseSnapshot.state != "succeeded" { + t.Fatalf("baseline snapshot with every rack up: HTTP %d state %q %s: %s", baseSnapshot.status, baseSnapshot.state, baseSnapshot.code, baseSnapshot.message) } h1 := head() if h1.State != "" || len(h1.Current) == 0 || string(h1.Current) == "null" { @@ -162,29 +181,43 @@ func TestE9RackOutageOnAReleasedStore(t *testing.T) { t.Errorf("step 4: the cut gave no typed answer within %s", e9AnswerBound) } - // 5. A snapshot during the outage. + // 5. A snapshot during the outage: its operation stops at the + // resumable "stalled" state; the CLI asked again with the same request + // id answers no_progress, retryable. + const outageSnap = "e9-outage" snaps5 := snapList() - snap := e9Snapshot(t, status, "e9-outage") - t.Logf("E9-OUTAGE step 5 snapshot: HTTP %d code=%q state=%q after %s (outage age %s): %s; snapshots before=%s after=%s", - snap.status, snap.code, snap.state, snap.at.Round(time.Millisecond), time.Since(downAt).Round(time.Second), firstLine(snap.message), snaps5, snapList()) - if snap.status == http.StatusOK { - t.Errorf("step 5: a snapshot succeeded while no 020 placement can be written") + snap := e9Snapshot(t, status, outageSnap) + snapCLIArgs := []string{"ops", "chunk", "snapshot", "--volume", "v1", "--status-addr", status, "--name", outageSnap, "--request-id", e9SnapshotRequestID(outageSnap)} + snapCLI := e9CLI(t, env, snapCLIArgs...) + t.Logf("E9-OUTAGE step 5 snapshot: HTTP %d code=%q state=%q after %s (outage age %s): %s; CLI same request id: exit %d code=%q retryable=%v after %s: %s; snapshots before=%s after=%s", + snap.status, snap.code, snap.state, snap.at.Round(time.Millisecond), time.Since(downAt).Round(time.Second), firstLine(snap.message), + snapCLI.exit, snapCLI.code, snapCLI.retryable, snapCLI.at.Round(time.Millisecond), firstLine(snapCLI.message), snaps5, snapList()) + if snap.state != "stalled" { + t.Errorf("step 5: the snapshot answered HTTP %d state %q code %q within %s, not the resumable \"stalled\"", snap.status, snap.state, snap.code, e9AnswerBound) } - if snap.status == 0 { - t.Errorf("step 5: the snapshot gave no typed answer within %s (state %q)", e9AnswerBound, snap.state) + if snapCLI.exit == 0 || snapCLI.code != "no_progress" || !snapCLI.retryable { + t.Errorf("step 5: the CLI resuming the snapshot answered exit %d code %q retryable %v; want no_progress, retryable", snapCLI.exit, snapCLI.code, snapCLI.retryable) } // 6. A restore of the pre-outage snapshot into a new volume during the // outage (the product restores into a new volume, never in place). snaps6 := snapList() - restore := e9Restore(t, env, baseSnap, "v2") - t.Logf("E9-OUTAGE step 6 restore %s -> v2: exit %d code=%q retryable=%v after %s (outage age %s): %s; snapshots before=%s after=%s", - baseSnap, restore.exit, restore.code, restore.retryable, restore.at.Round(time.Millisecond), time.Since(downAt).Round(time.Second), firstLine(restore.message), snaps6, snapList()) - if restore.exit == 0 { + restoreArgs := []string{"ops", "chunk", "restore", "--master", env.h.masterAddr, "--source", "v1", "--snapshot", baseSnap, "--target", "v2", + "--chunk-filer", env.cluster.filerGRPC, "--chunk-path", env.chunkPath} + restore := e9CLI(t, env, restoreArgs...) + deps6 := e9SnapshotDependents(t, env, baseSnap) + t.Logf("E9-OUTAGE step 6 restore %s -> v2: exit %d code=%q retryable=%v after %s (outage age %s): %s; %s dependents=%v; snapshots before=%s after=%s", + baseSnap, restore.exit, restore.code, restore.retryable, restore.at.Round(time.Millisecond), time.Since(downAt).Round(time.Second), firstLine(restore.message), baseSnap, deps6, snaps6, snapList()) + switch { + case restore.exit == 0: t.Errorf("step 6: a restore succeeded while no 020 placement can be written: %s", restore.message) - } - if restore.exit < 0 { + case restore.exit < 0: t.Errorf("step 6: the restore gave no answer within %s: %s", e9AnswerBound, restore.message) + case restore.code != "outcome_unknown" || !restore.retryable: + t.Errorf("step 6: the restore answered exit %d code %q retryable %v; want outcome_unknown, retryable", restore.exit, restore.code, restore.retryable) + } + if !e9HasDependent(deps6, "v2") { + t.Errorf("step 6: snapshot %s lists dependents %v; want the pending target v2", baseSnap, deps6) } // 7. A plain detach during the outage, last. @@ -197,8 +230,14 @@ func TestE9RackOutageOnAReleasedStore(t *testing.T) { t.Errorf("step 7: a plain detach succeeded while no 020 placement can be written (HEAD gen %v)", detach.headGen) case detach.status == 0: t.Errorf("step 7: the plain detach gave no typed answer within %s", e9AnswerBound) - case detach.code != "detach_aborted" && detach.code != "outcome_unknown" && detach.code != "plain_detach_busy": - t.Errorf("step 7: the plain detach answered HTTP %d %q, not a typed detach answer (detach_aborted, outcome_unknown, plain_detach_busy)", detach.status, detach.code) + case detach.status != http.StatusServiceUnavailable || detach.code != "cut_stalled" || !detach.retryable || !strings.Contains(detach.message, "I/O stays stopped"): + t.Errorf("step 7: the plain detach answered HTTP %d %q retryable %v %q; want 503 cut_stalled, retryable, \"I/O stays stopped\"", detach.status, detach.code, detach.retryable, detach.message) + } + // Guest I/O stays stopped: one write after the detach does not complete. + probeWrite := e9WriteProbe(env, 10*time.Second) + t.Logf("E9-OUTAGE step 7 guest write after the detach: %s", probeWrite) + if probeWrite == "completed" { + t.Errorf("step 7: a guest write completed after the plain detach answered %q", detach.code) } // 8. HEAD's committed image is the baseline's and the pre-outage @@ -209,11 +248,189 @@ func TestE9RackOutageOnAReleasedStore(t *testing.T) { t.Logf("E9-OUTAGE step 8 HEAD gen=%d epoch=%d position=%d state=%q image=%s (baseline gen=%d image=%s); snapshot %s root=%s (baseline %s); orphans=%s (baseline %s); snapshots=%s", h8.Gen, h8.Epoch, h8.Position, h8.State, image(h8), h1.Gen, image(h1), baseSnap, root8, baseRoot, orphans8, orphans1, snapList()) if image(h8) != image(h1) { - t.Fatalf("step 8: HEAD's committed image moved during the outage: %s -> %s", image(h1), image(h8)) + t.Errorf("step 8: HEAD's committed image moved during the outage: %s -> %s", image(h1), image(h8)) } if root8 != baseRoot { - t.Fatalf("step 8: snapshot %s's root moved during the outage: %s -> %s", baseSnap, baseRoot, root8) + t.Errorf("step 8: snapshot %s's root moved during the outage: %s -> %s", baseSnap, baseRoot, root8) } + + // 9. Recovery: rackC's server restarts (same data directory, port and + // rack) and a 020 placement is writable again. + cluster.restartProc(t, w4VolumeProc(len(racks)-1)) + took, err := await020(3 * time.Minute) + t.Logf("E9-OUTAGE step 9 rackC restarted after an outage of %s; 020 writable after %s (err %v)", time.Since(downAt).Round(time.Second), took.Round(time.Millisecond), err) + if err != nil { + t.Fatalf("step 9: no 020 placement writable within 3m of rackC's restart: %v", err) + } + + // 11 (before 10: a detached volume admits no snapshot, a resumed one + // included). The stalled snapshot resumed with its request id succeeds. + snaps11 := snapList() + resumed := e9CLI(t, env, snapCLIArgs...) + listed := e9SnapshotListed(t, env, outageSnap) + t.Logf("E9-OUTAGE step 11 snapshot resumed with its request id: exit %d code=%q after %s: %s; %s listed=%v; snapshots before=%s after=%s", + resumed.exit, resumed.code, resumed.at.Round(time.Millisecond), firstLine(resumed.message), outageSnap, listed, snaps11, snapList()) + if resumed.exit != 0 || !listed { + t.Errorf("step 11: the resumed snapshot answered exit %d code %q, listed %v; want success and %s listed", resumed.exit, resumed.code, listed, outageSnap) + } + + // 10. The same plain detach, repeated, completes. + snaps10 := snapList() + detached := e9Handle(t, status, "/chunk/detach", map[string]any{"volumeID": "v1", "plain": true, "timeoutMs": e9Window.Milliseconds()}) + h10 := head() + t.Logf("E9-OUTAGE step 10 plain detach repeated: HTTP %d code=%q retryable=%v after %s: %s; HEAD gen=%d epoch=%d position=%d state=%q image=%s; snapshots before=%s after=%s", + detached.status, detached.code, detached.retryable, detached.at.Round(time.Millisecond), firstLine(detached.message), + h10.Gen, h10.Epoch, h10.Position, h10.State, image(h10), snaps10, snapList()) + if detached.status != http.StatusOK { + t.Errorf("step 10: the repeated plain detach answered HTTP %d %q retryable %v; want 200", detached.status, detached.code, detached.retryable) + } + + // 12. The same restore, repeated, completes: v2 is store-ready. + snaps12 := snapList() + restored := e9CLI(t, env, restoreArgs...) + t.Logf("E9-OUTAGE step 12 restore repeated %s -> v2: exit %d code=%q retryable=%v after %s: %s; %s dependents=%v; snapshots before=%s after=%s", + baseSnap, restored.exit, restored.code, restored.retryable, restored.at.Round(time.Millisecond), firstLine(restored.message), baseSnap, e9SnapshotDependents(t, env, baseSnap), snaps12, snapList()) + if restored.exit != 0 { + t.Errorf("step 12: the repeated restore answered exit %d code %q retryable %v; want success", restored.exit, restored.code, restored.retryable) + } +} + +// e9SnapshotListed reports whether "ops chunk snapshots" lists v1's +// snapshot name. +func e9SnapshotListed(t *testing.T, env *handoffEnv, name string) bool { + t.Helper() + for _, s := range env.snapshots(t, "v1", name) { + if s.Name == name { + return true + } + } + return false +} + +// e9SnapshotDependents is the dependents "ops chunk snapshots" lists for +// v1's snapshot name. +func e9SnapshotDependents(t *testing.T, env *handoffEnv, name string) []string { + t.Helper() + for _, s := range env.snapshots(t, "v1", name) { + if s.Name == name { + return s.Dependents + } + } + t.Fatalf("snapshot %s is not listed for v1", name) + return nil +} + +// e9HasDependent reports whether deps names volume vol (its directory is +// the name, a dash and the layout id's prefix). +func e9HasDependent(deps []string, vol string) bool { + for _, d := range deps { + if strings.HasPrefix(d, vol+"-") { + return true + } + } + return false +} + +// e9WriteProbe connects to the volume's NVMe/TCP target and writes one +// block within bound. It answers "completed", or how the write did not +// complete: the connect's error, the write's typed error, or no answer +// within bound. +func e9WriteProbe(env *handoffEnv, bound time.Duration) string { + done := make(chan string, 1) + var conn struct { + sync.Mutex + c []net.Conn + } + go func() { + c, err := e9DialNVMe(env.hosts["s1"].nvme, plannedHandoffNQN, func(nc net.Conn) { + conn.Lock() + conn.c = append(conn.c, nc) + conn.Unlock() + }) + if err != nil { + done <- "connect: " + err.Error() + return + } + if err := c.tryWrite(0, cutCrashBlock('D', 0)); err != nil { + done <- "write: " + err.Error() + return + } + done <- "completed" + }() + select { + case r := <-done: + conn.Lock() + for _, c := range conn.c { + _ = c.Close() + } + conn.Unlock() + return r + case <-time.After(bound): + conn.Lock() + for _, c := range conn.c { + _ = c.Close() + } + conn.Unlock() + <-done + return fmt.Sprintf("no answer within %s", bound) + } +} + +// e9DialNVMe is dialNVMe answering its error instead of failing the test: +// the admin and the I/O queue connected to subNQN. opened sees each +// connection as it opens. +func e9DialNVMe(addr, subNQN string, opened func(net.Conn)) (*nvmeInitiator, error) { + c := &nvmeInitiator{} + cd := nvme.ConnectData{HostID: [16]byte{0x5e, 0xa1}, SubNQN: subNQN, HostNQN: "nqn.2026-11.io.seaweedfs:handoff-test"} + var cntlID uint16 + for qid := uint32(0); qid <= 1; qid++ { + conn, err := net.DialTimeout("tcp", addr, 5*time.Second) + if err != nil { + return nil, err + } + opened(conn) + // Bounded even when the probe's close comes before this connection + // opened; the write then bounds itself (nvmeIODeadline). + _ = conn.SetDeadline(time.Now().Add(15 * time.Second)) + r, w := nvme.NewReader(conn), nvme.NewWriter(conn) + if err := w.SendHeaderOnly(0x0, &nvme.ICRequest{PDUMaxR2T: 1}, 120); err != nil { + return nil, fmt.Errorf("ICReq: %w", err) + } + if ch, err := r.Dequeue(); err != nil || ch.Type != 0x1 { + return nil, fmt.Errorf("ICResp: type %v: %w", ch, err) + } + if err := r.Receive(&nvme.ICResponse{}); err != nil { + return nil, fmt.Errorf("ICResp body: %w", err) + } + cd.CNTLID = 0xFFFF + if qid == 1 { + cd.CNTLID = cntlID + } + buf := make([]byte, 1024) + cd.Marshal(buf) + c.cid++ + cmd := nvme.CapsuleCommand{OpCode: 0x7F, FCType: 0x01, CID: c.cid, D10: qid << 16} + if err := w.SendWithData(0x4, 0, &cmd, 64, buf); err != nil { + return nil, fmt.Errorf("Connect qid %d: %w", qid, err) + } + ch, err := r.Dequeue() + if err != nil || ch.Type != 0x5 { + return nil, fmt.Errorf("Connect qid %d response: type %v: %w", qid, ch, err) + } + var resp nvme.CapsuleResponse + if err := r.Receive(&resp); err != nil { + return nil, fmt.Errorf("Connect qid %d response body: %w", qid, err) + } + if resp.Status != 0 { + return nil, fmt.Errorf("Connect qid %d status 0x%04x", qid, resp.Status) + } + if qid == 0 { + c.admin, cntlID = conn, uint16(resp.DW0&0xFFFF) + } else { + c.io, c.r, c.w = conn, r, w + } + } + return c, nil } // e9SnapshotRoot is the root "ops chunk snapshots" lists for v1's snapshot @@ -229,9 +446,11 @@ func e9SnapshotRoot(t *testing.T, env *handoffEnv, name string) string { return "" } -// e9SnapAnswer is a snapshot operation's final answer: 200 when it -// succeeded, else the refusal's HTTP status (the admission's, or the one -// the operation records), 0 when none came within e9AnswerBound. +// e9SnapAnswer is a snapshot operation's answer: its state ("succeeded", +// "refused", the resumable "stalled", or how the admission or the handle +// read was refused) and status: 200 when it succeeded, else the refusal's +// HTTP status (the admission's, or the one the operation records), 0 when +// it stalled or none came within e9AnswerBound. type e9SnapAnswer struct { status int code string @@ -240,13 +459,15 @@ type e9SnapAnswer struct { at time.Duration } +func e9SnapshotRequestID(name string) string { return "e9-" + name } + // e9Snapshot asks the holder for a snapshot of v1 as an operation -// (Prefer: respond-async) and reads its handle until it succeeds or is -// refused, as "ops chunk snapshot" does. +// (Prefer: respond-async) and reads its handle until it succeeds, is +// refused or stalls, as "ops chunk snapshot" does. func e9Snapshot(t *testing.T, addr, name string) e9SnapAnswer { t.Helper() start := time.Now() - payload, err := json.Marshal(map[string]any{"volumeID": "v1", "name": name, "requestID": "e9-" + name, "timeoutMs": e9Window.Milliseconds()}) + payload, err := json.Marshal(map[string]any{"volumeID": "v1", "name": name, "requestID": e9SnapshotRequestID(name), "timeoutMs": e9Window.Milliseconds()}) if err != nil { t.Fatal(err) } @@ -292,7 +513,7 @@ func e9Snapshot(t *testing.T, addr, name string) e9SnapAnswer { if location == "" { location = r.Handle } - for r.State != "succeeded" && r.State != "refused" { + for r.State != "succeeded" && r.State != "refused" && r.State != "stalled" { if location == "" { t.Fatalf("snapshot %s: state %q without a handle", name, r.State) } @@ -313,6 +534,9 @@ func e9Snapshot(t *testing.T, addr, name string) e9SnapAnswer { } } a := e9SnapAnswer{status: http.StatusOK, code: "ok", state: r.State, message: r.Message, at: time.Since(start)} + if r.State == "stalled" { + a.status, a.code = 0, r.Code + } if r.State == "refused" { a.status, a.code = r.Status, r.Code if a.status == 0 { @@ -322,9 +546,9 @@ func e9Snapshot(t *testing.T, addr, name string) e9SnapAnswer { return a } -// e9RestoreAnswer is "ops chunk restore"'s answer: its exit status (-1: -// none within e9AnswerBound) and, on failure, the typed code it prints. -type e9RestoreAnswer struct { +// e9CLIAnswer is an ops command's answer: its exit status (-1: none within +// e9AnswerBound) and, on failure, the typed code it prints. +type e9CLIAnswer struct { exit int code string message string @@ -332,22 +556,22 @@ type e9RestoreAnswer struct { at time.Duration } -// e9Restore restores v1's snapshot snap into the new volume target through -// the master, as an operator does. -func e9Restore(t *testing.T, env *handoffEnv, snap, target string) e9RestoreAnswer { +// e9CLI runs one ops command as an operator does ("ops chunk restore" +// through the master, "ops chunk snapshot" against the holder) and reads +// its answer within e9AnswerBound. +func e9CLI(t *testing.T, env *handoffEnv, args ...string) e9CLIAnswer { t.Helper() start := time.Now() ctx, cancel := context.WithTimeout(context.Background(), e9AnswerBound) defer cancel() - out, errOut, rc, err := runCLI(ctx, env.h, "ops", "chunk", "restore", "--master", env.h.masterAddr, "--source", "v1", "--snapshot", snap, "--target", target, - "--chunk-filer", env.cluster.filerGRPC, "--chunk-path", env.chunkPath) + out, errOut, rc, err := runCLI(ctx, env.h, args...) if ctx.Err() != nil { - return e9RestoreAnswer{exit: -1, code: "no_answer", message: fmt.Sprintf("%v %s", err, firstLine(strings.TrimSpace(errOut))), at: time.Since(start)} + return e9CLIAnswer{exit: -1, code: "no_answer", message: fmt.Sprintf("%v %s", err, firstLine(strings.TrimSpace(errOut))), at: time.Since(start)} } if err != nil { - t.Fatalf("restore %s -> %s: %v", snap, target, err) + t.Fatalf("%q: %v", args, err) } - a := e9RestoreAnswer{exit: rc, message: strings.TrimSpace(out), at: time.Since(start)} + a := e9CLIAnswer{exit: rc, message: strings.TrimSpace(out), at: time.Since(start)} var body struct { Code string `json:"code"` Message string `json:"message"`