diff --git a/libcontainer/integration/exec_test.go b/libcontainer/integration/exec_test.go index c583901d8..a46f0a928 100644 --- a/libcontainer/integration/exec_test.go +++ b/libcontainer/integration/exec_test.go @@ -366,7 +366,7 @@ func TestProcessEmptyCaps(t *testing.T) { // Wait for process waitProcess(&pconfig, t) - outputStatus := string(stdout.Bytes()) + outputStatus := stdout.String() lines := strings.Split(outputStatus, "\n") @@ -419,7 +419,7 @@ func TestProcessCaps(t *testing.T) { // Wait for process waitProcess(&pconfig, t) - outputStatus := string(stdout.Bytes()) + outputStatus := stdout.String() lines := strings.Split(outputStatus, "\n") @@ -483,7 +483,7 @@ func TestAdditionalGroups(t *testing.T) { // Wait for process waitProcess(&pconfig, t) - outputGroups := string(stdout.Bytes()) + outputGroups := stdout.String() // Check that the groups output has the groups that we specified if !strings.Contains(outputGroups, "audio") { @@ -1082,7 +1082,7 @@ func TestSysctl(t *testing.T) { // Wait for process waitProcess(&pconfig, t) - shmmniOutput := string(bytes.TrimSpace(stdout.Bytes())) + shmmniOutput := strings.TrimSpace(stdout.String()) if shmmniOutput != "8192" { t.Fatalf("kernel.shmmni property expected to be 8192, but is %s", shmmniOutput) } @@ -1210,7 +1210,7 @@ func TestOomScoreAdj(t *testing.T) { // Wait for process waitProcess(&pconfig, t) - outputOomScoreAdj := string(bytes.TrimSpace(stdout.Bytes())) + outputOomScoreAdj := strings.TrimSpace(stdout.String()) // Check that the oom_score_adj matches the value that was set as part of config. if outputOomScoreAdj != strconv.Itoa(*config.OomScoreAdj) { diff --git a/libcontainer/integration/execin_test.go b/libcontainer/integration/execin_test.go index 583faa29f..72de06bcc 100644 --- a/libcontainer/integration/execin_test.go +++ b/libcontainer/integration/execin_test.go @@ -188,7 +188,7 @@ func TestExecInAdditionalGroups(t *testing.T) { stdinW.Close() waitProcess(process, t) - outputGroups := string(stdout.Bytes()) + outputGroups := stdout.String() // Check that the groups output has the groups that we specified if !strings.Contains(outputGroups, "audio") { @@ -471,7 +471,7 @@ func TestExecinPassExtraFiles(t *testing.T) { stdinW.Close() waitProcess(process, t) - out := string(stdout.Bytes()) + out := stdout.String() // fd 5 is the directory handle for /proc/$$/fd if out != "0 1 2 3 4 5" { t.Fatalf("expected to have the file descriptors '0 1 2 3 4 5' passed to exec, got '%s'", out)