Merge component 'engine' from git@github.com:moby/moby master
This commit is contained in:
@@ -1,19 +1,15 @@
|
||||
package container // import "github.com/docker/docker/integration/container"
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/integration/internal/container"
|
||||
"github.com/docker/docker/integration/internal/request"
|
||||
"github.com/docker/docker/pkg/stdcopy"
|
||||
"github.com/gotestyourself/gotestyourself/poll"
|
||||
"github.com/gotestyourself/gotestyourself/skip"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -29,21 +25,13 @@ func TestLinksEtcHostsContentMatch(t *testing.T) {
|
||||
client := request.NewAPIClient(t)
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(t, ctx, client, container.WithCmd("cat", "/etc/hosts"), container.WithNetworkMode("host"))
|
||||
|
||||
poll.WaitOn(t, container.IsStopped(ctx, client, cID), poll.WithDelay(100*time.Millisecond))
|
||||
|
||||
body, err := client.ContainerLogs(ctx, cID, types.ContainerLogsOptions{
|
||||
ShowStdout: true,
|
||||
})
|
||||
cID := container.Run(t, ctx, client, container.WithNetworkMode("host"))
|
||||
res, err := container.Exec(ctx, client, cID, []string{"cat", "/etc/hosts"})
|
||||
require.NoError(t, err)
|
||||
defer body.Close()
|
||||
require.Empty(t, res.Stderr())
|
||||
require.Equal(t, 0, res.ExitCode)
|
||||
|
||||
var b bytes.Buffer
|
||||
_, err = stdcopy.StdCopy(&b, ioutil.Discard, body)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, string(hosts), b.String())
|
||||
assert.Equal(t, string(hosts), res.Stdout())
|
||||
}
|
||||
|
||||
func TestLinksContainerNames(t *testing.T) {
|
||||
|
||||
@@ -30,7 +30,7 @@ func TestContainerShmNoLeak(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
d.StartWithBusybox(t)
|
||||
d.StartWithBusybox(t, "--iptables=false")
|
||||
defer d.Stop(t)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
Reference in New Issue
Block a user