integration: Add TestDaemonDNSFallback
Signed-off-by: Tibor Vass <tibor@docker.com> (cherry picked from commit e5ad8b14daf0a1ddb12c0b83d153531afffb908b) Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
9482566a5c
commit
c104a50de4
1 changed files with 35 additions and 0 deletions
35
integration/network/dns_test.go
Normal file
35
integration/network/dns_test.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package network // import "github.com/docker/docker/integration/network"
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/integration/internal/network"
|
||||
"github.com/docker/docker/internal/test/daemon"
|
||||
"gotest.tools/poll"
|
||||
"gotest.tools/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, IsUserNamespace())
|
||||
|
||||
d := daemon.New(t)
|
||||
d.StartWithBusybox(t, "-b", "none", "--dns", "127.127.127.1", "--dns", "8.8.8.8")
|
||||
defer d.Stop(t)
|
||||
|
||||
c := d.NewClientT(t)
|
||||
ctx := context.Background()
|
||||
|
||||
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, types.ContainerRemoveOptions{Force: true})
|
||||
|
||||
poll.WaitOn(t, container.IsSuccessful(ctx, c, cid), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(2*time.Second))
|
||||
}
|
Loading…
Reference in a new issue