summaryrefslogtreecommitdiffhomepage
path: root/runsc/specutils/specutils_test.go
diff options
context:
space:
mode:
authorBrielle Broder <bbroder@google.com>2018-07-10 14:57:20 -0700
committerShentubot <shentubot@google.com>2018-07-10 14:58:12 -0700
commitb763b3992a2c4f16fc218e1920df5525dd75b114 (patch)
tree6c67d6947e29388b83943dffd24dd07d28754597 /runsc/specutils/specutils_test.go
parent06920b3d1bb6346a20aa0e154b14e68116919dbc (diff)
Modified error message for clarity.
Previously, error message only showed "<nil>" when child and pid were the same (since no error is returned by the Wait4 syscall in this case) which occurs when the process has incorrectly terminated. A new error message was added to improve clarity for such a case. Tests for this function were modified to reflect the improved distinction between process termination and error. PiperOrigin-RevId: 204018107 Change-Id: Ib38481c9590405e5bafcb6efe27fd49b3948910c
Diffstat (limited to 'runsc/specutils/specutils_test.go')
-rw-r--r--runsc/specutils/specutils_test.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/runsc/specutils/specutils_test.go b/runsc/specutils/specutils_test.go
index 959be3af3..2dc5d90cc 100644
--- a/runsc/specutils/specutils_test.go
+++ b/runsc/specutils/specutils_test.go
@@ -76,8 +76,11 @@ func TestWaitForReadyNotRunning(t *testing.T) {
err := WaitForReady(cmd.Process.Pid, 5*time.Second, func() (bool, error) {
return false, nil
})
- if !strings.Contains(err.Error(), "not running") {
- t.Errorf("ProcessWaitReady got: %v, expected: not running", err)
+ if err != nil && !strings.Contains(err.Error(), "terminated") {
+ t.Errorf("ProcessWaitReady got: %v, expected: process terminated", err)
+ }
+ if err == nil {
+ t.Errorf("ProcessWaitReady incorrectly succeeded")
}
}