Cleanup errorOut resp in diff test
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
This commit is contained in:
parent
7d38ae7041
commit
ac62c5439a
|
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
@ -11,14 +10,18 @@ import (
|
||||||
func TestDiffFilenameShownInOutput(t *testing.T) {
|
func TestDiffFilenameShownInOutput(t *testing.T) {
|
||||||
containerCmd := `echo foo > /root/bar`
|
containerCmd := `echo foo > /root/bar`
|
||||||
runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", containerCmd)
|
runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", containerCmd)
|
||||||
cid, _, err := runCommandWithOutput(runCmd)
|
out, _, err := runCommandWithOutput(runCmd)
|
||||||
errorOut(err, t, fmt.Sprintf("failed to start the container: %v", err))
|
if err != nil {
|
||||||
|
t.Fatalf("failed to start the container: %s, %v", out, err)
|
||||||
|
}
|
||||||
|
|
||||||
cleanCID := stripTrailingCharacters(cid)
|
cleanCID := stripTrailingCharacters(out)
|
||||||
|
|
||||||
diffCmd := exec.Command(dockerBinary, "diff", cleanCID)
|
diffCmd := exec.Command(dockerBinary, "diff", cleanCID)
|
||||||
out, _, err := runCommandWithOutput(diffCmd)
|
out, _, err = runCommandWithOutput(diffCmd)
|
||||||
errorOut(err, t, fmt.Sprintf("failed to run diff: %v %v", out, err))
|
if err != nil {
|
||||||
|
t.Fatalf("failed to run diff: %s %v", out, err)
|
||||||
|
}
|
||||||
|
|
||||||
found := false
|
found := false
|
||||||
for _, line := range strings.Split(out, "\n") {
|
for _, line := range strings.Split(out, "\n") {
|
||||||
|
|
@ -44,14 +47,18 @@ func TestDiffEnsureDockerinitFilesAreIgnored(t *testing.T) {
|
||||||
for i := 0; i < 20; i++ {
|
for i := 0; i < 20; i++ {
|
||||||
containerCmd := `echo foo > /root/bar`
|
containerCmd := `echo foo > /root/bar`
|
||||||
runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", containerCmd)
|
runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sh", "-c", containerCmd)
|
||||||
cid, _, err := runCommandWithOutput(runCmd)
|
out, _, err := runCommandWithOutput(runCmd)
|
||||||
errorOut(err, t, fmt.Sprintf("%s", err))
|
if err != nil {
|
||||||
|
t.Fatal(out, err)
|
||||||
|
}
|
||||||
|
|
||||||
cleanCID := stripTrailingCharacters(cid)
|
cleanCID := stripTrailingCharacters(out)
|
||||||
|
|
||||||
diffCmd := exec.Command(dockerBinary, "diff", cleanCID)
|
diffCmd := exec.Command(dockerBinary, "diff", cleanCID)
|
||||||
out, _, err := runCommandWithOutput(diffCmd)
|
out, _, err = runCommandWithOutput(diffCmd)
|
||||||
errorOut(err, t, fmt.Sprintf("failed to run diff: %v %v", out, err))
|
if err != nil {
|
||||||
|
t.Fatalf("failed to run diff: %s, %v", out, err)
|
||||||
|
}
|
||||||
|
|
||||||
deleteContainer(cleanCID)
|
deleteContainer(cleanCID)
|
||||||
|
|
||||||
|
|
@ -67,13 +74,18 @@ func TestDiffEnsureDockerinitFilesAreIgnored(t *testing.T) {
|
||||||
|
|
||||||
func TestDiffEnsureOnlyKmsgAndPtmx(t *testing.T) {
|
func TestDiffEnsureOnlyKmsgAndPtmx(t *testing.T) {
|
||||||
runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sleep", "0")
|
runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "sleep", "0")
|
||||||
cid, _, err := runCommandWithOutput(runCmd)
|
out, _, err := runCommandWithOutput(runCmd)
|
||||||
errorOut(err, t, fmt.Sprintf("%s", err))
|
if err != nil {
|
||||||
cleanCID := stripTrailingCharacters(cid)
|
t.Fatal(out, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanCID := stripTrailingCharacters(out)
|
||||||
|
|
||||||
diffCmd := exec.Command(dockerBinary, "diff", cleanCID)
|
diffCmd := exec.Command(dockerBinary, "diff", cleanCID)
|
||||||
out, _, err := runCommandWithOutput(diffCmd)
|
out, _, err = runCommandWithOutput(diffCmd)
|
||||||
errorOut(err, t, fmt.Sprintf("failed to run diff: %v %v", out, err))
|
if err != nil {
|
||||||
|
t.Fatalf("failed to run diff: %s, %v", out, err)
|
||||||
|
}
|
||||||
deleteContainer(cleanCID)
|
deleteContainer(cleanCID)
|
||||||
|
|
||||||
expected := map[string]bool{
|
expected := map[string]bool{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue