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

Function TestAddAddition_Normal

core/pool/pool_test.go:67–84  ·  view source on GitHub ↗

--------------------------------------------------------------------------- addAddition ---------------------------------------------------------------------------

(t *testing.T)

Source from the content-addressed store, hash-verified

65// ---------------------------------------------------------------------------
66
67func TestAddAddition_Normal(t *testing.T) {
68 ctx, cancel := context.WithCancel(context.Background())
69 defer cancel()
70 pool := newTestBasePool(ctx, cancel)
71
72 pool.addAddition(&Unit{path: "/a", source: parsers.WordSource})
73
74 select {
75 case u := <-pool.additionCh:
76 if u.path != "/a" {
77 t.Fatalf("path = %q, want /a", u.path)
78 }
79 case <-time.After(time.Second):
80 t.Fatal("addAddition: channel receive timed out")
81 }
82 pool.wg.Done() // balance the Add(1)
83 pool.wg.Wait() // must not hang
84}
85
86func TestAppendBasePathTreatsValidPathAsDirectory(t *testing.T) {
87 tests := []struct {

Callers

nothing calls this directly

Calls 3

newTestBasePoolFunction · 0.85
addAdditionMethod · 0.80
DoneMethod · 0.45

Tested by

no test coverage detected