MCPcopy Create free account
hub / github.com/containerd/nerdctl / TestFaultyRunDoubleWait

Function TestFaultyRunDoubleWait

mod/tigron/internal/com/command_test.go:67–94  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

65}
66
67func TestFaultyRunDoubleWait(t *testing.T) {
68 // Double wait returns an error on the second wait, but also returns the existing result
69 t.Parallel()
70
71 command := &com.Command{
72 Binary: "printf",
73 Args: []string{"one"},
74 Timeout: time.Second,
75 }
76
77 err := command.Run(context.WithValue(context.Background(), com.LoggerKey, t))
78
79 assertive.ErrorIsNil(t, err, "Err")
80
81 res, err := command.Wait()
82
83 assertive.ErrorIsNil(t, err, "Err")
84 assertive.IsEqual(t, expect.ExitCodeSuccess, res.ExitCode, "ExitCode")
85 assertive.IsEqual(t, "one", res.Stdout, "Stdout")
86 assertive.IsEqual(t, "", res.Stderr, "Stderr")
87
88 res, err = command.Wait()
89
90 assertive.ErrorIs(t, err, com.ErrExecAlreadyFinished, "Err")
91 assertive.IsEqual(t, expect.ExitCodeSuccess, res.ExitCode, "ExitCode")
92 assertive.IsEqual(t, "one", res.Stdout, "Stdout")
93 assertive.IsEqual(t, "", res.Stderr, "Stderr")
94}
95
96func TestFailRun(t *testing.T) {
97 t.Parallel()

Callers

nothing calls this directly

Calls 3

RunMethod · 0.95
WaitMethod · 0.95
BackgroundMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…