Merge pull request #582 from vmware-tanzu/prerelease-v0.4.2
Adjust "/bin/killall sleep" in new test to be less flaky in CI.
This commit is contained in:
commit
ff3f5e2444
@ -8,6 +8,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -167,7 +168,15 @@ func TestKubeCertAgent(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
t.Logf("execing into agent pod %s/%s to run '/usr/bin/killall sleep'", podToDisrupt.Namespace, podToDisrupt.Name)
|
t.Logf("execing into agent pod %s/%s to run '/usr/bin/killall sleep'", podToDisrupt.Namespace, podToDisrupt.Name)
|
||||||
var stdout, stderr bytes.Buffer
|
var stdout, stderr bytes.Buffer
|
||||||
require.NoError(t, executor.Stream(remotecommand.StreamOptions{Stdout: &stdout, Stderr: &stderr}))
|
err = executor.Stream(remotecommand.StreamOptions{Stdout: &stdout, Stderr: &stderr})
|
||||||
|
|
||||||
|
// Some container runtimes (e.g., in CI) exit fast enough that our killall process also gets a SIGKILL.
|
||||||
|
if err != nil && strings.Contains(err.Error(), "command terminated with exit code 137") {
|
||||||
|
t.Logf("ignoring SIGKILL error: %s", err.Error())
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
require.NoError(t, err)
|
||||||
t.Logf("'/usr/bin/killall sleep' finished (stdout: %q, stderr: %q)", stdout.String(), stderr.String())
|
t.Logf("'/usr/bin/killall sleep' finished (stdout: %q, stderr: %q)", stdout.String(), stderr.String())
|
||||||
|
|
||||||
// Wait for that pod to be disappear (since it will have failed).
|
// Wait for that pod to be disappear (since it will have failed).
|
||||||
|
Loading…
Reference in New Issue
Block a user