moby/integration/network/dns_test.go
Sebastiaan van Stijn 0f77875220
api/types: move ContainerRemoveOptions to api/types/container
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-12 11:29:23 +02:00

35 lines
1.2 KiB
Go

package network // import "github.com/docker/docker/integration/network"
import (
"testing"
"time"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/integration/internal/network"
"github.com/docker/docker/testutil"
"github.com/docker/docker/testutil/daemon"
"gotest.tools/v3/poll"
"gotest.tools/v3/skip"
)
func TestDaemonDNSFallback(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
skip.If(t, testEnv.IsUserNamespace)
ctx := testutil.StartSpan(baseContext, t)
d := daemon.New(t)
d.StartWithBusybox(ctx, t, "-b", "none", "--dns", "127.127.127.1", "--dns", "8.8.8.8")
defer d.Stop(t)
c := d.NewClientT(t)
network.CreateNoError(ctx, t, c, "test")
defer c.NetworkRemove(ctx, "test")
cid := container.Run(ctx, t, c, container.WithNetworkMode("test"), container.WithCmd("nslookup", "docker.com"))
defer c.ContainerRemove(ctx, cid, containertypes.RemoveOptions{Force: true})
poll.WaitOn(t, container.IsSuccessful(ctx, c, cid), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(10*time.Second))
}