Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit e0305a0

Browse files
author
Tibor Vass
committed
integration: Add TestDaemonDNSFallback
Signed-off-by: Tibor Vass <tibor@docker.com> (cherry picked from commit e5ad8b14daf0a1ddb12c0b83d153531afffb908b) Signed-off-by: Tibor Vass <tibor@docker.com> Upstream-commit: c104a50de418790dc3a3f89d9345a60371fdaf87 Component: engine
1 parent 0b5e7e9 commit e0305a0

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package network // import "github.com/docker/docker/integration/network"
2+
3+
import (
4+
"context"
5+
"testing"
6+
"time"
7+
8+
"github.com/docker/docker/api/types"
9+
"github.com/docker/docker/integration/internal/container"
10+
"github.com/docker/docker/integration/internal/network"
11+
"github.com/docker/docker/internal/test/daemon"
12+
"gotest.tools/poll"
13+
"gotest.tools/skip"
14+
)
15+
16+
func TestDaemonDNSFallback(t *testing.T) {
17+
skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
18+
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
19+
skip.If(t, IsUserNamespace())
20+
21+
d := daemon.New(t)
22+
d.StartWithBusybox(t, "-b", "none", "--dns", "127.127.127.1", "--dns", "8.8.8.8")
23+
defer d.Stop(t)
24+
25+
c := d.NewClientT(t)
26+
ctx := context.Background()
27+
28+
network.CreateNoError(ctx, t, c, "test")
29+
defer c.NetworkRemove(ctx, "test")
30+
31+
cid := container.Run(ctx, t, c, container.WithNetworkMode("test"), container.WithCmd("nslookup", "docker.com"))
32+
defer c.ContainerRemove(ctx, cid, types.ContainerRemoveOptions{Force: true})
33+
34+
poll.WaitOn(t, container.IsSuccessful(ctx, c, cid), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(2*time.Second))
35+
}

0 commit comments

Comments
 (0)