Skip to content

Commit 72c91fe

Browse files
committed
Adjust command test
Turns out exec could be really slow in certain circumstances, and we should only measure time once the command is done starting. Signed-off-by: apostasie <[email protected]>
1 parent 987f015 commit 72c91fe

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

cmd/nerdctl/volume/volume_inspect_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func TestVolumeInspect(t *testing.T) {
137137
return &test.Expected{
138138
Output: expect.All(
139139
expect.Contains(data.Get("vol1")),
140-
expect.JSON([]native.Volume{}, func(dc []native.Volume, info string, t tig.T) {
140+
expect.JSON([]*native.Volume{}, func(dc []*native.Volume, info string, t tig.T) {
141141
assert.Assert(t, dc[0].Size == size, fmt.Sprintf("expected size to be %d (was %d)", size, dc[0].Size))
142142
}),
143143
),

mod/tigron/internal/com/command_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ func TestStdoutStderr(t *testing.T) {
335335
func TestTimeoutPlain(t *testing.T) {
336336
t.Parallel()
337337

338-
start := time.Now()
339338
command := &com.Command{
340339
Binary: "bash",
341340
// XXX unclear if windows is really able to terminate sleep 5, so, split it up to give it a
@@ -345,11 +344,10 @@ func TestTimeoutPlain(t *testing.T) {
345344
}
346345

347346
err := command.Run(context.WithValue(context.Background(), com.LoggerKey, t))
348-
349347
assertive.ErrorIsNil(t, err, "Err")
350348

349+
start := time.Now()
351350
res, err := command.Wait()
352-
353351
end := time.Now()
354352

355353
assertive.ErrorIs(t, err, com.ErrTimeout, "Err")

0 commit comments

Comments
 (0)