github.com/lacework-dev/go-moby@v20.10.12+incompatible/integration/network/dns_test.go (about) 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/testutil/daemon" 12 "gotest.tools/v3/poll" 13 "gotest.tools/v3/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(10*time.Second)) 35 }