MCPcopy Create free account
hub / github.com/chainreactors/spray / TestPutToOutputSnapshotsBaseline

Function TestPutToOutputSnapshotsBaseline

core/pool/pool_test.go:477–500  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

475}
476
477func TestPutToOutputSnapshotsBaseline(t *testing.T) {
478 ctx, cancel := context.WithCancel(context.Background())
479 defer cancel()
480 pool := newTestBasePool(ctx, cancel)
481
482 bl := newTestBaseline()
483 bl.Frameworks = common.Frameworks{
484 "nginx": common.NewFramework("nginx", common.FrameFromFingers),
485 }
486 bl.Title = "before"
487 pool.putToOutput(bl)
488
489 got := <-pool.OutputCh
490 pool.Outwg.Done()
491 bl.Title = "after"
492 bl.Frameworks["apache"] = common.NewFramework("apache", common.FrameFromFingers)
493
494 if got.Title != "before" {
495 t.Fatalf("snapshot title = %q, want before", got.Title)
496 }
497 if _, ok := got.Frameworks["apache"]; ok {
498 t.Fatal("output snapshot shares Frameworks map with original baseline")
499 }
500}
501
502func TestPutToOutput_AfterCancel(t *testing.T) {
503 ctx, cancel := context.WithCancel(context.Background())

Callers

nothing calls this directly

Calls 4

newTestBasePoolFunction · 0.85
newTestBaselineFunction · 0.85
putToOutputMethod · 0.80
DoneMethod · 0.45

Tested by

no test coverage detected