소스 검색

Merge pull request #2747 from jpoimboe/test-fixes

Test fixes
Victor Vieux 11 년 전
부모
커밋
304a80fcd5
3개의 변경된 파일19개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 1
      integration/commands_test.go
  2. 7 2
      integration/container_test.go
  3. 11 3
      integration/server_test.go

+ 1 - 1
integration/commands_test.go

@@ -329,7 +329,7 @@ func TestRunDisconnectTty(t *testing.T) {
 	// Client disconnect after run -i should keep stdin out in TTY mode
 	container := globalRuntime.List()[0]
 
-	setTimeout(t, "Read/Write assertion timed out", 2000*time.Second, func() {
+	setTimeout(t, "Read/Write assertion timed out", 2*time.Second, func() {
 		if err := assertPipe("hello\n", "hello", stdout, stdinPipe, 15); err != nil {
 			t.Fatal(err)
 		}

+ 7 - 2
integration/container_test.go

@@ -330,6 +330,11 @@ func TestCommitRun(t *testing.T) {
 }
 
 func TestStart(t *testing.T) {
+	_, err1 := os.Stat("/sys/fs/cgroup/cpuacct,cpu")
+	_, err2 := os.Stat("/sys/fs/cgroup/cpu,cpuacct")
+	if err1 == nil || err2 == nil {
+		t.Skip("Fixme. Setting cpu cgroup shares doesn't work in dind on a Fedora host.  The lxc utils are confused by the cpu,cpuacct mount.")
+	}
 	runtime := mkRuntime(t)
 	defer nuke(runtime)
 	container, _, _ := mkContainer(runtime, []string{"-m", "33554432", "-c", "1000", "-i", "_", "/bin/cat"}, t)
@@ -563,7 +568,7 @@ func TestExitCode(t *testing.T) {
 
 	trueContainer, _, err := runtime.Create(&docker.Config{
 		Image: GetTestImage(runtime).ID,
-		Cmd:   []string{"/bin/true", ""},
+		Cmd:   []string{"/bin/true"},
 	}, "")
 	if err != nil {
 		t.Fatal(err)
@@ -578,7 +583,7 @@ func TestExitCode(t *testing.T) {
 
 	falseContainer, _, err := runtime.Create(&docker.Config{
 		Image: GetTestImage(runtime).ID,
-		Cmd:   []string{"/bin/false", ""},
+		Cmd:   []string{"/bin/false"},
 	}, "")
 	if err != nil {
 		t.Fatal(err)

+ 11 - 3
integration/server_test.go

@@ -109,7 +109,7 @@ func TestCreateRmVolumes(t *testing.T) {
 	srv := mkServerFromEngine(eng, t)
 	defer mkRuntimeFromEngine(eng, t).Nuke()
 
-	config, hostConfig, _, err := docker.ParseRun([]string{"-v", "/srv", unitTestImageID, "echo test"}, nil)
+	config, hostConfig, _, err := docker.ParseRun([]string{"-v", "/srv", unitTestImageID, "echo", "test"}, nil)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -164,7 +164,7 @@ func TestCreateStartRestartStopStartKillRm(t *testing.T) {
 	srv := mkServerFromEngine(eng, t)
 	defer mkRuntimeFromEngine(eng, t).Nuke()
 
-	config, hostConfig, _, err := docker.ParseRun([]string{unitTestImageID, "/bin/cat"}, nil)
+	config, hostConfig, _, err := docker.ParseRun([]string{"-i", unitTestImageID, "/bin/cat"}, nil)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -240,7 +240,7 @@ func TestRmi(t *testing.T) {
 		t.Fatal(err)
 	}
 
-	config, hostConfig, _, err := docker.ParseRun([]string{unitTestImageID, "echo test"}, nil)
+	config, hostConfig, _, err := docker.ParseRun([]string{unitTestImageID, "echo", "test"}, nil)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -256,6 +256,10 @@ func TestRmi(t *testing.T) {
 		t.Fatal(err)
 	}
 
+	if _, err := srv.ContainerWait(containerID); err != nil {
+		t.Fatal(err)
+	}
+
 	imageID, err := srv.ContainerCommit(containerID, "test", "", "", "", nil)
 	if err != nil {
 		t.Fatal(err)
@@ -277,6 +281,10 @@ func TestRmi(t *testing.T) {
 		t.Fatal(err)
 	}
 
+	if _, err := srv.ContainerWait(containerID); err != nil {
+		t.Fatal(err)
+	}
+
 	_, err = srv.ContainerCommit(containerID, "test", "", "", "", nil)
 	if err != nil {
 		t.Fatal(err)