From ead1b7f423525cc8d216923ba3bbdb8b8621d93d Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Thu, 31 May 2018 11:57:44 -0700 Subject: [PATCH] Log more info for TestExecutor_IsolationAndConstraints --- client/driver/executor/executor_linux_test.go | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/client/driver/executor/executor_linux_test.go b/client/driver/executor/executor_linux_test.go index 2d11b0d17..bff3c2a93 100644 --- a/client/driver/executor/executor_linux_test.go +++ b/client/driver/executor/executor_linux_test.go @@ -84,10 +84,21 @@ func TestExecutor_IsolationAndConstraints(t *testing.T) { if ps.Pid == 0 { t.Fatalf("expected process to start and have non zero pid") } - _, err = executor.Wait() + state, err = executor.Wait() if err != nil { t.Fatalf("error in waiting for command: %v", err) } + if state.ExitCode != 0 { + t.Error("exited with non-zero code: %v", state.ExitCode) + + // Log the stderr + file := filepath.Join(ctx.LogDir, "web.stderr.0") + output, err := ioutil.ReadFile(file) + if err != nil { + t.Fatalf("Couldn't read file %v", file) + } + t.Fatalf("ls failed with stderr: %q", string(output)) + } // Check if the resource constraints were applied memLimits := filepath.Join(ps.IsolationConfig.CgroupPaths["memory"], "memory.limit_in_bytes") @@ -135,8 +146,16 @@ ld.so.conf.d/` act := strings.TrimSpace(string(output)) if act != expected { - t.Fatalf("Command output incorrectly: want %v; got %v", expected, act) + t.Errorf("Command output incorrectly: want %v; got %v", expected, act) } + + // Log the stderr + file2 := filepath.Join(ctx.LogDir, "web.stderr.0") + output, err = ioutil.ReadFile(file2) + if err != nil { + t.Fatalf("Couldn't read file %v", file2) + } + t.Fatalf("ls failed with stderr: %q", string(output)) } func TestExecutor_ClientCleanup(t *testing.T) {