mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Last three tests skip on lxc.
Now we can scale lxc tests to all PRs. Docker-DCO-1.1-Signed-off-by: Jessie Frazelle <princess@docker.com> (github: jfrazelle) Docker-DCO-1.1-Signed-off-by: Jessie Frazelle <hugs@docker.com> (github: jfrazelle) Docker-DCO-1.1-Signed-off-by: Jessie Frazelle <jess@docker.com> (github: jfrazelle)
This commit is contained in:
parent
df7ba57f5f
commit
321874f376
6 changed files with 43 additions and 12 deletions
|
@ -2,11 +2,12 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/docker/docker/nat"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/docker/docker/nat"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Make sure we can create a simple container with some args
|
// Make sure we can create a simple container with some args
|
||||||
|
@ -227,8 +228,8 @@ func TestCreateEchoStdout(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateVolumesCreated(t *testing.T) {
|
func TestCreateVolumesCreated(t *testing.T) {
|
||||||
defer deleteAllContainers()
|
|
||||||
testRequires(t, SameHostDaemon)
|
testRequires(t, SameHostDaemon)
|
||||||
|
defer deleteAllContainers()
|
||||||
|
|
||||||
name := "test_create_volume"
|
name := "test_create_volume"
|
||||||
if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "create", "--name", name, "-v", "/foo", "busybox")); err != nil {
|
if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "create", "--name", name, "-v", "/foo", "busybox")); err != nil {
|
||||||
|
|
|
@ -30,9 +30,8 @@ func TestLinksEtcHostsRegularFile(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLinksEtcHostsContentMatch(t *testing.T) {
|
func TestLinksEtcHostsContentMatch(t *testing.T) {
|
||||||
defer deleteAllContainers()
|
|
||||||
|
|
||||||
testRequires(t, SameHostDaemon)
|
testRequires(t, SameHostDaemon)
|
||||||
|
defer deleteAllContainers()
|
||||||
|
|
||||||
runCmd := exec.Command(dockerBinary, "run", "--net=host", "busybox", "cat", "/etc/hosts")
|
runCmd := exec.Command(dockerBinary, "run", "--net=host", "busybox", "cat", "/etc/hosts")
|
||||||
out, _, _, err := runCommandWithStdoutStderr(runCmd)
|
out, _, _, err := runCommandWithStdoutStderr(runCmd)
|
||||||
|
@ -124,9 +123,8 @@ func TestLinksPingLinkedContainersAfterRename(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLinksIpTablesRulesWhenLinkAndUnlink(t *testing.T) {
|
func TestLinksIpTablesRulesWhenLinkAndUnlink(t *testing.T) {
|
||||||
defer deleteAllContainers()
|
|
||||||
|
|
||||||
testRequires(t, SameHostDaemon)
|
testRequires(t, SameHostDaemon)
|
||||||
|
defer deleteAllContainers()
|
||||||
|
|
||||||
dockerCmd(t, "run", "-d", "--name", "child", "--publish", "8080:80", "busybox", "sleep", "10")
|
dockerCmd(t, "run", "-d", "--name", "child", "--publish", "8080:80", "busybox", "sleep", "10")
|
||||||
dockerCmd(t, "run", "-d", "--name", "parent", "--link", "child:http", "busybox", "sleep", "10")
|
dockerCmd(t, "run", "-d", "--name", "parent", "--link", "child:http", "busybox", "sleep", "10")
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNetworkNat(t *testing.T) {
|
func TestNetworkNat(t *testing.T) {
|
||||||
testRequires(t, SameHostDaemon)
|
testRequires(t, SameHostDaemon, NativeExecDriver)
|
||||||
defer deleteAllContainers()
|
defer deleteAllContainers()
|
||||||
|
|
||||||
iface, err := net.InterfaceByName("eth0")
|
iface, err := net.InterfaceByName("eth0")
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRmContainerWithRemovedVolume(t *testing.T) {
|
func TestRmContainerWithRemovedVolume(t *testing.T) {
|
||||||
defer deleteAllContainers()
|
|
||||||
testRequires(t, SameHostDaemon)
|
testRequires(t, SameHostDaemon)
|
||||||
|
defer deleteAllContainers()
|
||||||
|
|
||||||
cmd := exec.Command(dockerBinary, "run", "--name", "losemyvolumes", "-v", "/tmp/testing:/test", "busybox", "true")
|
cmd := exec.Command(dockerBinary, "run", "--name", "losemyvolumes", "-v", "/tmp/testing:/test", "busybox", "true")
|
||||||
if _, err := runCommand(cmd); err != nil {
|
if _, err := runCommand(cmd); err != nil {
|
||||||
|
|
|
@ -1348,8 +1348,8 @@ func TestRunAddingOptionalDevices(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunModeHostname(t *testing.T) {
|
func TestRunModeHostname(t *testing.T) {
|
||||||
defer deleteAllContainers()
|
|
||||||
testRequires(t, SameHostDaemon)
|
testRequires(t, SameHostDaemon)
|
||||||
|
defer deleteAllContainers()
|
||||||
|
|
||||||
cmd := exec.Command(dockerBinary, "run", "-h=testhostname", "busybox", "cat", "/etc/hostname")
|
cmd := exec.Command(dockerBinary, "run", "-h=testhostname", "busybox", "cat", "/etc/hostname")
|
||||||
out, _, err := runCommandWithOutput(cmd)
|
out, _, err := runCommandWithOutput(cmd)
|
||||||
|
@ -2764,6 +2764,7 @@ func TestRunExposePort(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunUnknownCommand(t *testing.T) {
|
func TestRunUnknownCommand(t *testing.T) {
|
||||||
|
testRequires(t, NativeExecDriver)
|
||||||
defer deleteAllContainers()
|
defer deleteAllContainers()
|
||||||
runCmd := exec.Command(dockerBinary, "create", "busybox", "/bin/nada")
|
runCmd := exec.Command(dockerBinary, "create", "busybox", "/bin/nada")
|
||||||
cID, _, _, err := runCommandWithStdoutStderr(runCmd)
|
cID, _, _, err := runCommandWithStdoutStderr(runCmd)
|
||||||
|
@ -2791,8 +2792,8 @@ func TestRunUnknownCommand(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunModeIpcHost(t *testing.T) {
|
func TestRunModeIpcHost(t *testing.T) {
|
||||||
defer deleteAllContainers()
|
|
||||||
testRequires(t, SameHostDaemon)
|
testRequires(t, SameHostDaemon)
|
||||||
|
defer deleteAllContainers()
|
||||||
|
|
||||||
hostIpc, err := os.Readlink("/proc/1/ns/ipc")
|
hostIpc, err := os.Readlink("/proc/1/ns/ipc")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -2901,8 +2902,8 @@ func TestContainerNetworkMode(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunModePidHost(t *testing.T) {
|
func TestRunModePidHost(t *testing.T) {
|
||||||
|
testRequires(t, NativeExecDriver, SameHostDaemon)
|
||||||
defer deleteAllContainers()
|
defer deleteAllContainers()
|
||||||
testRequires(t, SameHostDaemon)
|
|
||||||
|
|
||||||
hostPid, err := os.Readlink("/proc/1/ns/pid")
|
hostPid, err := os.Readlink("/proc/1/ns/pid")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -3047,8 +3048,8 @@ func TestRunNonLocalMacAddress(t *testing.T) {
|
||||||
|
|
||||||
func TestRunNetHost(t *testing.T) {
|
func TestRunNetHost(t *testing.T) {
|
||||||
testRequires(t, SameHostDaemon)
|
testRequires(t, SameHostDaemon)
|
||||||
|
|
||||||
defer deleteAllContainers()
|
defer deleteAllContainers()
|
||||||
|
|
||||||
hostNet, err := os.Readlink("/proc/1/ns/net")
|
hostNet, err := os.Readlink("/proc/1/ns/net")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -3157,7 +3158,9 @@ func TestRunContainerWithWritableRootfs(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunContainerWithReadonlyRootfs(t *testing.T) {
|
func TestRunContainerWithReadonlyRootfs(t *testing.T) {
|
||||||
|
testRequires(t, NativeExecDriver)
|
||||||
defer deleteAllContainers()
|
defer deleteAllContainers()
|
||||||
|
|
||||||
out, err := exec.Command(dockerBinary, "run", "--read-only", "--rm", "busybox", "touch", "/file").CombinedOutput()
|
out, err := exec.Command(dockerBinary, "run", "--read-only", "--rm", "busybox", "touch", "/file").CombinedOutput()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("expected container to error on run with read only error")
|
t.Fatal("expected container to error on run with read only error")
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,6 +18,8 @@ type TestRequirement struct {
|
||||||
|
|
||||||
// List test requirements
|
// List test requirements
|
||||||
var (
|
var (
|
||||||
|
daemonExecDriver string
|
||||||
|
|
||||||
SameHostDaemon = TestRequirement{
|
SameHostDaemon = TestRequirement{
|
||||||
func() bool { return isLocalDaemon },
|
func() bool { return isLocalDaemon },
|
||||||
"Test requires docker daemon to runs on the same machine as CLI",
|
"Test requires docker daemon to runs on the same machine as CLI",
|
||||||
|
@ -37,6 +42,30 @@ var (
|
||||||
},
|
},
|
||||||
fmt.Sprintf("Test requires an environment that can host %s in the same host", v2binary),
|
fmt.Sprintf("Test requires an environment that can host %s in the same host", v2binary),
|
||||||
}
|
}
|
||||||
|
NativeExecDriver = TestRequirement{
|
||||||
|
func() bool {
|
||||||
|
if daemonExecDriver == "" {
|
||||||
|
// get daemon info
|
||||||
|
body, err := sockRequest("GET", "/info", nil)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("sockRequest failed for /info: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
type infoJSON struct {
|
||||||
|
ExecutionDriver string
|
||||||
|
}
|
||||||
|
var info infoJSON
|
||||||
|
if err = json.Unmarshal(body, &info); err != nil {
|
||||||
|
log.Fatalf("unable to unmarshal body: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
daemonExecDriver = info.ExecutionDriver
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.HasPrefix(daemonExecDriver, "native")
|
||||||
|
},
|
||||||
|
"Test requires the native (libcontainer) exec driver.",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// testRequires checks if the environment satisfies the requirements
|
// testRequires checks if the environment satisfies the requirements
|
||||||
|
|
Loading…
Reference in a new issue