Increase wait timeout for TestDaemonRestart

Windows needs a bit more time to finish the restarting containerd. With
the current 2 second timeout, we run the risk of exceeding that
deadline.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2022-03-08 18:05:30 +02:00
parent f18880a0ed
commit 14901335c1
No known key found for this signature in database
GPG Key ID: 7D073DCC2C074CB5

View File

@ -2036,7 +2036,12 @@ func TestDaemonRestart(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer task.Delete(ctx)
defer func() {
if _, err := task.Delete(ctx, WithProcessKill); err != nil {
t.Logf("failed to delete task: %v", err)
}
}()
statusC, err := task.Wait(ctx) statusC, err := task.Wait(ctx)
if err != nil { if err != nil {
@ -2058,7 +2063,10 @@ func TestDaemonRestart(t *testing.T) {
t.Errorf(`first task.Wait() should have failed with "transport is closing"`) t.Errorf(`first task.Wait() should have failed with "transport is closing"`)
} }
waitCtx, waitCancel := context.WithTimeout(ctx, 2*time.Second) // NOTE(gabriel-samfira): Windows needs a bit more time to restart.
// Increase timeout from 2 seconds to 10 seconds to avoid deadline
// exceeded errors.
waitCtx, waitCancel := context.WithTimeout(ctx, 10*time.Second)
serving, err := client.IsServing(waitCtx) serving, err := client.IsServing(waitCtx)
waitCancel() waitCancel()
if !serving { if !serving {
@ -2479,8 +2487,8 @@ func TestContainerUsername(t *testing.T) {
} }
<-statusC <-statusC
if _, err := task.Delete(ctx); err != nil { if _, err := task.Delete(ctx); err != nil {
t.Fatal(err) t.Fatal(err)
} }
output := strings.TrimSuffix(buf.String(), newLine) output := strings.TrimSuffix(buf.String(), newLine)
if output != expectedOutput { if output != expectedOutput {