|
@@ -583,106 +583,6 @@ func TestRestartWithVolumes(t *testing.T) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func TestContainerNetwork(t *testing.T) {
|
|
|
- daemon := mkDaemon(t)
|
|
|
- defer nuke(daemon)
|
|
|
- container, _, err := daemon.Create(
|
|
|
- &runconfig.Config{
|
|
|
- Image: GetTestImage(daemon).ID,
|
|
|
- // If I change this to ping 8.8.8.8 it fails. Any idea why? - timthelion
|
|
|
- Cmd: []string{"ping", "-c", "1", "127.0.0.1"},
|
|
|
- },
|
|
|
- "",
|
|
|
- )
|
|
|
- if err != nil {
|
|
|
- t.Fatal(err)
|
|
|
- }
|
|
|
- defer daemon.Destroy(container)
|
|
|
- if err := container.Run(); err != nil {
|
|
|
- t.Fatal(err)
|
|
|
- }
|
|
|
- if code := container.State.GetExitCode(); code != 0 {
|
|
|
- t.Fatalf("Unexpected ping 127.0.0.1 exit code %d (expected 0)", code)
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// Issue #4681
|
|
|
-func TestLoopbackFunctionsWhenNetworkingIsDissabled(t *testing.T) {
|
|
|
- daemon := mkDaemon(t)
|
|
|
- defer nuke(daemon)
|
|
|
- container, _, err := daemon.Create(
|
|
|
- &runconfig.Config{
|
|
|
- Image: GetTestImage(daemon).ID,
|
|
|
- Cmd: []string{"ping", "-c", "1", "127.0.0.1"},
|
|
|
- NetworkDisabled: true,
|
|
|
- },
|
|
|
- "",
|
|
|
- )
|
|
|
- if err != nil {
|
|
|
- t.Fatal(err)
|
|
|
- }
|
|
|
- defer daemon.Destroy(container)
|
|
|
- if err := container.Run(); err != nil {
|
|
|
- t.Fatal(err)
|
|
|
- }
|
|
|
- if code := container.State.GetExitCode(); code != 0 {
|
|
|
- t.Fatalf("Unexpected ping 127.0.0.1 exit code %d (expected 0)", code)
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-func TestOnlyLoopbackExistsWhenUsingDisableNetworkOption(t *testing.T) {
|
|
|
- eng := NewTestEngine(t)
|
|
|
- daemon := mkDaemonFromEngine(eng, t)
|
|
|
- defer nuke(daemon)
|
|
|
-
|
|
|
- config, hc, _, err := runconfig.Parse([]string{"-n=false", GetTestImage(daemon).ID, "ip", "addr", "show", "up"}, nil)
|
|
|
- if err != nil {
|
|
|
- t.Fatal(err)
|
|
|
- }
|
|
|
-
|
|
|
- jobCreate := eng.Job("create")
|
|
|
- if err := jobCreate.ImportEnv(config); err != nil {
|
|
|
- t.Fatal(err)
|
|
|
- }
|
|
|
- var id string
|
|
|
- jobCreate.Stdout.AddString(&id)
|
|
|
- if err := jobCreate.Run(); err != nil {
|
|
|
- t.Fatal(err)
|
|
|
- }
|
|
|
- // FIXME: this hack can be removed once Wait is a job
|
|
|
- c := daemon.Get(id)
|
|
|
- if c == nil {
|
|
|
- t.Fatalf("Couldn't retrieve container %s from daemon", id)
|
|
|
- }
|
|
|
- stdout, err := c.StdoutPipe()
|
|
|
- if err != nil {
|
|
|
- t.Fatal(err)
|
|
|
- }
|
|
|
-
|
|
|
- jobStart := eng.Job("start", id)
|
|
|
- if err := jobStart.ImportEnv(hc); err != nil {
|
|
|
- t.Fatal(err)
|
|
|
- }
|
|
|
- if err := jobStart.Run(); err != nil {
|
|
|
- t.Fatal(err)
|
|
|
- }
|
|
|
-
|
|
|
- c.WaitTimeout(500 * time.Millisecond)
|
|
|
- c.Wait()
|
|
|
- output, err := ioutil.ReadAll(stdout)
|
|
|
- if err != nil {
|
|
|
- t.Fatal(err)
|
|
|
- }
|
|
|
-
|
|
|
- interfaces := regexp.MustCompile(`(?m)^[0-9]+: [a-zA-Z0-9]+`).FindAllString(string(output), -1)
|
|
|
- if len(interfaces) != 1 {
|
|
|
- t.Fatalf("Wrong interface count in test container: expected [*: lo], got %s", interfaces)
|
|
|
- }
|
|
|
- if !strings.HasSuffix(interfaces[0], ": lo") {
|
|
|
- t.Fatalf("Wrong interface in test container: expected [*: lo], got %s", interfaces)
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
func TestPrivilegedCanMknod(t *testing.T) {
|
|
|
eng := NewTestEngine(t)
|
|
|
daemon := mkDaemonFromEngine(eng, t)
|