MCPcopy Create free account
hub / github.com/openclaw/gogcli / TestBatchLocalMutatorsHonorDryRun

Function TestBatchLocalMutatorsHonorDryRun

internal/cmd/docs_batch_store_test.go:348–392  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

346}
347
348func TestBatchLocalMutatorsHonorDryRun(t *testing.T) {
349 ctx := batchTestContext(t)
350 dryRun := &RootFlags{DryRun: true}
351 beginErr := (&BatchBeginCmd{Service: docsbatch.ServiceDocs, DocID: "doc1"}).Run(ctx, dryRun)
352 if !isSuccessfulDryRunExit(beginErr) {
353 t.Fatalf("begin dry run: %v", beginErr)
354 }
355
356 store, err := newDocsBatchStore(ctx)
357 if err != nil {
358 t.Fatalf("new store: %v", err)
359 }
360 batches, err := store.List()
361 if err != nil {
362 t.Fatalf("list: %v", err)
363 }
364 if len(batches) != 0 {
365 t.Fatalf("begin dry run created batches: %#v", batches)
366 }
367
368 state, err := store.Create(docsbatch.State{
369 Service: docsbatch.ServiceDocs,
370 DocumentID: "doc1",
371 Account: "a@b.com",
372 Client: "default",
373 })
374 if err != nil {
375 t.Fatalf("create: %v", err)
376 }
377 abortErr := (&BatchAbortCmd{BatchID: state.BatchID}).Run(ctx, dryRun)
378 if !isSuccessfulDryRunExit(abortErr) {
379 t.Fatalf("abort dry run: %v", abortErr)
380 }
381 if _, err := store.Get(state.BatchID); err != nil {
382 t.Fatalf("abort dry run removed batch: %v", err)
383 }
384
385 pruneErr := (&BatchPruneCmd{OlderThan: time.Nanosecond}).Run(ctx, dryRun)
386 if !isSuccessfulDryRunExit(pruneErr) {
387 t.Fatalf("prune dry run: %v", pruneErr)
388 }
389 if _, err := store.Get(state.BatchID); err != nil {
390 t.Fatalf("prune dry run removed batch: %v", err)
391 }
392}
393
394func TestDocsInsertPageBreakBatchQueuesWithoutSubmitting(t *testing.T) {
395 postCalls := 0

Callers

nothing calls this directly

Calls 7

batchTestContextFunction · 0.85
isSuccessfulDryRunExitFunction · 0.85
newDocsBatchStoreFunction · 0.85
CreateMethod · 0.80
RunMethod · 0.65
GetMethod · 0.65
ListMethod · 0.45

Tested by

no test coverage detected