(t *testing.T)
| 346 | } |
| 347 | |
| 348 | func 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 | |
| 394 | func TestDocsInsertPageBreakBatchQueuesWithoutSubmitting(t *testing.T) { |
| 395 | postCalls := 0 |
nothing calls this directly
no test coverage detected