diff options
Diffstat (limited to 'runsc/test')
-rw-r--r-- | runsc/test/image/image_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/runsc/test/image/image_test.go b/runsc/test/image/image_test.go index 341bdc1d5..428f05c04 100644 --- a/runsc/test/image/image_test.go +++ b/runsc/test/image/image_test.go @@ -303,6 +303,27 @@ func TestRuby(t *testing.T) { } } +func TestStdio(t *testing.T) { + if err := testutil.Pull("alpine"); err != nil { + t.Fatalf("docker pull failed: %v", err) + } + d := testutil.MakeDocker("stdio-test") + + wantStdout := "hello stdout" + wantStderr := "bonjour stderr" + cmd := fmt.Sprintf("echo %q; echo %q 1>&2;", wantStdout, wantStderr) + if err := d.Run("alpine", "/bin/sh", "-c", cmd); err != nil { + t.Fatalf("docker run failed: %v", err) + } + defer d.CleanUp() + + for _, want := range []string{wantStdout, wantStderr} { + if _, err := d.WaitForOutput(want, 5*time.Second); err != nil { + t.Fatalf("docker didn't get output %q : %v", want, err) + } + } +} + func TestMain(m *testing.M) { testutil.EnsureSupportedDockerVersion() os.Exit(m.Run()) |