MCPcopy Index your code
hub / github.com/coder/coder / TestCloserStack_Context

Function TestCloserStack_Context

cli/ssh_internal_test.go:110–131  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

108}
109
110func TestCloserStack_Context(t *testing.T) {
111 t.Parallel()
112 ctx := testutil.Context(t, testutil.WaitShort)
113 ctx, cancel := context.WithCancel(ctx)
114 defer cancel()
115 logger := testutil.Logger(t)
116 uut := newCloserStack(ctx, logger, quartz.NewMock(t))
117 closes := new([]*fakeCloser)
118 fc0 := &fakeCloser{closes: closes}
119 fc1 := &fakeCloser{closes: closes}
120
121 err := uut.push("fc0", fc0)
122 require.NoError(t, err)
123 err = uut.push("fc1", fc1)
124 require.NoError(t, err)
125 cancel()
126 require.Eventually(t, func() bool {
127 uut.Lock()
128 defer uut.Unlock()
129 return uut.closed
130 }, testutil.WaitShort, testutil.IntervalFast)
131}
132
133func TestCloserStack_PushAfterClose(t *testing.T) {
134 t.Parallel()

Callers

nothing calls this directly

Calls 6

ContextFunction · 0.92
LoggerFunction · 0.92
newCloserStackFunction · 0.85
pushMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected