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

Function waitForSentinel

agent/agentexec/cli_linux_test.go:128–150  ·  view source on GitHub ↗
(ctx context.Context, t *testing.T, cmd *exec.Cmd, path string)

Source from the content-addressed store, hash-verified

126}
127
128func waitForSentinel(ctx context.Context, t *testing.T, cmd *exec.Cmd, path string) {
129 t.Helper()
130
131 ticker := time.NewTicker(testutil.IntervalFast)
132 defer ticker.Stop()
133
134 // RequireEventually doesn't work well with require.NoError or similar require functions.
135 for {
136 err := cmd.Process.Signal(syscall.Signal(0))
137 require.NoError(t, err)
138
139 _, err = os.Stat(path)
140 if err == nil {
141 return
142 }
143
144 select {
145 case <-ticker.C:
146 case <-ctx.Done():
147 require.NoError(t, ctx.Err())
148 }
149 }
150}
151
152func binCmd(ctx context.Context, t *testing.T, bin string, oom, nice int) (*exec.Cmd, string) {
153 var (

Callers 1

TestCLIFunction · 0.85

Calls 5

ErrMethod · 0.80
HelperMethod · 0.65
StopMethod · 0.65
SignalMethod · 0.65
DoneMethod · 0.45

Tested by

no test coverage detected