Increase timeouts in Test_runWithTimeout
Under load sometimes the 1 millisecond timeouts are not run before a 1 second sleep finishes, or `echo foo` is not run before a 1 second timeoutt. Increase the long sleeps and timeouts to 10 seconds. This doesn't affect normal test runtime as the command should timeout after 1 millisecond. Bug: 199207577 Test: Test_runWithTimeout Change-Id: I31166850a473b9cde37906a62d026580e7a7bd3f
This commit is contained in:
@@ -50,7 +50,7 @@ func Test_runWithTimeout(t *testing.T) {
|
|||||||
args: args{
|
args: args{
|
||||||
command: "echo",
|
command: "echo",
|
||||||
args: []string{"foo"},
|
args: []string{"foo"},
|
||||||
timeout: 1 * time.Second,
|
timeout: 10 * time.Second,
|
||||||
},
|
},
|
||||||
wantStdout: "foo\n",
|
wantStdout: "foo\n",
|
||||||
},
|
},
|
||||||
@@ -58,7 +58,7 @@ func Test_runWithTimeout(t *testing.T) {
|
|||||||
name: "timed out",
|
name: "timed out",
|
||||||
args: args{
|
args: args{
|
||||||
command: "sh",
|
command: "sh",
|
||||||
args: []string{"-c", "sleep 1 && echo foo"},
|
args: []string{"-c", "sleep 10 && echo foo"},
|
||||||
timeout: 1 * time.Millisecond,
|
timeout: 1 * time.Millisecond,
|
||||||
},
|
},
|
||||||
wantStderr: ".*: process timed out after .*\n",
|
wantStderr: ".*: process timed out after .*\n",
|
||||||
@@ -68,7 +68,7 @@ func Test_runWithTimeout(t *testing.T) {
|
|||||||
name: "on_timeout command",
|
name: "on_timeout command",
|
||||||
args: args{
|
args: args{
|
||||||
command: "sh",
|
command: "sh",
|
||||||
args: []string{"-c", "sleep 1 && echo foo"},
|
args: []string{"-c", "sleep 10 && echo foo"},
|
||||||
timeout: 1 * time.Millisecond,
|
timeout: 1 * time.Millisecond,
|
||||||
onTimeoutCmd: "echo bar",
|
onTimeoutCmd: "echo bar",
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user