integration-cli: split DockerSuite into subsequent build suites
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
7ed823ead9
commit
0e6a1b9596
67 changed files with 1844 additions and 1147 deletions
|
@ -7,11 +7,24 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) BenchmarkConcurrentContainerActions(c *testing.B) {
|
||||
type DockerBenchmarkSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerBenchmarkSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerBenchmarkSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerBenchmarkSuite) BenchmarkConcurrentContainerActions(c *testing.B) {
|
||||
maxConcurrency := runtime.GOMAXPROCS(0)
|
||||
numIterations := c.N
|
||||
outerGroup := &sync.WaitGroup{}
|
||||
|
@ -92,3 +105,26 @@ func (s *DockerSuite) BenchmarkConcurrentContainerActions(c *testing.B) {
|
|||
assert.NilError(c, err)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerBenchmarkSuite) BenchmarkLogsCLIRotateFollow(c *testing.B) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "--log-opt", "max-size=1b", "--log-opt", "max-file=10", "busybox", "sh", "-c", "while true; do usleep 50000; echo hello; done")
|
||||
id := strings.TrimSpace(out)
|
||||
ch := make(chan error, 1)
|
||||
go func() {
|
||||
ch <- nil
|
||||
out, _, _ := dockerCmdWithError("logs", "-f", id)
|
||||
// if this returns at all, it's an error
|
||||
ch <- fmt.Errorf(out)
|
||||
}()
|
||||
|
||||
<-ch
|
||||
select {
|
||||
case <-time.After(30 * time.Second):
|
||||
// ran for 30 seconds with no problem
|
||||
return
|
||||
case err := <-ch:
|
||||
if err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,240 @@ func ensureTestEnvSetup(t *testing.T) {
|
|||
|
||||
func TestDockerSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerSuite{})
|
||||
suite.Run(t, &DockerAPISuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerBenchmarkSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIAttachSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIBuildSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLICommitSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLICpSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLICreateSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIEventSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIExecSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIHealthSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIHistorySuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIImagesSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIImportSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIInfoSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIInspectSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLILinksSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLILoginSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLILogsSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLINetmodeSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLINetworkSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIPluginLogDriverSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIPluginsSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIPortSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIProxySuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIPruneSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIPsSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIPullSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIPushSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIRestartSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIRmiSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIRunSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLISaveLoadSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLISearchSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLISNISuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIStartSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIStatsSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLITopSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIUpdateSuite{ds: &DockerSuite{}})
|
||||
suite.Run(t, &DockerCLIVolumeSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerAPISuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerAPISuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerBenchmarkSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerBenchmarkSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIAttachSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIAttachSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIBuildSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIBuildSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLICommitSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLICommitSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLICpSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLICpSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLICreateSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLICreateSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIEventSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIEventSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIExecSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIExecSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIHealthSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIHealthSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIHistorySuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIHistorySuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIImagesSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIImagesSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIImportSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIImportSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIInfoSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIInfoSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIInspectSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIInspectSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLILinksSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLILinksSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLILoginSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLILoginSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLILogsSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLILogsSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLINetmodeSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLINetmodeSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLINetworkSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLINetworkSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIPluginLogDriverSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIPluginLogDriverSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIPluginsSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIPluginsSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIPortSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIPortSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIProxySuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIProxySuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIPruneSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIPruneSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIPsSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIPsSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIPullSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIPullSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIPushSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIPushSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIRestartSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIRestartSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIRmiSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIRmiSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIRunSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIRunSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLISaveLoadSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLISaveLoadSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLISearchSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLISearchSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLISNISuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLISNISuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIStartSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIStartSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIStatsSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIStatsSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLITopSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLITopSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIUpdateSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIUpdateSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerCLIVolumeSuite(t *testing.T) {
|
||||
ensureTestEnvSetup(t)
|
||||
suite.Run(t, &DockerCLIVolumeSuite{ds: &DockerSuite{}})
|
||||
}
|
||||
|
||||
func TestDockerRegistrySuite(t *testing.T) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestGetContainersAttachWebsocket(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestGetContainersAttachWebsocket(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-dit", "busybox", "cat")
|
||||
|
||||
|
@ -75,7 +75,7 @@ func (s *DockerSuite) TestGetContainersAttachWebsocket(c *testing.T) {
|
|||
}
|
||||
|
||||
// regression gh14320
|
||||
func (s *DockerSuite) TestPostContainersAttachContainerNotFound(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestPostContainersAttachContainerNotFound(c *testing.T) {
|
||||
resp, _, err := request.Post("/containers/doesnotexist/attach")
|
||||
assert.NilError(c, err)
|
||||
// connection will shutdown, err should be "persistent connection closed"
|
||||
|
@ -86,7 +86,7 @@ func (s *DockerSuite) TestPostContainersAttachContainerNotFound(c *testing.T) {
|
|||
assert.Equal(c, string(content), expected)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestGetContainersWsAttachContainerNotFound(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestGetContainersWsAttachContainerNotFound(c *testing.T) {
|
||||
res, body, err := request.Get("/containers/doesnotexist/attach/ws")
|
||||
assert.Equal(c, res.StatusCode, http.StatusNotFound)
|
||||
assert.NilError(c, err)
|
||||
|
@ -96,7 +96,7 @@ func (s *DockerSuite) TestGetContainersWsAttachContainerNotFound(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(getErrorMessage(c, b), expected))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersAttach(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestPostContainersAttach(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
expectSuccess := func(wc io.WriteCloser, br *bufio.Reader, stream string, tty bool) {
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestBuildAPIDockerFileRemote(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildAPIDockerFileRemote(c *testing.T) {
|
||||
testRequires(c, NotUserNamespace)
|
||||
|
||||
var testD string
|
||||
|
@ -52,7 +52,7 @@ RUN find /tmp/`
|
|||
assert.Assert(c, !strings.Contains(out, "baz"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildAPIRemoteTarballContext(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildAPIRemoteTarballContext(c *testing.T) {
|
||||
buffer := new(bytes.Buffer)
|
||||
tw := tar.NewWriter(buffer)
|
||||
defer tw.Close()
|
||||
|
@ -79,7 +79,7 @@ func (s *DockerSuite) TestBuildAPIRemoteTarballContext(c *testing.T) {
|
|||
b.Close()
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildAPIRemoteTarballContextWithCustomDockerfile(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildAPIRemoteTarballContextWithCustomDockerfile(c *testing.T) {
|
||||
buffer := new(bytes.Buffer)
|
||||
tw := tar.NewWriter(buffer)
|
||||
defer tw.Close()
|
||||
|
@ -133,7 +133,7 @@ RUN echo 'right'
|
|||
assert.Assert(c, !strings.Contains(string(content), "wrong"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildAPILowerDockerfile(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildAPILowerDockerfile(c *testing.T) {
|
||||
git := fakegit.New(c, "repo", map[string]string{
|
||||
"dockerfile": `FROM busybox
|
||||
RUN echo from dockerfile`,
|
||||
|
@ -151,7 +151,7 @@ RUN echo from dockerfile`,
|
|||
assert.Assert(c, is.Contains(out, "from dockerfile"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildAPIBuildGitWithF(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildAPIBuildGitWithF(c *testing.T) {
|
||||
git := fakegit.New(c, "repo", map[string]string{
|
||||
"baz": `FROM busybox
|
||||
RUN echo from baz`,
|
||||
|
@ -172,7 +172,7 @@ RUN echo from Dockerfile`,
|
|||
assert.Assert(c, is.Contains(out, "from baz"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildAPIDoubleDockerfile(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildAPIDoubleDockerfile(c *testing.T) {
|
||||
testRequires(c, UnixCli) // dockerfile overwrites Dockerfile on Windows
|
||||
git := fakegit.New(c, "repo", map[string]string{
|
||||
"Dockerfile": `FROM busybox
|
||||
|
@ -194,7 +194,7 @@ RUN echo from dockerfile`,
|
|||
assert.Assert(c, is.Contains(out, "from Dockerfile"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildAPIUnnormalizedTarPaths(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildAPIUnnormalizedTarPaths(c *testing.T) {
|
||||
// Make sure that build context tars with entries of the form
|
||||
// x/./y don't cause caching false positives.
|
||||
|
||||
|
@ -248,7 +248,7 @@ func (s *DockerSuite) TestBuildAPIUnnormalizedTarPaths(c *testing.T) {
|
|||
assert.Assert(c, imageA != imageB)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildOnBuildWithCopy(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildOnBuildWithCopy(c *testing.T) {
|
||||
dockerfile := `
|
||||
FROM ` + minimalBaseImage() + ` as onbuildbase
|
||||
ONBUILD COPY file /file
|
||||
|
@ -273,7 +273,7 @@ func (s *DockerSuite) TestBuildOnBuildWithCopy(c *testing.T) {
|
|||
assert.Assert(c, is.Contains(string(out), "Successfully built"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildOnBuildCache(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildOnBuildCache(c *testing.T) {
|
||||
build := func(dockerfile string) []byte {
|
||||
ctx := fakecontext.New(c, "",
|
||||
fakecontext.WithDockerfile(dockerfile),
|
||||
|
@ -352,7 +352,7 @@ func (s *DockerRegistrySuite) TestBuildCopyFromForcePull(c *testing.T) {
|
|||
assert.Check(c, is.Contains(string(out), "Successfully built"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildAddRemoteNoDecompress(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildAddRemoteNoDecompress(c *testing.T) {
|
||||
buffer := new(bytes.Buffer)
|
||||
tw := tar.NewWriter(buffer)
|
||||
dt := []byte("contents")
|
||||
|
@ -396,7 +396,7 @@ func (s *DockerSuite) TestBuildAddRemoteNoDecompress(c *testing.T) {
|
|||
assert.Check(c, is.Contains(string(out), "Successfully built"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildChownOnCopy(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildChownOnCopy(c *testing.T) {
|
||||
// new feature added in 1.31 - https://github.com/moby/moby/pull/34263
|
||||
testRequires(c, DaemonIsLinux, MinimumAPIVersion("1.31"))
|
||||
dockerfile := `FROM busybox
|
||||
|
@ -426,7 +426,7 @@ func (s *DockerSuite) TestBuildChownOnCopy(c *testing.T) {
|
|||
assert.Check(c, is.Contains(string(out), "Successfully built"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildCopyCacheOnFileChange(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildCopyCacheOnFileChange(c *testing.T) {
|
||||
|
||||
dockerfile := `FROM busybox
|
||||
COPY file /file`
|
||||
|
@ -467,7 +467,7 @@ COPY file /file`
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildAddCacheOnFileChange(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildAddCacheOnFileChange(c *testing.T) {
|
||||
|
||||
dockerfile := `FROM busybox
|
||||
ADD file /file`
|
||||
|
@ -508,7 +508,7 @@ ADD file /file`
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildScratchCopy(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildScratchCopy(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerfile := `FROM scratch
|
||||
ADD Dockerfile /
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestBuildWithRecycleBin(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestBuildWithRecycleBin(c *testing.T) {
|
||||
testRequires(c, DaemonIsWindows)
|
||||
|
||||
dockerfile := "" +
|
||||
|
|
|
@ -36,7 +36,7 @@ import (
|
|||
"gotest.tools/v3/poll"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIGetAll(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIGetAll(c *testing.T) {
|
||||
startCount := getContainerCount(c)
|
||||
name := "getall"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "true")
|
||||
|
@ -56,7 +56,7 @@ func (s *DockerSuite) TestContainerAPIGetAll(c *testing.T) {
|
|||
}
|
||||
|
||||
// regression test for empty json field being omitted #13691
|
||||
func (s *DockerSuite) TestContainerAPIGetJSONNoFieldsOmitted(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIGetJSONNoFieldsOmitted(c *testing.T) {
|
||||
startCount := getContainerCount(c)
|
||||
dockerCmd(c, "run", "busybox", "true")
|
||||
|
||||
|
@ -96,7 +96,7 @@ func (s *DockerSuite) TestContainerAPIGetJSONNoFieldsOmitted(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIGetExport(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIGetExport(c *testing.T) {
|
||||
// Not supported on Windows as Windows does not support docker export
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "exportcontainer"
|
||||
|
@ -123,7 +123,7 @@ func (s *DockerSuite) TestContainerAPIGetExport(c *testing.T) {
|
|||
assert.Assert(c, found, "The created test file has not been found in the exported image")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIGetChanges(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIGetChanges(c *testing.T) {
|
||||
// Not supported on Windows as Windows does not support docker diff (/containers/name/changes)
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "changescontainer"
|
||||
|
@ -146,7 +146,7 @@ func (s *DockerSuite) TestContainerAPIGetChanges(c *testing.T) {
|
|||
assert.Assert(c, success, "/etc/passwd has been removed but is not present in the diff")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestGetContainerStats(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestGetContainerStats(c *testing.T) {
|
||||
var (
|
||||
name = "statscontainer"
|
||||
)
|
||||
|
@ -186,7 +186,7 @@ func (s *DockerSuite) TestGetContainerStats(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestGetContainerStatsRmRunning(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestGetContainerStatsRmRunning(c *testing.T) {
|
||||
out := runSleepingContainer(c)
|
||||
id := strings.TrimSpace(out)
|
||||
|
||||
|
@ -253,7 +253,7 @@ func (c *ChannelBuffer) ReadTimeout(p []byte, n time.Duration) (int, error) {
|
|||
// regression test for gh13421
|
||||
// previous test was just checking one stat entry so it didn't fail (stats with
|
||||
// stream false always return one stat)
|
||||
func (s *DockerSuite) TestGetContainerStatsStream(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestGetContainerStatsStream(c *testing.T) {
|
||||
name := "statscontainer"
|
||||
runSleepingContainer(c, "--name", name)
|
||||
|
||||
|
@ -294,7 +294,7 @@ func (s *DockerSuite) TestGetContainerStatsStream(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestGetContainerStatsNoStream(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestGetContainerStatsNoStream(c *testing.T) {
|
||||
name := "statscontainer"
|
||||
runSleepingContainer(c, "--name", name)
|
||||
|
||||
|
@ -334,7 +334,7 @@ func (s *DockerSuite) TestGetContainerStatsNoStream(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestGetStoppedContainerStats(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestGetStoppedContainerStats(c *testing.T) {
|
||||
name := "statscontainer"
|
||||
dockerCmd(c, "create", "--name", name, "busybox", "ps")
|
||||
|
||||
|
@ -361,7 +361,7 @@ func (s *DockerSuite) TestGetStoppedContainerStats(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIPause(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIPause(c *testing.T) {
|
||||
// Problematic on Windows as Windows does not support pause
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -392,7 +392,7 @@ func (s *DockerSuite) TestContainerAPIPause(c *testing.T) {
|
|||
assert.Equal(c, len(pausedContainers), 0, "There should be no paused container.")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPITop(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPITop(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "top && true")
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -415,7 +415,7 @@ func (s *DockerSuite) TestContainerAPITop(c *testing.T) {
|
|||
assert.Equal(c, top.Processes[1][10], "top")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPITopWindows(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPITopWindows(c *testing.T) {
|
||||
testRequires(c, DaemonIsWindows)
|
||||
out := runSleepingContainer(c, "-d")
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -446,7 +446,7 @@ func (s *DockerSuite) TestContainerAPITopWindows(c *testing.T) {
|
|||
assert.Assert(c, foundProcess, "expected to find %s: %v", expectedProcess, top.Processes)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICommit(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICommit(c *testing.T) {
|
||||
cName := "testapicommit"
|
||||
dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
|
||||
|
||||
|
@ -468,7 +468,7 @@ func (s *DockerSuite) TestContainerAPICommit(c *testing.T) {
|
|||
dockerCmd(c, "run", img.ID, "ls", "/test")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICommitWithLabelInConfig(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICommitWithLabelInConfig(c *testing.T) {
|
||||
cName := "testapicommitwithconfig"
|
||||
dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
|
||||
|
||||
|
@ -500,7 +500,7 @@ func (s *DockerSuite) TestContainerAPICommitWithLabelInConfig(c *testing.T) {
|
|||
dockerCmd(c, "run", img.ID, "ls", "/test")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIBadPort(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIBadPort(c *testing.T) {
|
||||
// TODO Windows to Windows CI - Port this test
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -527,7 +527,7 @@ func (s *DockerSuite) TestContainerAPIBadPort(c *testing.T) {
|
|||
assert.ErrorContains(c, err, `invalid port specification: "aa80"`)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICreate(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICreate(c *testing.T) {
|
||||
config := container.Config{
|
||||
Image: "busybox",
|
||||
Cmd: []string{"/bin/sh", "-c", "touch /test && ls /test"},
|
||||
|
@ -544,7 +544,7 @@ func (s *DockerSuite) TestContainerAPICreate(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), "/test")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICreateEmptyConfig(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICreateEmptyConfig(c *testing.T) {
|
||||
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -556,7 +556,7 @@ func (s *DockerSuite) TestContainerAPICreateEmptyConfig(c *testing.T) {
|
|||
assert.ErrorContains(c, err, expected)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICreateMultipleNetworksConfig(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICreateMultipleNetworksConfig(c *testing.T) {
|
||||
// Container creation must fail if client specified configurations for more than one network
|
||||
config := container.Config{
|
||||
Image: "busybox",
|
||||
|
@ -583,13 +583,13 @@ func (s *DockerSuite) TestContainerAPICreateMultipleNetworksConfig(c *testing.T)
|
|||
assert.Assert(c, strings.Contains(msg, "net3"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICreateBridgeNetworkMode(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICreateBridgeNetworkMode(c *testing.T) {
|
||||
// Windows does not support bridge
|
||||
testRequires(c, DaemonIsLinux)
|
||||
UtilCreateNetworkMode(c, "bridge")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICreateOtherNetworkModes(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICreateOtherNetworkModes(c *testing.T) {
|
||||
// Windows does not support these network modes
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
UtilCreateNetworkMode(c, "host")
|
||||
|
@ -618,7 +618,7 @@ func UtilCreateNetworkMode(c *testing.T, networkMode container.NetworkMode) {
|
|||
assert.Equal(c, containerJSON.HostConfig.NetworkMode, networkMode, "Mismatched NetworkMode")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICreateWithCpuSharesCpuset(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICreateWithCpuSharesCpuset(c *testing.T) {
|
||||
// TODO Windows to Windows CI. The CpuShares part could be ported.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := container.Config{
|
||||
|
@ -649,7 +649,7 @@ func (s *DockerSuite) TestContainerAPICreateWithCpuSharesCpuset(c *testing.T) {
|
|||
assert.Equal(c, outCpuset, "0")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIVerifyHeader(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIVerifyHeader(c *testing.T) {
|
||||
config := map[string]interface{}{
|
||||
"Image": "busybox",
|
||||
}
|
||||
|
@ -690,7 +690,7 @@ func (s *DockerSuite) TestContainerAPIVerifyHeader(c *testing.T) {
|
|||
}
|
||||
|
||||
// Issue 14230. daemon should return 500 for invalid port syntax
|
||||
func (s *DockerSuite) TestContainerAPIInvalidPortSyntax(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIInvalidPortSyntax(c *testing.T) {
|
||||
config := `{
|
||||
"Image": "busybox",
|
||||
"HostConfig": {
|
||||
|
@ -716,7 +716,7 @@ func (s *DockerSuite) TestContainerAPIInvalidPortSyntax(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(string(b[:]), "invalid port"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *testing.T) {
|
||||
config := `{
|
||||
"Image": "busybox",
|
||||
"HostConfig": {
|
||||
|
@ -740,7 +740,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *testing.
|
|||
assert.Assert(c, strings.Contains(string(b[:]), "invalid restart policy"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIRestartPolicyRetryMismatch(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIRestartPolicyRetryMismatch(c *testing.T) {
|
||||
config := `{
|
||||
"Image": "busybox",
|
||||
"HostConfig": {
|
||||
|
@ -764,7 +764,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyRetryMismatch(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(string(b[:]), "maximum retry count cannot be used with restart policy"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *testing.T) {
|
||||
config := `{
|
||||
"Image": "busybox",
|
||||
"HostConfig": {
|
||||
|
@ -788,7 +788,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *testing
|
|||
assert.Assert(c, strings.Contains(string(b[:]), "maximum retry count cannot be negative"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIRestartPolicyDefaultRetryCount(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIRestartPolicyDefaultRetryCount(c *testing.T) {
|
||||
config := `{
|
||||
"Image": "busybox",
|
||||
"HostConfig": {
|
||||
|
@ -806,7 +806,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyDefaultRetryCount(c *testing.
|
|||
|
||||
// Issue 7941 - test to make sure a "null" in JSON is just ignored.
|
||||
// W/o this fix a null in JSON would be parsed into a string var as "null"
|
||||
func (s *DockerSuite) TestContainerAPIPostCreateNull(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIPostCreateNull(c *testing.T) {
|
||||
config := `{
|
||||
"Hostname":"",
|
||||
"Domainname":"",
|
||||
|
@ -850,7 +850,7 @@ func (s *DockerSuite) TestContainerAPIPostCreateNull(c *testing.T) {
|
|||
assert.Equal(c, outMemorySwap, "0")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestCreateWithTooLowMemoryLimit(c *testing.T) {
|
||||
// TODO Windows: Port once memory is supported
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := `{
|
||||
|
@ -874,7 +874,7 @@ func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(string(b), "Minimum memory limit allowed is 6MB"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIRename(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIRename(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "--name", "TestContainerAPIRename", "-d", "busybox", "sh")
|
||||
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
@ -891,7 +891,7 @@ func (s *DockerSuite) TestContainerAPIRename(c *testing.T) {
|
|||
assert.Equal(c, name, "/"+newName, "Failed to rename container")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIKill(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIKill(c *testing.T) {
|
||||
name := "test-api-kill"
|
||||
runSleepingContainer(c, "-i", "--name", name)
|
||||
|
||||
|
@ -906,7 +906,7 @@ func (s *DockerSuite) TestContainerAPIKill(c *testing.T) {
|
|||
assert.Equal(c, state, "false", fmt.Sprintf("got wrong State from container %s: %q", name, state))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIRestart(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIRestart(c *testing.T) {
|
||||
name := "test-api-restart"
|
||||
runSleepingContainer(c, "-di", "--name", name)
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
|
@ -920,7 +920,7 @@ func (s *DockerSuite) TestContainerAPIRestart(c *testing.T) {
|
|||
assert.Assert(c, waitInspect(name, "{{ .State.Restarting }} {{ .State.Running }}", "false true", 15*time.Second) == nil)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIRestartNotimeoutParam(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIRestartNotimeoutParam(c *testing.T) {
|
||||
name := "test-api-restart-no-timeout-param"
|
||||
out := runSleepingContainer(c, "-di", "--name", name)
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -936,7 +936,7 @@ func (s *DockerSuite) TestContainerAPIRestartNotimeoutParam(c *testing.T) {
|
|||
assert.Assert(c, waitInspect(name, "{{ .State.Restarting }} {{ .State.Running }}", "false true", 15*time.Second) == nil)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIStart(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIStart(c *testing.T) {
|
||||
name := "testing-start"
|
||||
config := container.Config{
|
||||
Image: "busybox",
|
||||
|
@ -962,7 +962,7 @@ func (s *DockerSuite) TestContainerAPIStart(c *testing.T) {
|
|||
// TODO(tibor): figure out why this doesn't work on windows
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIStop(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIStop(c *testing.T) {
|
||||
name := "test-api-stop"
|
||||
runSleepingContainer(c, "-i", "--name", name)
|
||||
timeout := 30
|
||||
|
@ -985,7 +985,7 @@ func (s *DockerSuite) TestContainerAPIStop(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIWait(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIWait(c *testing.T) {
|
||||
name := "test-api-wait"
|
||||
|
||||
sleepCmd := "/bin/sleep"
|
||||
|
@ -1008,7 +1008,7 @@ func (s *DockerSuite) TestContainerAPIWait(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICopyNotExistsAnyMore(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICopyNotExistsAnyMore(c *testing.T) {
|
||||
name := "test-container-api-copy"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
|
||||
|
||||
|
@ -1021,7 +1021,7 @@ func (s *DockerSuite) TestContainerAPICopyNotExistsAnyMore(c *testing.T) {
|
|||
assert.Equal(c, res.StatusCode, http.StatusNotFound)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICopyPre124(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICopyPre124(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
|
||||
name := "test-container-api-copy"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
|
||||
|
@ -1051,7 +1051,7 @@ func (s *DockerSuite) TestContainerAPICopyPre124(c *testing.T) {
|
|||
assert.Assert(c, found)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
|
||||
name := "test-container-api-copy-resource-empty"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
|
||||
|
@ -1073,7 +1073,7 @@ func (s *DockerSuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.T)
|
|||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICopyResourcePathNotFoundPre124(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICopyResourcePathNotFoundPre124(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
|
||||
name := "test-container-api-copy-resource-not-found"
|
||||
dockerCmd(c, "run", "--name", name, "busybox")
|
||||
|
@ -1095,7 +1095,7 @@ func (s *DockerSuite) TestContainerAPICopyResourcePathNotFoundPre124(c *testing.
|
|||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICopyContainerNotFoundPr124(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICopyContainerNotFoundPr124(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
|
||||
postData := types.CopyConfig{
|
||||
Resource: "/something",
|
||||
|
@ -1106,7 +1106,7 @@ func (s *DockerSuite) TestContainerAPICopyContainerNotFoundPr124(c *testing.T) {
|
|||
assert.Equal(c, res.StatusCode, http.StatusNotFound)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIDelete(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIDelete(c *testing.T) {
|
||||
out := runSleepingContainer(c)
|
||||
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -1122,7 +1122,7 @@ func (s *DockerSuite) TestContainerAPIDelete(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIDeleteNotExist(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIDeleteNotExist(c *testing.T) {
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
defer cli.Close()
|
||||
|
@ -1131,7 +1131,7 @@ func (s *DockerSuite) TestContainerAPIDeleteNotExist(c *testing.T) {
|
|||
assert.ErrorContains(c, err, "No such container: doesnotexist")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIDeleteForce(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIDeleteForce(c *testing.T) {
|
||||
out := runSleepingContainer(c)
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
|
@ -1148,7 +1148,7 @@ func (s *DockerSuite) TestContainerAPIDeleteForce(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
|
||||
// Windows does not support links
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "--name", "tlink1", "busybox", "top")
|
||||
|
@ -1179,7 +1179,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
|
|||
assert.Equal(c, linksPostRm, "null", "call to api deleteContainer links should have removed the specified links")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIDeleteConflict(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIDeleteConflict(c *testing.T) {
|
||||
out := runSleepingContainer(c)
|
||||
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -1194,7 +1194,7 @@ func (s *DockerSuite) TestContainerAPIDeleteConflict(c *testing.T) {
|
|||
assert.ErrorContains(c, err, expected)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon)
|
||||
|
||||
vol := "/testvolume"
|
||||
|
@ -1229,7 +1229,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) {
|
|||
}
|
||||
|
||||
// Regression test for https://github.com/docker/docker/issues/6231
|
||||
func (s *DockerSuite) TestContainerAPIChunkedEncoding(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIChunkedEncoding(c *testing.T) {
|
||||
|
||||
config := map[string]interface{}{
|
||||
"Image": "busybox",
|
||||
|
@ -1249,7 +1249,7 @@ func (s *DockerSuite) TestContainerAPIChunkedEncoding(c *testing.T) {
|
|||
assert.Equal(c, resp.StatusCode, http.StatusCreated)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIPostContainerStop(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIPostContainerStop(c *testing.T) {
|
||||
out := runSleepingContainer(c)
|
||||
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
@ -1265,7 +1265,7 @@ func (s *DockerSuite) TestContainerAPIPostContainerStop(c *testing.T) {
|
|||
}
|
||||
|
||||
// #14170
|
||||
func (s *DockerSuite) TestPostContainerAPICreateWithStringOrSliceEntrypoint(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestPostContainerAPICreateWithStringOrSliceEntrypoint(c *testing.T) {
|
||||
config := container.Config{
|
||||
Image: "busybox",
|
||||
Entrypoint: []string{"echo"},
|
||||
|
@ -1293,7 +1293,7 @@ func (s *DockerSuite) TestPostContainerAPICreateWithStringOrSliceEntrypoint(c *t
|
|||
}
|
||||
|
||||
// #14170
|
||||
func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestPostContainersCreateWithStringOrSliceCmd(c *testing.T) {
|
||||
config := container.Config{
|
||||
Image: "busybox",
|
||||
Cmd: []string{"echo", "hello", "world"},
|
||||
|
@ -1322,7 +1322,7 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *testing.T)
|
|||
// regression #14318
|
||||
// for backward compatibility testing with and without CAP_ prefix
|
||||
// and with upper and lowercase
|
||||
func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *testing.T) {
|
||||
// Windows doesn't support CapAdd/CapDrop
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := struct {
|
||||
|
@ -1351,7 +1351,7 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *tes
|
|||
}
|
||||
|
||||
// #14915
|
||||
func (s *DockerSuite) TestContainerAPICreateNoHostConfig118(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICreateNoHostConfig118(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // Windows only support 1.25 or later
|
||||
config := container.Config{
|
||||
Image: "busybox",
|
||||
|
@ -1367,7 +1367,7 @@ func (s *DockerSuite) TestContainerAPICreateNoHostConfig118(c *testing.T) {
|
|||
// Ensure an error occurs when you have a container read-only rootfs but you
|
||||
// extract an archive to a symlink in a writable volume which points to a
|
||||
// directory outside of the volume.
|
||||
func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(c *testing.T) {
|
||||
// Windows does not support read-only rootfs
|
||||
// Requires local volume mount bind.
|
||||
// --read-only + userns has remount issues
|
||||
|
@ -1393,7 +1393,7 @@ func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(
|
|||
assert.ErrorContains(c, err, "container rootfs is marked read-only")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestPostContainersCreateWithWrongCpusetValues(c *testing.T) {
|
||||
// Not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -1426,7 +1426,7 @@ func (s *DockerSuite) TestPostContainersCreateWithWrongCpusetValues(c *testing.T
|
|||
assert.ErrorContains(c, err, expected)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestPostContainersCreateShmSizeNegative(c *testing.T) {
|
||||
// ShmSize is not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := container.Config{
|
||||
|
@ -1444,7 +1444,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *testing.T) {
|
|||
assert.ErrorContains(c, err, "SHM size can not be less than 0")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *testing.T) {
|
||||
// ShmSize is not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -1472,7 +1472,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *testin
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestPostContainersCreateShmSizeOmitted(c *testing.T) {
|
||||
// ShmSize is not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := container.Config{
|
||||
|
@ -1499,7 +1499,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestPostContainersCreateWithShmSize(c *testing.T) {
|
||||
// ShmSize is not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := container.Config{
|
||||
|
@ -1530,7 +1530,7 @@ func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(c *testing.T) {
|
||||
// Swappiness is not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
config := container.Config{
|
||||
|
@ -1555,7 +1555,7 @@ func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(
|
|||
}
|
||||
|
||||
// check validation is done daemon side and not only in cli
|
||||
func (s *DockerSuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *testing.T) {
|
||||
// OomScoreAdj is not supported on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -1589,7 +1589,7 @@ func (s *DockerSuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *tes
|
|||
}
|
||||
|
||||
// test case for #22210 where an empty container name caused panic.
|
||||
func (s *DockerSuite) TestContainerAPIDeleteWithEmptyName(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIDeleteWithEmptyName(c *testing.T) {
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
defer cli.Close()
|
||||
|
@ -1598,7 +1598,7 @@ func (s *DockerSuite) TestContainerAPIDeleteWithEmptyName(c *testing.T) {
|
|||
assert.Check(c, errdefs.IsNotFound(err))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T) {
|
||||
// Problematic on Windows as Windows does not support stats
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -1647,7 +1647,7 @@ func (s *DockerSuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainersAPICreateMountsValidation(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainersAPICreateMountsValidation(c *testing.T) {
|
||||
type testCase struct {
|
||||
config container.Config
|
||||
hostConfig container.HostConfig
|
||||
|
@ -1940,7 +1940,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsValidation(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerAPICreateMountsBindRead(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerAPICreateMountsBindRead(c *testing.T) {
|
||||
testRequires(c, NotUserNamespace, testEnv.IsLocalDaemon)
|
||||
// also with data in the host side
|
||||
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
||||
|
@ -1971,7 +1971,7 @@ func (s *DockerSuite) TestContainerAPICreateMountsBindRead(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test Mounts comes out as expected for the MountPoint
|
||||
func (s *DockerSuite) TestContainersAPICreateMountsCreate(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainersAPICreateMountsCreate(c *testing.T) {
|
||||
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
||||
destPath := prefix + slash + "foo"
|
||||
|
||||
|
@ -2180,7 +2180,7 @@ func containerExit(apiclient client.APIClient, name string) func(poll.LogT) poll
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainersAPICreateMountsTmpfs(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainersAPICreateMountsTmpfs(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
type testCase struct {
|
||||
cfg mount.Mount
|
||||
|
@ -2230,7 +2230,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsTmpfs(c *testing.T) {
|
|||
// Regression test for #33334
|
||||
// Makes sure that when a container which has a custom stop signal + restart=always
|
||||
// gets killed (with SIGKILL) by the kill API, that the restart policy is cancelled.
|
||||
func (s *DockerSuite) TestContainerKillCustomStopSignal(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainerKillCustomStopSignal(c *testing.T) {
|
||||
id := strings.TrimSpace(runSleepingContainer(c, "--stop-signal=SIGTERM", "--restart=always"))
|
||||
res, _, err := request.Post("/containers/" + id + "/kill")
|
||||
assert.NilError(c, err)
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestContainersAPICreateMountsBindNamedPipe(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestContainersAPICreateMountsBindNamedPipe(c *testing.T) {
|
||||
// Create a host pipe to map into the container
|
||||
hostPipeName := fmt.Sprintf(`\\.\pipe\docker-cli-test-pipe-%x`, rand.Uint64())
|
||||
pc := &winio.PipeConfig{
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestExecResizeAPIHeightWidthNoInt(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestExecResizeAPIHeightWidthNoInt(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
@ -32,7 +32,7 @@ func (s *DockerSuite) TestExecResizeAPIHeightWidthNoInt(c *testing.T) {
|
|||
}
|
||||
|
||||
// Part of #14845
|
||||
func (s *DockerSuite) TestExecResizeImmediatelyAfterExecStart(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestExecResizeImmediatelyAfterExecStart(c *testing.T) {
|
||||
name := "exec_resize_test"
|
||||
dockerCmd(c, "run", "-d", "-i", "-t", "--name", name, "--restart", "always", "busybox", "/bin/sh")
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
)
|
||||
|
||||
// Regression test for #9414
|
||||
func (s *DockerSuite) TestExecAPICreateNoCmd(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestExecAPICreateNoCmd(c *testing.T) {
|
||||
name := "exec_test"
|
||||
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
|
||||
|
@ -39,7 +39,7 @@ func (s *DockerSuite) TestExecAPICreateNoCmd(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(getErrorMessage(c, b), "No exec command specified"), "Expected message when creating exec command with no Cmd specified")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecAPICreateNoValidContentType(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestExecAPICreateNoValidContentType(c *testing.T) {
|
||||
name := "exec_test"
|
||||
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
|
||||
|
@ -60,7 +60,7 @@ func (s *DockerSuite) TestExecAPICreateNoValidContentType(c *testing.T) {
|
|||
assert.Assert(c, is.Contains(getErrorMessage(c, b), "unsupported Content-Type header (test/plain): must be 'application/json'"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecAPICreateContainerPaused(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestExecAPICreateContainerPaused(c *testing.T) {
|
||||
// Not relevant on Windows as Windows containers cannot be paused
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "exec_create_test"
|
||||
|
@ -79,7 +79,7 @@ func (s *DockerSuite) TestExecAPICreateContainerPaused(c *testing.T) {
|
|||
assert.ErrorContains(c, err, "Container "+name+" is paused, unpause the container before exec", "Expected message when creating exec command with Container %s is paused", name)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecAPIStart(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestExecAPIStart(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // Uses pause/unpause but bits may be salvageable to Windows to Windows CI
|
||||
dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
|
||||
|
||||
|
@ -106,7 +106,7 @@ func (s *DockerSuite) TestExecAPIStart(c *testing.T) {
|
|||
startExec(c, id, http.StatusOK)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecAPIStartEnsureHeaders(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestExecAPIStartEnsureHeaders(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
|
||||
|
||||
|
@ -116,7 +116,7 @@ func (s *DockerSuite) TestExecAPIStartEnsureHeaders(c *testing.T) {
|
|||
assert.Assert(c, resp.Header.Get("Server") != "")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecAPIStartBackwardsCompatible(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestExecAPIStartBackwardsCompatible(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
|
||||
runSleepingContainer(c, "-d", "--name", "test")
|
||||
id := createExec(c, "test")
|
||||
|
@ -131,7 +131,7 @@ func (s *DockerSuite) TestExecAPIStartBackwardsCompatible(c *testing.T) {
|
|||
}
|
||||
|
||||
// #19362
|
||||
func (s *DockerSuite) TestExecAPIStartMultipleTimesError(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestExecAPIStartMultipleTimesError(c *testing.T) {
|
||||
runSleepingContainer(c, "-d", "--name", "test")
|
||||
execID := createExec(c, "test")
|
||||
startExec(c, execID, http.StatusOK)
|
||||
|
@ -141,7 +141,7 @@ func (s *DockerSuite) TestExecAPIStartMultipleTimesError(c *testing.T) {
|
|||
}
|
||||
|
||||
// #20638
|
||||
func (s *DockerSuite) TestExecAPIStartWithDetach(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestExecAPIStartWithDetach(c *testing.T) {
|
||||
name := "foo"
|
||||
runSleepingContainer(c, "-d", "-t", "--name", name)
|
||||
|
||||
|
@ -172,7 +172,7 @@ func (s *DockerSuite) TestExecAPIStartWithDetach(c *testing.T) {
|
|||
}
|
||||
|
||||
// #30311
|
||||
func (s *DockerSuite) TestExecAPIStartValidCommand(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestExecAPIStartValidCommand(c *testing.T) {
|
||||
name := "exec_test"
|
||||
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
|
||||
|
@ -188,7 +188,7 @@ func (s *DockerSuite) TestExecAPIStartValidCommand(c *testing.T) {
|
|||
}
|
||||
|
||||
// #30311
|
||||
func (s *DockerSuite) TestExecAPIStartInvalidCommand(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestExecAPIStartInvalidCommand(c *testing.T) {
|
||||
name := "exec_test"
|
||||
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
|
||||
|
@ -206,7 +206,7 @@ func (s *DockerSuite) TestExecAPIStartInvalidCommand(c *testing.T) {
|
|||
assert.Assert(c, inspectJSON.ExecIDs == nil)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecStateCleanup(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestExecStateCleanup(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
|
||||
// This test checks accidental regressions. Not part of stable API.
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestAPIImagesFilter(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIImagesFilter(c *testing.T) {
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
defer cli.Close()
|
||||
|
@ -54,7 +54,7 @@ func (s *DockerSuite) TestAPIImagesFilter(c *testing.T) {
|
|||
assert.Equal(c, len(images[0].RepoTags), 1)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIImagesSaveAndLoad(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIImagesSaveAndLoad(c *testing.T) {
|
||||
testRequires(c, Network)
|
||||
buildImageSuccessfully(c, "saveandload", build.WithDockerfile("FROM busybox\nENV FOO bar"))
|
||||
id := getIDByName(c, "saveandload")
|
||||
|
@ -75,7 +75,7 @@ func (s *DockerSuite) TestAPIImagesSaveAndLoad(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(inspectOut), id, "load did not work properly")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIImagesDelete(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIImagesDelete(c *testing.T) {
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
defer cli.Close()
|
||||
|
@ -99,7 +99,7 @@ func (s *DockerSuite) TestAPIImagesDelete(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIImagesHistory(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIImagesHistory(c *testing.T) {
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
defer cli.Close()
|
||||
|
@ -125,7 +125,7 @@ func (s *DockerSuite) TestAPIImagesHistory(c *testing.T) {
|
|||
assert.Assert(c, found)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIImagesImportBadSrc(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIImagesImportBadSrc(c *testing.T) {
|
||||
testRequires(c, Network, testEnv.IsLocalDaemon)
|
||||
|
||||
server := httptest.NewServer(http.NewServeMux())
|
||||
|
@ -151,7 +151,7 @@ func (s *DockerSuite) TestAPIImagesImportBadSrc(c *testing.T) {
|
|||
}
|
||||
|
||||
// #14846
|
||||
func (s *DockerSuite) TestAPIImagesSearchJSONContentType(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIImagesSearchJSONContentType(c *testing.T) {
|
||||
testRequires(c, Network)
|
||||
|
||||
res, b, err := request.Get("/images/search?term=test", request.JSON)
|
||||
|
@ -163,7 +163,7 @@ func (s *DockerSuite) TestAPIImagesSearchJSONContentType(c *testing.T) {
|
|||
|
||||
// Test case for 30027: image size reported as -1 in v1.12 client against v1.13 daemon.
|
||||
// This test checks to make sure both v1.12 and v1.13 client against v1.13 daemon get correct `Size` after the fix.
|
||||
func (s *DockerSuite) TestAPIImagesSizeCompatibility(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIImagesSizeCompatibility(c *testing.T) {
|
||||
apiclient := testEnv.APIClient()
|
||||
defer apiclient.Close()
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestInspectAPIContainerResponse(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestInspectAPIContainerResponse(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
||||
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
@ -57,7 +57,7 @@ func (s *DockerSuite) TestInspectAPIContainerResponse(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectAPIContainerVolumeDriverLegacy(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestInspectAPIContainerVolumeDriverLegacy(c *testing.T) {
|
||||
// No legacy implications for Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
||||
|
@ -80,7 +80,7 @@ func (s *DockerSuite) TestInspectAPIContainerVolumeDriverLegacy(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectAPIContainerVolumeDriver(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestInspectAPIContainerVolumeDriver(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "--volume-driver", "local", "busybox", "true")
|
||||
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
@ -104,7 +104,7 @@ func (s *DockerSuite) TestInspectAPIContainerVolumeDriver(c *testing.T) {
|
|||
assert.Assert(c, ok, "API version 1.25 expected to include VolumeDriver in 'HostConfig'")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectAPIImageResponse(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestInspectAPIImageResponse(c *testing.T) {
|
||||
dockerCmd(c, "tag", "busybox:latest", "busybox:mytag")
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -119,7 +119,7 @@ func (s *DockerSuite) TestInspectAPIImageResponse(c *testing.T) {
|
|||
}
|
||||
|
||||
// #17131, #17139, #17173
|
||||
func (s *DockerSuite) TestInspectAPIEmptyFieldsInConfigPre121(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestInspectAPIEmptyFieldsInConfigPre121(c *testing.T) {
|
||||
// Not relevant on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
||||
|
@ -143,7 +143,7 @@ func (s *DockerSuite) TestInspectAPIEmptyFieldsInConfigPre121(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectAPIBridgeNetworkSettings120(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestInspectAPIBridgeNetworkSettings120(c *testing.T) {
|
||||
// Not relevant on Windows, and besides it doesn't have any bridge network settings
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
|
@ -160,7 +160,7 @@ func (s *DockerSuite) TestInspectAPIBridgeNetworkSettings120(c *testing.T) {
|
|||
assert.Assert(c, len(settings.IPAddress) != 0)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectAPIBridgeNetworkSettings121(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestInspectAPIBridgeNetworkSettings121(c *testing.T) {
|
||||
// Windows doesn't have any bridge network settings
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestLogsAPIWithStdout(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestLogsAPIWithStdout(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "-t", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 1; done")
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
|
@ -55,7 +55,7 @@ func (s *DockerSuite) TestLogsAPIWithStdout(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsAPINoStdoutNorStderr(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestLogsAPINoStdoutNorStderr(c *testing.T) {
|
||||
name := "logs_test"
|
||||
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
|
@ -67,7 +67,7 @@ func (s *DockerSuite) TestLogsAPINoStdoutNorStderr(c *testing.T) {
|
|||
}
|
||||
|
||||
// Regression test for #12704
|
||||
func (s *DockerSuite) TestLogsAPIFollowEmptyOutput(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestLogsAPIFollowEmptyOutput(c *testing.T) {
|
||||
name := "logs_test"
|
||||
t0 := time.Now()
|
||||
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "sleep", "10")
|
||||
|
@ -82,14 +82,14 @@ func (s *DockerSuite) TestLogsAPIFollowEmptyOutput(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsAPIContainerNotFound(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestLogsAPIContainerNotFound(c *testing.T) {
|
||||
name := "nonExistentContainer"
|
||||
resp, _, err := request.Get(fmt.Sprintf("/containers/%s/logs?follow=1&stdout=1&stderr=1&tail=all", name))
|
||||
assert.NilError(c, err)
|
||||
assert.Equal(c, resp.StatusCode, http.StatusNotFound)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsAPIUntilFutureFollow(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestLogsAPIUntilFutureFollow(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "logsuntilfuturefollow"
|
||||
dockerCmd(c, "run", "-d", "--name", name, "busybox", "/bin/sh", "-c", "while true; do date +%s; sleep 1; done")
|
||||
|
@ -157,7 +157,7 @@ func (s *DockerSuite) TestLogsAPIUntilFutureFollow(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsAPIUntil(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestLogsAPIUntil(c *testing.T) {
|
||||
testRequires(c, MinimumAPIVersion("1.34"))
|
||||
name := "logsuntil"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do echo log$i; sleep 1; done")
|
||||
|
@ -195,7 +195,7 @@ func (s *DockerSuite) TestLogsAPIUntil(c *testing.T) {
|
|||
assert.Assert(c, !strings.Contains(logsString, "log3"), "unexpected log message returned, until=%v", until)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsAPIUntilDefaultValue(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestLogsAPIUntilDefaultValue(c *testing.T) {
|
||||
name := "logsuntildefaultval"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do echo log$i; done")
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestAPINetworkGetDefaults(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPINetworkGetDefaults(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
// By default docker daemon creates 3 networks. check if they are present
|
||||
defaults := []string{"bridge", "host", "none"}
|
||||
|
@ -26,7 +26,7 @@ func (s *DockerSuite) TestAPINetworkGetDefaults(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPINetworkCreateCheckDuplicate(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPINetworkCreateCheckDuplicate(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "testcheckduplicate"
|
||||
configOnCheck := types.NetworkCreateRequest{
|
||||
|
@ -64,13 +64,13 @@ func (s *DockerSuite) TestAPINetworkCreateCheckDuplicate(c *testing.T) {
|
|||
createNetwork(c, configNotCheck, http.StatusCreated)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPINetworkFilter(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPINetworkFilter(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
nr := getNetworkResource(c, getNetworkIDByName(c, "bridge"))
|
||||
assert.Equal(c, nr.Name, "bridge")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPINetworkInspectBridge(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPINetworkInspectBridge(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
// Inspect default bridge network
|
||||
nr := getNetworkResource(c, "bridge")
|
||||
|
@ -96,7 +96,7 @@ func (s *DockerSuite) TestAPINetworkInspectBridge(c *testing.T) {
|
|||
assert.Equal(c, ip.String(), containerIP)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPINetworkInspectUserDefinedNetwork(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPINetworkInspectUserDefinedNetwork(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
// IPAM configuration inspect
|
||||
ipam := &network.IPAM{
|
||||
|
@ -127,7 +127,7 @@ func (s *DockerSuite) TestAPINetworkInspectUserDefinedNetwork(c *testing.T) {
|
|||
assert.Assert(c, !isNetworkAvailable(c, "br0"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPINetworkConnectDisconnect(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPINetworkConnectDisconnect(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
// Create test network
|
||||
name := "testnetwork"
|
||||
|
@ -169,7 +169,7 @@ func (s *DockerSuite) TestAPINetworkConnectDisconnect(c *testing.T) {
|
|||
deleteNetwork(c, nr.ID, true)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPINetworkIPAMMultipleBridgeNetworks(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPINetworkIPAMMultipleBridgeNetworks(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
// test0 bridge network
|
||||
ipam0 := &network.IPAM{
|
||||
|
@ -238,7 +238,7 @@ func (s *DockerSuite) TestAPINetworkIPAMMultipleBridgeNetworks(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPICreateDeletePredefinedNetworks(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPICreateDeletePredefinedNetworks(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, SwarmInactive)
|
||||
createDeletePredefinedNetwork(c, "bridge")
|
||||
createDeletePredefinedNetwork(c, "none")
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
|
||||
var expectedNetworkInterfaceStats = strings.Split("rx_bytes rx_dropped rx_errors rx_packets tx_bytes tx_dropped tx_errors tx_packets", " ")
|
||||
|
||||
func (s *DockerSuite) TestAPIStatsNoStreamGetCpu(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIStatsNoStreamGetCpu(c *testing.T) {
|
||||
skip.If(c, RuntimeIsWindowsContainerd(), "FIXME: Broken on Windows + containerd combination")
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true;usleep 100; do echo 'Hello'; done")
|
||||
|
||||
|
@ -64,7 +64,7 @@ func (s *DockerSuite) TestAPIStatsNoStreamGetCpu(c *testing.T) {
|
|||
assert.Assert(c, cpuPercent != 0.0, "docker stats with no-stream get cpu usage failed: was %v", cpuPercent)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIStatsStoppedContainerInGoroutines(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIStatsStoppedContainerInGoroutines(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo 1")
|
||||
id := strings.TrimSpace(out)
|
||||
|
||||
|
@ -99,7 +99,7 @@ func (s *DockerSuite) TestAPIStatsStoppedContainerInGoroutines(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIStatsNetworkStats(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIStatsNetworkStats(c *testing.T) {
|
||||
skip.If(c, RuntimeIsWindowsContainerd(), "FIXME: Broken on Windows + containerd combination")
|
||||
testRequires(c, testEnv.IsLocalDaemon)
|
||||
|
||||
|
@ -165,7 +165,7 @@ func (s *DockerSuite) TestAPIStatsNetworkStats(c *testing.T) {
|
|||
assert.Assert(c, postRxPackets >= expRxPkts, "Reported less RxPackets than expected. Expected >= %d. Found %d. %s", expRxPkts, postRxPackets, pingouts)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIStatsNetworkStatsVersioning(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIStatsNetworkStatsVersioning(c *testing.T) {
|
||||
// Windows doesn't support API versions less than 1.25, so no point testing 1.17 .. 1.21
|
||||
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
|
||||
|
||||
|
@ -260,7 +260,7 @@ func jsonBlobHasGTE121NetworkStats(blob map[string]interface{}) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIStatsContainerNotFound(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIStatsContainerNotFound(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -274,7 +274,7 @@ func (s *DockerSuite) TestAPIStatsContainerNotFound(c *testing.T) {
|
|||
assert.ErrorContains(c, err, expected)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIStatsNoStreamConnectedContainers(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIStatsNoStreamConnectedContainers(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
out1 := runSleepingContainer(c)
|
||||
|
|
|
@ -15,13 +15,25 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestAPIOptionsRoute(c *testing.T) {
|
||||
type DockerAPISuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerAPISuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerAPISuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerAPISuite) TestAPIOptionsRoute(c *testing.T) {
|
||||
resp, _, err := request.Do("/", request.Method(http.MethodOptions))
|
||||
assert.NilError(c, err)
|
||||
assert.Equal(c, resp.StatusCode, http.StatusOK)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIGetEnabledCORS(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIGetEnabledCORS(c *testing.T) {
|
||||
res, body, err := request.Get("/version")
|
||||
assert.NilError(c, err)
|
||||
assert.Equal(c, res.StatusCode, http.StatusOK)
|
||||
|
@ -33,7 +45,7 @@ func (s *DockerSuite) TestAPIGetEnabledCORS(c *testing.T) {
|
|||
//assert.Equal(c, res.Header.Get("Access-Control-Allow-Headers"), "Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIClientVersionOldNotSupported(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIClientVersionOldNotSupported(c *testing.T) {
|
||||
if testEnv.OSType != runtime.GOOS {
|
||||
c.Skip("Daemon platform doesn't match test platform")
|
||||
}
|
||||
|
@ -57,7 +69,7 @@ func (s *DockerSuite) TestAPIClientVersionOldNotSupported(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(string(content)), expected)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIErrorJSON(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIErrorJSON(c *testing.T) {
|
||||
httpResp, body, err := request.Post("/containers/create", request.JSONBody(struct{}{}))
|
||||
assert.NilError(c, err)
|
||||
if versions.LessThan(testEnv.DaemonAPIVersion(), "1.32") {
|
||||
|
@ -71,7 +83,7 @@ func (s *DockerSuite) TestAPIErrorJSON(c *testing.T) {
|
|||
assert.Equal(c, getErrorMessage(c, b), "Config cannot be empty in order to create a container")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIErrorPlainText(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIErrorPlainText(c *testing.T) {
|
||||
// Windows requires API 1.25 or later. This test is validating a behaviour which was present
|
||||
// in v1.23, but changed in 1.24, hence not applicable on Windows. See apiVersionSupportsJSONErrors
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
@ -88,7 +100,7 @@ func (s *DockerSuite) TestAPIErrorPlainText(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(string(b)), "Config cannot be empty in order to create a container")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIErrorNotFoundJSON(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIErrorNotFoundJSON(c *testing.T) {
|
||||
// 404 is a different code path to normal errors, so test separately
|
||||
httpResp, body, err := request.Get("/notfound", request.JSON)
|
||||
assert.NilError(c, err)
|
||||
|
@ -99,7 +111,7 @@ func (s *DockerSuite) TestAPIErrorNotFoundJSON(c *testing.T) {
|
|||
assert.Equal(c, getErrorMessage(c, b), "page not found")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAPIErrorNotFoundPlainText(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestAPIErrorNotFoundPlainText(c *testing.T) {
|
||||
httpResp, body, err := request.Get("/v1.23/notfound", request.JSON)
|
||||
assert.NilError(c, err)
|
||||
assert.Equal(c, httpResp.StatusCode, http.StatusNotFound)
|
||||
|
|
|
@ -18,7 +18,19 @@ import (
|
|||
|
||||
const attachWait = 5 * time.Second
|
||||
|
||||
func (s *DockerSuite) TestAttachMultipleAndRestart(c *testing.T) {
|
||||
type DockerCLIAttachSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIAttachSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIAttachSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIAttachSuite) TestAttachMultipleAndRestart(c *testing.T) {
|
||||
endGroup := &sync.WaitGroup{}
|
||||
startGroup := &sync.WaitGroup{}
|
||||
endGroup.Add(3)
|
||||
|
@ -88,7 +100,7 @@ func (s *DockerSuite) TestAttachMultipleAndRestart(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAttachTTYWithoutStdin(c *testing.T) {
|
||||
func (s *DockerCLIAttachSuite) TestAttachTTYWithoutStdin(c *testing.T) {
|
||||
// TODO: Figure out how to get this running again reliable on Windows.
|
||||
// It works by accident at the moment. Sometimes. I've gone back to v1.13.0 and see the same.
|
||||
// On Windows, docker run -d -ti busybox causes the container to exit immediately.
|
||||
|
@ -133,7 +145,7 @@ func (s *DockerSuite) TestAttachTTYWithoutStdin(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAttachDisconnect(c *testing.T) {
|
||||
func (s *DockerCLIAttachSuite) TestAttachDisconnect(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-di", "busybox", "/bin/cat")
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -166,7 +178,7 @@ func (s *DockerSuite) TestAttachDisconnect(c *testing.T) {
|
|||
assert.Equal(c, running, "true")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAttachPausedContainer(c *testing.T) {
|
||||
func (s *DockerCLIAttachSuite) TestAttachPausedContainer(c *testing.T) {
|
||||
testRequires(c, IsPausable)
|
||||
runSleepingContainer(c, "-d", "--name=test")
|
||||
dockerCmd(c, "pause", "test")
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
// #9860 Make sure attach ends when container ends (with no errors)
|
||||
func (s *DockerSuite) TestAttachClosedOnContainerStop(c *testing.T) {
|
||||
func (s *DockerCLIAttachSuite) TestAttachClosedOnContainerStop(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon)
|
||||
|
||||
out, _ := dockerCmd(c, "run", "-dti", "busybox", "/bin/sh", "-c", `trap 'exit 0' SIGTERM; while true; do sleep 1; done`)
|
||||
|
@ -59,7 +59,7 @@ func (s *DockerSuite) TestAttachClosedOnContainerStop(c *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestAttachAfterDetach(c *testing.T) {
|
||||
func (s *DockerCLIAttachSuite) TestAttachAfterDetach(c *testing.T) {
|
||||
name := "detachtest"
|
||||
|
||||
cpty, tty, err := pty.Open()
|
||||
|
@ -124,7 +124,7 @@ func (s *DockerSuite) TestAttachAfterDetach(c *testing.T) {
|
|||
}
|
||||
|
||||
// TestAttachDetach checks that attach in tty mode can be detached using the long container ID
|
||||
func (s *DockerSuite) TestAttachDetach(c *testing.T) {
|
||||
func (s *DockerCLIAttachSuite) TestAttachDetach(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-itd", "busybox", "cat")
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -24,10 +24,10 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *testing.T) {
|
||||
func (s *DockerCLIBuildSuite) TestBuildResourceConstraintsAreUsed(c *testing.T) {
|
||||
testRequires(c, cpuCfsQuota)
|
||||
name := "testbuildresourceconstraints"
|
||||
buildLabel := "DockerSuite.TestBuildResourceConstraintsAreUsed"
|
||||
buildLabel := "DockerCLIBuildSuite.TestBuildResourceConstraintsAreUsed"
|
||||
|
||||
ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(`
|
||||
FROM hello-world:frozen
|
||||
|
@ -84,7 +84,7 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *testing.T) {
|
|||
assert.Assert(c, c2.Ulimits == nil, "resource leaked from build for Ulimits")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildAddChangeOwnership(c *testing.T) {
|
||||
func (s *DockerCLIBuildSuite) TestBuildAddChangeOwnership(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "testbuildaddown"
|
||||
|
||||
|
@ -130,7 +130,7 @@ func (s *DockerSuite) TestBuildAddChangeOwnership(c *testing.T) {
|
|||
// TODO(buildkit): this test needs to be rewritten for buildkit.
|
||||
// It has been manually tested positive. Confirmed issue: docker build output parsing.
|
||||
// Potential issue: newEventObserver uses docker events, which is not hooked up to buildkit.
|
||||
func (s *DockerSuite) TestBuildCancellationKillsSleep(c *testing.T) {
|
||||
func (s *DockerCLIBuildSuite) TestBuildCancellationKillsSleep(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, TODOBuildkit)
|
||||
name := "testbuildcancellation"
|
||||
|
||||
|
|
|
@ -10,7 +10,19 @@ import (
|
|||
"gotest.tools/v3/skip"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestCommitAfterContainerIsDone(c *testing.T) {
|
||||
type DockerCLICommitSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLICommitSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLICommitSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLICommitSuite) TestCommitAfterContainerIsDone(c *testing.T) {
|
||||
skip.If(c, RuntimeIsWindowsContainerd(), "FIXME: Broken on Windows + containerd combination")
|
||||
out := cli.DockerCmd(c, "run", "-i", "-a", "stdin", "busybox", "echo", "foo").Combined()
|
||||
|
||||
|
@ -25,7 +37,7 @@ func (s *DockerSuite) TestCommitAfterContainerIsDone(c *testing.T) {
|
|||
cli.DockerCmd(c, "inspect", cleanedImageID)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCommitWithoutPause(c *testing.T) {
|
||||
func (s *DockerCLICommitSuite) TestCommitWithoutPause(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-i", "-a", "stdin", "busybox", "echo", "foo")
|
||||
|
||||
|
@ -41,7 +53,7 @@ func (s *DockerSuite) TestCommitWithoutPause(c *testing.T) {
|
|||
}
|
||||
|
||||
// TestCommitPausedContainer tests that a paused container is not unpaused after being committed
|
||||
func (s *DockerSuite) TestCommitPausedContainer(c *testing.T) {
|
||||
func (s *DockerCLICommitSuite) TestCommitPausedContainer(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-i", "-d", "busybox")
|
||||
|
||||
|
@ -55,7 +67,7 @@ func (s *DockerSuite) TestCommitPausedContainer(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "true"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCommitNewFile(c *testing.T) {
|
||||
func (s *DockerCLICommitSuite) TestCommitNewFile(c *testing.T) {
|
||||
dockerCmd(c, "run", "--name", "committer", "busybox", "/bin/sh", "-c", "echo koye > /foo")
|
||||
|
||||
imageID, _ := dockerCmd(c, "commit", "committer")
|
||||
|
@ -66,7 +78,7 @@ func (s *DockerSuite) TestCommitNewFile(c *testing.T) {
|
|||
assert.Equal(c, actual, "koye")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCommitHardlink(c *testing.T) {
|
||||
func (s *DockerCLICommitSuite) TestCommitHardlink(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
firstOutput, _ := dockerCmd(c, "run", "-t", "--name", "hardlinks", "busybox", "sh", "-c", "touch file1 && ln file1 file2 && ls -di file1 file2")
|
||||
|
||||
|
@ -85,7 +97,7 @@ func (s *DockerSuite) TestCommitHardlink(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(chunks[1], chunks[0]), "Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:])
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCommitTTY(c *testing.T) {
|
||||
func (s *DockerCLICommitSuite) TestCommitTTY(c *testing.T) {
|
||||
dockerCmd(c, "run", "-t", "--name", "tty", "busybox", "/bin/ls")
|
||||
|
||||
imageID, _ := dockerCmd(c, "commit", "tty", "ttytest")
|
||||
|
@ -94,7 +106,7 @@ func (s *DockerSuite) TestCommitTTY(c *testing.T) {
|
|||
dockerCmd(c, "run", imageID, "/bin/ls")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCommitWithHostBindMount(c *testing.T) {
|
||||
func (s *DockerCLICommitSuite) TestCommitWithHostBindMount(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "--name", "bind-commit", "-v", "/dev/null:/winning", "busybox", "true")
|
||||
|
||||
|
@ -104,7 +116,7 @@ func (s *DockerSuite) TestCommitWithHostBindMount(c *testing.T) {
|
|||
dockerCmd(c, "run", imageID, "true")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCommitChange(c *testing.T) {
|
||||
func (s *DockerCLICommitSuite) TestCommitChange(c *testing.T) {
|
||||
dockerCmd(c, "run", "--name", "test", "busybox", "true")
|
||||
|
||||
imageID, _ := dockerCmd(c, "commit",
|
||||
|
@ -154,7 +166,7 @@ func (s *DockerSuite) TestCommitChange(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCommitChangeLabels(c *testing.T) {
|
||||
func (s *DockerCLICommitSuite) TestCommitChangeLabels(c *testing.T) {
|
||||
dockerCmd(c, "run", "--name", "test", "--label", "some=label", "busybox", "true")
|
||||
|
||||
imageID, _ := dockerCmd(c, "commit",
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
// Check that copying from a container to a local symlink copies to the symlink
|
||||
// target and does not overwrite the local symlink itself.
|
||||
// TODO: move to docker/cli and/or integration/container/copy_test.go
|
||||
func (s *DockerSuite) TestCpFromSymlinkDestination(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpFromSymlinkDestination(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{addContent: true})
|
||||
|
||||
|
@ -96,7 +96,7 @@ func (s *DockerSuite) TestCpFromSymlinkDestination(c *testing.T) {
|
|||
// A. SRC specifies a file and DST (no trailing path separator) doesn't
|
||||
// exist. This should create a file with the name DST and copy the
|
||||
// contents of the source file into it.
|
||||
func (s *DockerSuite) TestCpFromCaseA(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpFromCaseA(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
addContent: true, workDir: "/root",
|
||||
|
@ -115,7 +115,7 @@ func (s *DockerSuite) TestCpFromCaseA(c *testing.T) {
|
|||
// B. SRC specifies a file and DST (with trailing path separator) doesn't
|
||||
// exist. This should cause an error because the copy operation cannot
|
||||
// create a directory when copying a single file.
|
||||
func (s *DockerSuite) TestCpFromCaseB(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpFromCaseB(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{addContent: true})
|
||||
|
||||
|
@ -132,7 +132,7 @@ func (s *DockerSuite) TestCpFromCaseB(c *testing.T) {
|
|||
|
||||
// C. SRC specifies a file and DST exists as a file. This should overwrite
|
||||
// the file at DST with the contents of the source file.
|
||||
func (s *DockerSuite) TestCpFromCaseC(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpFromCaseC(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
addContent: true, workDir: "/root",
|
||||
|
@ -155,7 +155,7 @@ func (s *DockerSuite) TestCpFromCaseC(c *testing.T) {
|
|||
// D. SRC specifies a file and DST exists as a directory. This should place
|
||||
// a copy of the source file inside it using the basename from SRC. Ensure
|
||||
// this works whether DST has a trailing path separator or not.
|
||||
func (s *DockerSuite) TestCpFromCaseD(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpFromCaseD(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{addContent: true})
|
||||
|
||||
|
@ -190,7 +190,7 @@ func (s *DockerSuite) TestCpFromCaseD(c *testing.T) {
|
|||
// directory at DST and copy the contents of the SRC directory into the DST
|
||||
// directory. Ensure this works whether DST has a trailing path separator or
|
||||
// not.
|
||||
func (s *DockerSuite) TestCpFromCaseE(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpFromCaseE(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{addContent: true})
|
||||
|
||||
|
@ -216,7 +216,7 @@ func (s *DockerSuite) TestCpFromCaseE(c *testing.T) {
|
|||
|
||||
// F. SRC specifies a directory and DST exists as a file. This should cause an
|
||||
// error as it is not possible to overwrite a file with a directory.
|
||||
func (s *DockerSuite) TestCpFromCaseF(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpFromCaseF(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
addContent: true, workDir: "/root",
|
||||
|
@ -238,7 +238,7 @@ func (s *DockerSuite) TestCpFromCaseF(c *testing.T) {
|
|||
// G. SRC specifies a directory and DST exists as a directory. This should copy
|
||||
// the SRC directory and all its contents to the DST directory. Ensure this
|
||||
// works whether DST has a trailing path separator or not.
|
||||
func (s *DockerSuite) TestCpFromCaseG(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpFromCaseG(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
addContent: true, workDir: "/root",
|
||||
|
@ -272,7 +272,7 @@ func (s *DockerSuite) TestCpFromCaseG(c *testing.T) {
|
|||
// should create a directory at DST and copy the contents of the SRC
|
||||
// directory (but not the directory itself) into the DST directory. Ensure
|
||||
// this works whether DST has a trailing path separator or not.
|
||||
func (s *DockerSuite) TestCpFromCaseH(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpFromCaseH(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{addContent: true})
|
||||
|
||||
|
@ -299,7 +299,7 @@ func (s *DockerSuite) TestCpFromCaseH(c *testing.T) {
|
|||
// I. SRC specifies a directory's contents only and DST exists as a file. This
|
||||
// should cause an error as it is not possible to overwrite a file with a
|
||||
// directory.
|
||||
func (s *DockerSuite) TestCpFromCaseI(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpFromCaseI(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
addContent: true, workDir: "/root",
|
||||
|
@ -322,7 +322,7 @@ func (s *DockerSuite) TestCpFromCaseI(c *testing.T) {
|
|||
// This should copy the contents of the SRC directory (but not the directory
|
||||
// itself) into the DST directory. Ensure this works whether DST has a
|
||||
// trailing path separator or not.
|
||||
func (s *DockerSuite) TestCpFromCaseJ(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpFromCaseJ(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
addContent: true, workDir: "/root",
|
||||
|
|
|
@ -26,15 +26,27 @@ const (
|
|||
cpHostContents = "hello, i am the host"
|
||||
)
|
||||
|
||||
type DockerCLICpSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLICpSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLICpSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
// Ensure that an all-local path case returns an error.
|
||||
func (s *DockerSuite) TestCpLocalOnly(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpLocalOnly(c *testing.T) {
|
||||
err := runDockerCp(c, "foo", "bar")
|
||||
assert.ErrorContains(c, err, "must specify at least one container source")
|
||||
}
|
||||
|
||||
// Test for #5656
|
||||
// Check that garbage paths don't escape the container's rootfs
|
||||
func (s *DockerSuite) TestCpGarbagePath(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpGarbagePath(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath)
|
||||
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
@ -70,7 +82,7 @@ func (s *DockerSuite) TestCpGarbagePath(c *testing.T) {
|
|||
}
|
||||
|
||||
// Check that relative paths are relative to the container's rootfs
|
||||
func (s *DockerSuite) TestCpRelativePath(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpRelativePath(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath)
|
||||
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
@ -112,7 +124,7 @@ func (s *DockerSuite) TestCpRelativePath(c *testing.T) {
|
|||
}
|
||||
|
||||
// Check that absolute paths are relative to the container's rootfs
|
||||
func (s *DockerSuite) TestCpAbsolutePath(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpAbsolutePath(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath)
|
||||
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
@ -149,7 +161,7 @@ func (s *DockerSuite) TestCpAbsolutePath(c *testing.T) {
|
|||
|
||||
// Test for #5619
|
||||
// Check that absolute symlinks are still relative to the container's rootfs
|
||||
func (s *DockerSuite) TestCpAbsoluteSymlink(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpAbsoluteSymlink(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpFullPath+" container_path")
|
||||
|
||||
|
@ -185,7 +197,7 @@ func (s *DockerSuite) TestCpAbsoluteSymlink(c *testing.T) {
|
|||
|
||||
// Check that symlinks to a directory behave as expected when copying one from
|
||||
// a container.
|
||||
func (s *DockerSuite) TestCpFromSymlinkToDirectory(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpFromSymlinkToDirectory(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpTestPathParent+" /dir_link")
|
||||
|
||||
|
@ -231,7 +243,7 @@ func (s *DockerSuite) TestCpFromSymlinkToDirectory(c *testing.T) {
|
|||
|
||||
// Check that symlinks to a directory behave as expected when copying one to a
|
||||
// container.
|
||||
func (s *DockerSuite) TestCpToSymlinkToDirectory(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToSymlinkToDirectory(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, testEnv.IsLocalDaemon) // Requires local volume mount bind.
|
||||
|
||||
|
@ -308,7 +320,7 @@ func (s *DockerSuite) TestCpToSymlinkToDirectory(c *testing.T) {
|
|||
|
||||
// Test for #5619
|
||||
// Check that symlinks which are part of the resource path are still relative to the container's rootfs
|
||||
func (s *DockerSuite) TestCpSymlinkComponent(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpSymlinkComponent(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpTestPath+" container_path")
|
||||
|
||||
|
@ -347,7 +359,7 @@ func (s *DockerSuite) TestCpSymlinkComponent(c *testing.T) {
|
|||
}
|
||||
|
||||
// Check that cp with unprivileged user doesn't return any error
|
||||
func (s *DockerSuite) TestCpUnprivilegedUser(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpUnprivilegedUser(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
testRequires(c, UnixCli) // uses chmod/su: not available on windows
|
||||
|
||||
|
@ -371,7 +383,7 @@ func (s *DockerSuite) TestCpUnprivilegedUser(c *testing.T) {
|
|||
result.Assert(c, icmd.Expected{})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCpSpecialFiles(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpSpecialFiles(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, testEnv.IsLocalDaemon)
|
||||
|
||||
|
@ -411,7 +423,7 @@ func (s *DockerSuite) TestCpSpecialFiles(c *testing.T) {
|
|||
assert.Assert(c, bytes.Equal(actual, expected), "Expected copied file to be duplicate of the container hostname")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCpVolumePath(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpVolumePath(c *testing.T) {
|
||||
// stat /tmp/cp-test-volumepath851508420/test gets permission denied for the user
|
||||
testRequires(c, NotUserNamespace)
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
@ -474,7 +486,7 @@ func (s *DockerSuite) TestCpVolumePath(c *testing.T) {
|
|||
assert.Assert(c, bytes.Equal(fb, fb2), "Expected copied file to be duplicate of bind-mounted file")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCpToDot(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToDot(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test")
|
||||
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
@ -497,7 +509,7 @@ func (s *DockerSuite) TestCpToDot(c *testing.T) {
|
|||
assert.Equal(c, string(content), "lololol\n")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCpToStdout(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToStdout(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test")
|
||||
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
@ -514,7 +526,7 @@ func (s *DockerSuite) TestCpToStdout(c *testing.T) {
|
|||
assert.Check(c, is.Contains(out, "-rw"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCpNameHasColon(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpNameHasColon(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
|
||||
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /te:s:t")
|
||||
|
@ -533,7 +545,7 @@ func (s *DockerSuite) TestCpNameHasColon(c *testing.T) {
|
|||
assert.Equal(c, string(content), "lololol\n")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCopyAndRestart(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCopyAndRestart(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
expectedMsg := "hello"
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", expectedMsg)
|
||||
|
@ -552,7 +564,7 @@ func (s *DockerSuite) TestCopyAndRestart(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), expectedMsg)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCopyCreatedContainer(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCopyCreatedContainer(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "create", "--name", "test_cp", "-v", "/test", "busybox")
|
||||
|
||||
|
@ -565,7 +577,7 @@ func (s *DockerSuite) TestCopyCreatedContainer(c *testing.T) {
|
|||
// test copy with option `-L`: following symbol link
|
||||
// Check that symlinks to a file behave as expected when copying one from
|
||||
// a container to host following symbol link
|
||||
func (s *DockerSuite) TestCpSymlinkFromConToHostFollowSymlink(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpSymlinkFromConToHostFollowSymlink(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpFullPath+" /dir_link")
|
||||
assert.Equal(c, exitCode, 0, "failed to set up container: %s", out)
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
|
||||
// Check that copying from a local path to a symlink in a container copies to
|
||||
// the symlink target and does not overwrite the container symlink itself.
|
||||
func (s *DockerSuite) TestCpToSymlinkDestination(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToSymlinkDestination(c *testing.T) {
|
||||
// stat /tmp/test-cp-to-symlink-destination-262430901/vol3 gets permission denied for the user
|
||||
testRequires(c, NotUserNamespace)
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
@ -100,7 +100,7 @@ func (s *DockerSuite) TestCpToSymlinkDestination(c *testing.T) {
|
|||
// A. SRC specifies a file and DST (no trailing path separator) doesn't
|
||||
// exist. This should create a file with the name DST and copy the
|
||||
// contents of the source file into it.
|
||||
func (s *DockerSuite) TestCpToCaseA(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToCaseA(c *testing.T) {
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
workDir: "/root", command: makeCatFileCommand("itWorks.txt"),
|
||||
})
|
||||
|
@ -120,7 +120,7 @@ func (s *DockerSuite) TestCpToCaseA(c *testing.T) {
|
|||
// B. SRC specifies a file and DST (with trailing path separator) doesn't
|
||||
// exist. This should cause an error because the copy operation cannot
|
||||
// create a directory when copying a single file.
|
||||
func (s *DockerSuite) TestCpToCaseB(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToCaseB(c *testing.T) {
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
command: makeCatFileCommand("testDir/file1"),
|
||||
})
|
||||
|
@ -140,7 +140,7 @@ func (s *DockerSuite) TestCpToCaseB(c *testing.T) {
|
|||
|
||||
// C. SRC specifies a file and DST exists as a file. This should overwrite
|
||||
// the file at DST with the contents of the source file.
|
||||
func (s *DockerSuite) TestCpToCaseC(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToCaseC(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
addContent: true, workDir: "/root",
|
||||
|
@ -164,7 +164,7 @@ func (s *DockerSuite) TestCpToCaseC(c *testing.T) {
|
|||
// D. SRC specifies a file and DST exists as a directory. This should place
|
||||
// a copy of the source file inside it using the basename from SRC. Ensure
|
||||
// this works whether DST has a trailing path separator or not.
|
||||
func (s *DockerSuite) TestCpToCaseD(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToCaseD(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
addContent: true,
|
||||
|
@ -202,7 +202,7 @@ func (s *DockerSuite) TestCpToCaseD(c *testing.T) {
|
|||
// directory at DST and copy the contents of the SRC directory into the DST
|
||||
// directory. Ensure this works whether DST has a trailing path separator or
|
||||
// not.
|
||||
func (s *DockerSuite) TestCpToCaseE(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToCaseE(c *testing.T) {
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
command: makeCatFileCommand("/testDir/file1-1"),
|
||||
})
|
||||
|
@ -233,7 +233,7 @@ func (s *DockerSuite) TestCpToCaseE(c *testing.T) {
|
|||
|
||||
// F. SRC specifies a directory and DST exists as a file. This should cause an
|
||||
// error as it is not possible to overwrite a file with a directory.
|
||||
func (s *DockerSuite) TestCpToCaseF(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToCaseF(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
addContent: true, workDir: "/root",
|
||||
|
@ -255,7 +255,7 @@ func (s *DockerSuite) TestCpToCaseF(c *testing.T) {
|
|||
// G. SRC specifies a directory and DST exists as a directory. This should copy
|
||||
// the SRC directory and all its contents to the DST directory. Ensure this
|
||||
// works whether DST has a trailing path separator or not.
|
||||
func (s *DockerSuite) TestCpToCaseG(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToCaseG(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
addContent: true, workDir: "/root",
|
||||
|
@ -293,7 +293,7 @@ func (s *DockerSuite) TestCpToCaseG(c *testing.T) {
|
|||
// should create a directory at DST and copy the contents of the SRC
|
||||
// directory (but not the directory itself) into the DST directory. Ensure
|
||||
// this works whether DST has a trailing path separator or not.
|
||||
func (s *DockerSuite) TestCpToCaseH(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToCaseH(c *testing.T) {
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
command: makeCatFileCommand("/testDir/file1-1"),
|
||||
})
|
||||
|
@ -325,7 +325,7 @@ func (s *DockerSuite) TestCpToCaseH(c *testing.T) {
|
|||
// I. SRC specifies a directory's contents only and DST exists as a file. This
|
||||
// should cause an error as it is not possible to overwrite a file with a
|
||||
// directory.
|
||||
func (s *DockerSuite) TestCpToCaseI(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToCaseI(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
addContent: true, workDir: "/root",
|
||||
|
@ -348,7 +348,7 @@ func (s *DockerSuite) TestCpToCaseI(c *testing.T) {
|
|||
// This should copy the contents of the SRC directory (but not the directory
|
||||
// itself) into the DST directory. Ensure this works whether DST has a
|
||||
// trailing path separator or not.
|
||||
func (s *DockerSuite) TestCpToCaseJ(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToCaseJ(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
containerID := makeTestContainer(c, testContainerOptions{
|
||||
addContent: true, workDir: "/root",
|
||||
|
@ -383,7 +383,7 @@ func (s *DockerSuite) TestCpToCaseJ(c *testing.T) {
|
|||
|
||||
// The `docker cp` command should also ensure that you cannot
|
||||
// write to a container rootfs that is marked as read-only.
|
||||
func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToErrReadOnlyRootfs(c *testing.T) {
|
||||
// --read-only + userns has remount issues
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
tmpDir := getTestDir(c, "test-cp-to-err-read-only-rootfs")
|
||||
|
@ -408,7 +408,7 @@ func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *testing.T) {
|
|||
|
||||
// The `docker cp` command should also ensure that you
|
||||
// cannot write to a volume that is mounted as read-only.
|
||||
func (s *DockerSuite) TestCpToErrReadOnlyVolume(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToErrReadOnlyVolume(c *testing.T) {
|
||||
// --read-only + userns has remount issues
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
tmpDir := getTestDir(c, "test-cp-to-err-read-only-volume")
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestCpToContainerWithPermissions(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpToContainerWithPermissions(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
|
||||
|
||||
tmpDir := getTestDir(c, "test-cp-to-host-with-permissions")
|
||||
|
@ -43,7 +43,7 @@ func (s *DockerSuite) TestCpToContainerWithPermissions(c *testing.T) {
|
|||
}
|
||||
|
||||
// Check ownership is root, both in non-userns and userns enabled modes
|
||||
func (s *DockerSuite) TestCpCheckDestOwnership(c *testing.T) {
|
||||
func (s *DockerCLICpSuite) TestCpCheckDestOwnership(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
tmpVolDir := getTestDir(c, "test-cp-tmpvol")
|
||||
containerID := makeTestContainer(c,
|
||||
|
|
|
@ -17,8 +17,20 @@ import (
|
|||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
type DockerCLICreateSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLICreateSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLICreateSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
// Make sure we can create a simple container with some args
|
||||
func (s *DockerSuite) TestCreateArgs(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateArgs(c *testing.T) {
|
||||
// Intentionally clear entrypoint, as the Windows busybox image needs an entrypoint, which breaks this test
|
||||
out, _ := dockerCmd(c, "create", "--entrypoint=", "busybox", "command", "arg1", "arg2", "arg with space", "-c", "flags")
|
||||
|
||||
|
@ -53,7 +65,7 @@ func (s *DockerSuite) TestCreateArgs(c *testing.T) {
|
|||
}
|
||||
|
||||
// Make sure we can grow the container's rootfs at creation time.
|
||||
func (s *DockerSuite) TestCreateGrowRootfs(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateGrowRootfs(c *testing.T) {
|
||||
// Windows and Devicemapper support growing the rootfs
|
||||
if testEnv.OSType != "windows" {
|
||||
testRequires(c, Devicemapper)
|
||||
|
@ -67,7 +79,7 @@ func (s *DockerSuite) TestCreateGrowRootfs(c *testing.T) {
|
|||
}
|
||||
|
||||
// Make sure we cannot shrink the container's rootfs at creation time.
|
||||
func (s *DockerSuite) TestCreateShrinkRootfs(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateShrinkRootfs(c *testing.T) {
|
||||
testRequires(c, Devicemapper)
|
||||
|
||||
// Ensure this fails because of the defaultBaseFsSize is 10G
|
||||
|
@ -77,7 +89,7 @@ func (s *DockerSuite) TestCreateShrinkRootfs(c *testing.T) {
|
|||
}
|
||||
|
||||
// Make sure we can set hostconfig options too
|
||||
func (s *DockerSuite) TestCreateHostConfig(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateHostConfig(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "create", "-P", "busybox", "echo")
|
||||
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
@ -99,7 +111,7 @@ func (s *DockerSuite) TestCreateHostConfig(c *testing.T) {
|
|||
assert.Assert(c, cont.HostConfig.PublishAllPorts, "Expected PublishAllPorts, got false")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateWithPortRange(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateWithPortRange(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "create", "-p", "3300-3303:3300-3303/tcp", "busybox", "echo")
|
||||
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
@ -128,7 +140,7 @@ func (s *DockerSuite) TestCreateWithPortRange(c *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateWithLargePortRange(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateWithLargePortRange(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "create", "-p", "1-65535:1-65535/tcp", "busybox", "echo")
|
||||
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
@ -157,7 +169,7 @@ func (s *DockerSuite) TestCreateWithLargePortRange(c *testing.T) {
|
|||
}
|
||||
|
||||
// "test123" should be printed by docker create + start
|
||||
func (s *DockerSuite) TestCreateEchoStdout(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateEchoStdout(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "create", "busybox", "echo", "test123")
|
||||
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
@ -166,7 +178,7 @@ func (s *DockerSuite) TestCreateEchoStdout(c *testing.T) {
|
|||
assert.Equal(c, out, "test123\n", "container should've printed 'test123', got %q", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateVolumesCreated(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateVolumesCreated(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon)
|
||||
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
||||
|
||||
|
@ -185,7 +197,7 @@ func (s *DockerSuite) TestCreateVolumesCreated(c *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateLabels(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateLabels(c *testing.T) {
|
||||
name := "test_create_labels"
|
||||
expected := map[string]string{"k1": "v1", "k2": "v2"}
|
||||
dockerCmd(c, "create", "--name", name, "-l", "k1=v1", "--label", "k2=v2", "busybox")
|
||||
|
@ -198,7 +210,7 @@ func (s *DockerSuite) TestCreateLabels(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateLabelFromImage(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateLabelFromImage(c *testing.T) {
|
||||
imageName := "testcreatebuildlabel"
|
||||
buildImageSuccessfully(c, imageName, build.WithDockerfile(`FROM busybox
|
||||
LABEL k1=v1 k2=v2`))
|
||||
|
@ -215,7 +227,7 @@ func (s *DockerSuite) TestCreateLabelFromImage(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateHostnameWithNumber(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateHostnameWithNumber(c *testing.T) {
|
||||
image := "busybox"
|
||||
// Busybox on Windows does not implement hostname command
|
||||
if testEnv.OSType == "windows" {
|
||||
|
@ -225,7 +237,7 @@ func (s *DockerSuite) TestCreateHostnameWithNumber(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), "web.0", "hostname not set, expected `web.0`, got: %s", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateRM(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateRM(c *testing.T) {
|
||||
// Test to make sure we can 'rm' a new container that is in
|
||||
// "Created" state, and has ever been run. Test "rm -f" too.
|
||||
|
||||
|
@ -242,7 +254,7 @@ func (s *DockerSuite) TestCreateRM(c *testing.T) {
|
|||
dockerCmd(c, "rm", "-f", cID)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateModeIpcContainer(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateModeIpcContainer(c *testing.T) {
|
||||
// Uses Linux specific functionality (--ipc)
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
|
||||
|
@ -252,7 +264,7 @@ func (s *DockerSuite) TestCreateModeIpcContainer(c *testing.T) {
|
|||
dockerCmd(c, "create", fmt.Sprintf("--ipc=container:%s", id), "busybox")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateByImageID(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateByImageID(c *testing.T) {
|
||||
imageName := "testcreatebyimageid"
|
||||
buildImageSuccessfully(c, imageName, build.WithDockerfile(`FROM busybox
|
||||
MAINTAINER dockerio`))
|
||||
|
@ -285,7 +297,7 @@ func (s *DockerSuite) TestCreateByImageID(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateStopSignal(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateStopSignal(c *testing.T) {
|
||||
name := "test_create_stop_signal"
|
||||
dockerCmd(c, "create", "--name", name, "--stop-signal", "9", "busybox")
|
||||
|
||||
|
@ -293,7 +305,7 @@ func (s *DockerSuite) TestCreateStopSignal(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(res, "9"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateWithWorkdir(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateWithWorkdir(c *testing.T) {
|
||||
name := "foo"
|
||||
|
||||
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
||||
|
@ -315,7 +327,7 @@ func (s *DockerSuite) TestCreateWithWorkdir(c *testing.T) {
|
|||
dockerCmd(c, "cp", fmt.Sprintf("%s:%s", name, dir), prefix+slash+"tmp")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestCreateWithInvalidLogOpts(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateWithInvalidLogOpts(c *testing.T) {
|
||||
name := "test-invalidate-log-opts"
|
||||
out, _, err := dockerCmdWithError("create", "--name", name, "--log-opt", "invalid=true", "busybox")
|
||||
assert.ErrorContains(c, err, "")
|
||||
|
@ -327,7 +339,7 @@ func (s *DockerSuite) TestCreateWithInvalidLogOpts(c *testing.T) {
|
|||
}
|
||||
|
||||
// #20972
|
||||
func (s *DockerSuite) TestCreate64ByteHexID(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreate64ByteHexID(c *testing.T) {
|
||||
out := inspectField(c, "busybox", "Id")
|
||||
imageID := strings.TrimPrefix(strings.TrimSpace(out), "sha256:")
|
||||
|
||||
|
@ -335,7 +347,7 @@ func (s *DockerSuite) TestCreate64ByteHexID(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test case for #23498
|
||||
func (s *DockerSuite) TestCreateUnsetEntrypoint(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateUnsetEntrypoint(c *testing.T) {
|
||||
name := "test-entrypoint"
|
||||
dockerfile := `FROM busybox
|
||||
ADD entrypoint.sh /entrypoint.sh
|
||||
|
@ -362,7 +374,7 @@ exec "$@"`,
|
|||
}
|
||||
|
||||
// #22471
|
||||
func (s *DockerSuite) TestCreateStopTimeout(c *testing.T) {
|
||||
func (s *DockerCLICreateSuite) TestCreateStopTimeout(c *testing.T) {
|
||||
name1 := "test_create_stop_timeout_1"
|
||||
dockerCmd(c, "create", "--name", name1, "--stop-timeout", "15", "busybox")
|
||||
|
||||
|
|
|
@ -24,7 +24,19 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestEventsTimestampFormats(c *testing.T) {
|
||||
type DockerCLIEventSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIEventSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIEventSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIEventSuite) TestEventsTimestampFormats(c *testing.T) {
|
||||
name := "events-time-format-test"
|
||||
|
||||
// Start stopwatch, generate an event
|
||||
|
@ -53,7 +65,7 @@ func (s *DockerSuite) TestEventsTimestampFormats(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsUntag(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsUntag(c *testing.T) {
|
||||
image := "busybox"
|
||||
dockerCmd(c, "tag", image, "utest:tag1")
|
||||
dockerCmd(c, "tag", image, "utest:tag2")
|
||||
|
@ -76,7 +88,7 @@ func (s *DockerSuite) TestEventsUntag(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsContainerEvents(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsContainerEvents(c *testing.T) {
|
||||
dockerCmd(c, "run", "--rm", "--name", "container-events-test", "busybox", "true")
|
||||
|
||||
out, _ := dockerCmd(c, "events", "--until", daemonUnixTime(c))
|
||||
|
@ -90,7 +102,7 @@ func (s *DockerSuite) TestEventsContainerEvents(c *testing.T) {
|
|||
assert.Assert(c, is.DeepEqual(containerEvents, []string{"create", "attach", "start", "die", "destroy"}), out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsContainerEventsAttrSort(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsContainerEventsAttrSort(c *testing.T) {
|
||||
since := daemonUnixTime(c)
|
||||
dockerCmd(c, "run", "--rm", "--name", "container-events-test", "busybox", "true")
|
||||
|
||||
|
@ -114,7 +126,7 @@ func (s *DockerSuite) TestEventsContainerEventsAttrSort(c *testing.T) {
|
|||
assert.Equal(c, matchedEvents, 2, "missing events for container container-events-test:\n%s", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsContainerEventsSinceUnixEpoch(c *testing.T) {
|
||||
dockerCmd(c, "run", "--rm", "--name", "since-epoch-test", "busybox", "true")
|
||||
timeBeginning := time.Unix(0, 0).Format(time.RFC3339Nano)
|
||||
timeBeginning = strings.ReplaceAll(timeBeginning, "Z", ".000000000Z")
|
||||
|
@ -128,7 +140,7 @@ func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *testing.T) {
|
|||
assert.Assert(c, is.DeepEqual(containerEvents, []string{"create", "attach", "start", "die", "destroy"}), out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsImageTag(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsImageTag(c *testing.T) {
|
||||
time.Sleep(1 * time.Second) // because API has seconds granularity
|
||||
since := daemonUnixTime(c)
|
||||
image := "testimageevents:tag"
|
||||
|
@ -146,7 +158,7 @@ func (s *DockerSuite) TestEventsImageTag(c *testing.T) {
|
|||
assert.Equal(c, matches["action"], "tag")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsImagePull(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsImagePull(c *testing.T) {
|
||||
// TODO Windows: Enable this test once pull and reliable image names are available
|
||||
testRequires(c, DaemonIsLinux)
|
||||
since := daemonUnixTime(c)
|
||||
|
@ -164,7 +176,7 @@ func (s *DockerSuite) TestEventsImagePull(c *testing.T) {
|
|||
assert.Equal(c, matches["action"], "pull")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsImageImport(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsImageImport(c *testing.T) {
|
||||
// TODO Windows CI. This should be portable once export/import are
|
||||
// more reliable (@swernli)
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
@ -188,7 +200,7 @@ func (s *DockerSuite) TestEventsImageImport(c *testing.T) {
|
|||
assert.Equal(c, matches["action"], "import", "matches: %v\nout:\n%s\n", matches, out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsImageLoad(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsImageLoad(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
myImageName := "footest:v1"
|
||||
dockerCmd(c, "tag", "busybox", myImageName)
|
||||
|
@ -227,7 +239,7 @@ func (s *DockerSuite) TestEventsImageLoad(c *testing.T) {
|
|||
assert.Equal(c, matches["action"], "save", "matches: %v\nout:\n%s\n", matches, out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsPluginOps(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsPluginOps(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, IsAmd64, Network)
|
||||
|
||||
since := daemonUnixTime(c)
|
||||
|
@ -246,7 +258,7 @@ func (s *DockerSuite) TestEventsPluginOps(c *testing.T) {
|
|||
assert.Assert(c, is.DeepEqual(pluginEvents, []string{"pull", "enable", "disable", "remove"}), out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsFilters(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsFilters(c *testing.T) {
|
||||
since := daemonUnixTime(c)
|
||||
dockerCmd(c, "run", "--rm", "busybox", "true")
|
||||
dockerCmd(c, "run", "--rm", "busybox", "true")
|
||||
|
@ -261,7 +273,7 @@ func (s *DockerSuite) TestEventsFilters(c *testing.T) {
|
|||
assert.Assert(c, count >= 2, "should have had 2 start events but had %d, out: %s", count, out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsFilterImageName(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsFilterImageName(c *testing.T) {
|
||||
since := daemonUnixTime(c)
|
||||
|
||||
out, _ := dockerCmd(c, "run", "--name", "container_1", "-d", "busybox:latest", "true")
|
||||
|
@ -289,7 +301,7 @@ func (s *DockerSuite) TestEventsFilterImageName(c *testing.T) {
|
|||
assert.Assert(c, count2 != 0, "Expected event from container but got %d from %s", count2, container2)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsFilterLabels(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsFilterLabels(c *testing.T) {
|
||||
since := strconv.FormatUint(uint64(daemonTime(c).Unix()), 10)
|
||||
label := "io.docker.testing=foo"
|
||||
|
||||
|
@ -324,7 +336,7 @@ func (s *DockerSuite) TestEventsFilterLabels(c *testing.T) {
|
|||
assert.Assert(c, found)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsFilterImageLabels(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsFilterImageLabels(c *testing.T) {
|
||||
since := daemonUnixTime(c)
|
||||
name := "labelfiltertest"
|
||||
label := "io.docker.testing=image"
|
||||
|
@ -354,7 +366,7 @@ func (s *DockerSuite) TestEventsFilterImageLabels(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsFilterContainer(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsFilterContainer(c *testing.T) {
|
||||
since := daemonUnixTime(c)
|
||||
nameID := make(map[string]string)
|
||||
|
||||
|
@ -392,7 +404,7 @@ func (s *DockerSuite) TestEventsFilterContainer(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsCommit(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsCommit(c *testing.T) {
|
||||
// Problematic on Windows as cannot commit a running container
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -409,7 +421,7 @@ func (s *DockerSuite) TestEventsCommit(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "commit"), "Missing 'commit' log event")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsCopy(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsCopy(c *testing.T) {
|
||||
// Build a test image.
|
||||
buildImageSuccessfully(c, "cpimg", build.WithDockerfile(`
|
||||
FROM busybox
|
||||
|
@ -438,7 +450,7 @@ func (s *DockerSuite) TestEventsCopy(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "extract-to-dir"), "Missing 'extract-to-dir' log event")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsResize(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsResize(c *testing.T) {
|
||||
out := runSleepingContainer(c, "-d", "-t")
|
||||
cID := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(cID))
|
||||
|
@ -461,7 +473,7 @@ func (s *DockerSuite) TestEventsResize(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "resize"), "Missing 'resize' log event")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsAttach(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsAttach(c *testing.T) {
|
||||
// TODO Windows CI: Figure out why this test fails intermittently (TP5).
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -499,7 +511,7 @@ func (s *DockerSuite) TestEventsAttach(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "attach"), "Missing 'attach' log event")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsRename(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsRename(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "--name", "oldName", "busybox", "true")
|
||||
cID := strings.TrimSpace(out)
|
||||
dockerCmd(c, "rename", "oldName", "newName")
|
||||
|
@ -510,7 +522,7 @@ func (s *DockerSuite) TestEventsRename(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "rename"), "Missing 'rename' log event")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsTop(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsTop(c *testing.T) {
|
||||
// Problematic on Windows as Windows does not support top
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -547,7 +559,7 @@ func (s *DockerRegistrySuite) TestEventsImageFilterPush(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, repoName), "Missing 'push' log event for %s", repoName)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsFilterType(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsFilterType(c *testing.T) {
|
||||
// FIXME(vdemeester) fails on e2e run
|
||||
testRequires(c, testEnv.IsLocalDaemon)
|
||||
since := daemonUnixTime(c)
|
||||
|
@ -601,7 +613,7 @@ func (s *DockerSuite) TestEventsFilterType(c *testing.T) {
|
|||
}
|
||||
|
||||
// #25798
|
||||
func (s *DockerSuite) TestEventsSpecialFiltersWithExecCreate(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsSpecialFiltersWithExecCreate(c *testing.T) {
|
||||
since := daemonUnixTime(c)
|
||||
runSleepingContainer(c, "--name", "test-container", "-d")
|
||||
waitRun("test-container")
|
||||
|
@ -631,7 +643,7 @@ func (s *DockerSuite) TestEventsSpecialFiltersWithExecCreate(c *testing.T) {
|
|||
assert.Equal(c, len(events), 1, out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsFilterImageInContainerAction(c *testing.T) {
|
||||
since := daemonUnixTime(c)
|
||||
dockerCmd(c, "run", "--name", "test-container", "-d", "busybox", "true")
|
||||
waitRun("test-container")
|
||||
|
@ -641,7 +653,7 @@ func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *testing.T) {
|
|||
assert.Assert(c, len(events) > 1, out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsContainerRestart(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsContainerRestart(c *testing.T) {
|
||||
dockerCmd(c, "run", "-d", "--name=testEvent", "--restart=on-failure:3", "busybox", "false")
|
||||
|
||||
// wait until test2 is auto removed.
|
||||
|
@ -681,7 +693,7 @@ func (s *DockerSuite) TestEventsContainerRestart(c *testing.T) {
|
|||
assert.Equal(c, dieCount, 4, "testEvent should die 4 times: %v", actions)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsSinceInTheFuture(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsSinceInTheFuture(c *testing.T) {
|
||||
dockerCmd(c, "run", "--name", "test-container", "-d", "busybox", "true")
|
||||
waitRun("test-container")
|
||||
|
||||
|
@ -693,7 +705,7 @@ func (s *DockerSuite) TestEventsSinceInTheFuture(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "cannot be after `until`"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsUntilInThePast(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsUntilInThePast(c *testing.T) {
|
||||
since := daemonUnixTime(c)
|
||||
|
||||
dockerCmd(c, "run", "--name", "test-container", "-d", "busybox", "true")
|
||||
|
@ -710,7 +722,7 @@ func (s *DockerSuite) TestEventsUntilInThePast(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "test-container"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsFormat(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsFormat(c *testing.T) {
|
||||
since := daemonUnixTime(c)
|
||||
dockerCmd(c, "run", "--rm", "busybox", "true")
|
||||
dockerCmd(c, "run", "--rm", "busybox", "true")
|
||||
|
@ -733,7 +745,7 @@ func (s *DockerSuite) TestEventsFormat(c *testing.T) {
|
|||
assert.Equal(c, startCount, 2, "should have had 2 start events but had %d, out: %s", startCount, out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsFormatBadFunc(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsFormatBadFunc(c *testing.T) {
|
||||
// make sure it fails immediately, without receiving any event
|
||||
result := dockerCmdWithResult("events", "--format", "{{badFuncString .}}")
|
||||
result.Assert(c, icmd.Expected{
|
||||
|
@ -743,7 +755,7 @@ func (s *DockerSuite) TestEventsFormatBadFunc(c *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsFormatBadField(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsFormatBadField(c *testing.T) {
|
||||
// make sure it fails immediately, without receiving any event
|
||||
result := dockerCmdWithResult("events", "--format", "{{.badFieldString}}")
|
||||
result.Assert(c, icmd.Expected{
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
)
|
||||
|
||||
// #5979
|
||||
func (s *DockerSuite) TestEventsRedirectStdout(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsRedirectStdout(c *testing.T) {
|
||||
since := daemonUnixTime(c)
|
||||
dockerCmd(c, "run", "busybox", "true")
|
||||
|
||||
|
@ -48,7 +48,7 @@ func (s *DockerSuite) TestEventsRedirectStdout(c *testing.T) {
|
|||
assert.NilError(c, scanner.Err(), "Scan err for command %q", command)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsOOMDisableFalse(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsOOMDisableFalse(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, oomControl, memoryLimitSupport, swapMemorySupport, NotPpc64le)
|
||||
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -78,7 +78,7 @@ func (s *DockerSuite) TestEventsOOMDisableFalse(c *testing.T) {
|
|||
assert.Equal(c, parseEventAction(c, events[nEvents-1]), "die")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsOOMDisableTrue(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsOOMDisableTrue(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, oomControl, memoryLimitSupport, NotArm, swapMemorySupport, NotPpc64le)
|
||||
|
||||
errChan := make(chan error, 1)
|
||||
|
@ -126,7 +126,7 @@ func (s *DockerSuite) TestEventsOOMDisableTrue(c *testing.T) {
|
|||
}
|
||||
|
||||
// #18453
|
||||
func (s *DockerSuite) TestEventsContainerFilterByName(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsContainerFilterByName(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
cOut, _ := dockerCmd(c, "run", "--name=foo", "-d", "busybox", "top")
|
||||
c1 := strings.TrimSpace(cOut)
|
||||
|
@ -140,7 +140,7 @@ func (s *DockerSuite) TestEventsContainerFilterByName(c *testing.T) {
|
|||
}
|
||||
|
||||
// #18453
|
||||
func (s *DockerSuite) TestEventsContainerFilterBeforeCreate(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsContainerFilterBeforeCreate(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
buf := &bytes.Buffer{}
|
||||
cmd := exec.Command(dockerBinary, "events", "-f", "container=foo", "--since=0")
|
||||
|
@ -165,7 +165,7 @@ func (s *DockerSuite) TestEventsContainerFilterBeforeCreate(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeEvents(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestVolumeEvents(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
since := daemonUnixTime(c)
|
||||
|
@ -192,7 +192,7 @@ func (s *DockerSuite) TestVolumeEvents(c *testing.T) {
|
|||
assert.Equal(c, volumeEvents[3], "destroy")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestNetworkEvents(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestNetworkEvents(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
since := daemonUnixTime(c)
|
||||
|
@ -219,7 +219,7 @@ func (s *DockerSuite) TestNetworkEvents(c *testing.T) {
|
|||
assert.Equal(c, netEvents[3], "destroy")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsContainerWithMultiNetwork(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsContainerWithMultiNetwork(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
// Observe create/connect network actions
|
||||
|
@ -247,7 +247,7 @@ func (s *DockerSuite) TestEventsContainerWithMultiNetwork(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "test-event-network-local-2"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsStreaming(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsStreaming(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
observer, err := newEventObserver(c)
|
||||
|
@ -301,7 +301,7 @@ func (s *DockerSuite) TestEventsStreaming(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsImageUntagDelete(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsImageUntagDelete(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
observer, err := newEventObserver(c)
|
||||
|
@ -340,7 +340,7 @@ func (s *DockerSuite) TestEventsImageUntagDelete(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsFilterVolumeAndNetworkType(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsFilterVolumeAndNetworkType(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
since := daemonUnixTime(c)
|
||||
|
@ -359,7 +359,7 @@ func (s *DockerSuite) TestEventsFilterVolumeAndNetworkType(c *testing.T) {
|
|||
assert.Equal(c, networkActions[0], "create")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsFilterVolumeID(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsFilterVolumeID(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
since := daemonUnixTime(c)
|
||||
|
@ -374,7 +374,7 @@ func (s *DockerSuite) TestEventsFilterVolumeID(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(events[0], "driver=local"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsFilterNetworkID(c *testing.T) {
|
||||
func (s *DockerCLIEventSuite) TestEventsFilterNetworkID(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
since := daemonUnixTime(c)
|
||||
|
|
|
@ -22,7 +22,19 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestExec(c *testing.T) {
|
||||
type DockerCLIExecSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIExecSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIExecSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIExecSuite) TestExec(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "sh", "-c", "echo test > /tmp/file && top")
|
||||
assert.NilError(c, waitRun(strings.TrimSpace(out)))
|
||||
|
@ -31,7 +43,7 @@ func (s *DockerSuite) TestExec(c *testing.T) {
|
|||
assert.Equal(c, strings.Trim(out, "\r\n"), "test")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecInteractive(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecInteractive(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "sh", "-c", "echo test > /tmp/file && top")
|
||||
|
||||
|
@ -67,7 +79,7 @@ func (s *DockerSuite) TestExecInteractive(c *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecAfterContainerRestart(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecAfterContainerRestart(c *testing.T) {
|
||||
out := runSleepingContainer(c)
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(cleanedContainerID))
|
||||
|
@ -96,7 +108,7 @@ func (s *DockerDaemonSuite) TestExecAfterDaemonRestart(c *testing.T) {
|
|||
}
|
||||
|
||||
// Regression test for #9155, #9044
|
||||
func (s *DockerSuite) TestExecEnv(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecEnv(c *testing.T) {
|
||||
// TODO Windows CI: This one is interesting and may just end up being a feature
|
||||
// difference between Windows and Linux. On Windows, the environment is passed
|
||||
// into the process that is launched, not into the machine environment. Hence
|
||||
|
@ -111,7 +123,7 @@ func (s *DockerSuite) TestExecEnv(c *testing.T) {
|
|||
assert.Check(c, strings.Contains(out, "HOME=/root"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecSetEnv(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecSetEnv(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
runSleepingContainer(c, "-e", "HOME=/root", "-d", "--name", "testing")
|
||||
assert.NilError(c, waitRun("testing"))
|
||||
|
@ -122,14 +134,14 @@ func (s *DockerSuite) TestExecSetEnv(c *testing.T) {
|
|||
assert.Check(c, strings.Contains(out, "ABC=xyz"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecExitStatus(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecExitStatus(c *testing.T) {
|
||||
runSleepingContainer(c, "-d", "--name", "top")
|
||||
|
||||
result := icmd.RunCommand(dockerBinary, "exec", "top", "sh", "-c", "exit 23")
|
||||
result.Assert(c, icmd.Expected{ExitCode: 23, Error: "exit status 23"})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecPausedContainer(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecPausedContainer(c *testing.T) {
|
||||
testRequires(c, IsPausable)
|
||||
|
||||
out := runSleepingContainer(c, "-d", "--name", "testing")
|
||||
|
@ -144,7 +156,7 @@ func (s *DockerSuite) TestExecPausedContainer(c *testing.T) {
|
|||
}
|
||||
|
||||
// regression test for #9476
|
||||
func (s *DockerSuite) TestExecTTYCloseStdin(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecTTYCloseStdin(c *testing.T) {
|
||||
// TODO Windows CI: This requires some work to port to Windows.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "-d", "-it", "--name", "exec_tty_stdin", "busybox")
|
||||
|
@ -165,7 +177,7 @@ func (s *DockerSuite) TestExecTTYCloseStdin(c *testing.T) {
|
|||
assert.Assert(c, !strings.Contains(out, "nsenter-exec"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecTTYWithoutStdin(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecTTYWithoutStdin(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "-ti", "busybox")
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
|
@ -202,7 +214,7 @@ func (s *DockerSuite) TestExecTTYWithoutStdin(c *testing.T) {
|
|||
}
|
||||
|
||||
// FIXME(vdemeester) this should be a unit tests on cli/command/container package
|
||||
func (s *DockerSuite) TestExecParseError(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecParseError(c *testing.T) {
|
||||
// TODO Windows CI: Requires some extra work. Consider copying the
|
||||
// runSleepingContainer helper to have an exec version.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
@ -216,7 +228,7 @@ func (s *DockerSuite) TestExecParseError(c *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecStopNotHanging(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecStopNotHanging(c *testing.T) {
|
||||
// TODO Windows CI: Requires some extra work. Consider copying the
|
||||
// runSleepingContainer helper to have an exec version.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
@ -244,7 +256,7 @@ func (s *DockerSuite) TestExecStopNotHanging(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecCgroup(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecCgroup(c *testing.T) {
|
||||
// Not applicable on Windows - using Linux specific functionality
|
||||
testRequires(c, NotUserNamespace)
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
@ -297,7 +309,7 @@ func (s *DockerSuite) TestExecCgroup(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecInspectID(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecInspectID(c *testing.T) {
|
||||
out := runSleepingContainer(c, "-d")
|
||||
id := strings.TrimSuffix(out, "\n")
|
||||
|
||||
|
@ -364,7 +376,7 @@ func (s *DockerSuite) TestExecInspectID(c *testing.T) {
|
|||
assert.ErrorContains(c, err, "No such exec instance")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksPingLinkedContainersOnRename(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestLinksPingLinkedContainersOnRename(c *testing.T) {
|
||||
// Problematic on Windows as Windows does not support links
|
||||
testRequires(c, DaemonIsLinux)
|
||||
var out string
|
||||
|
@ -380,7 +392,7 @@ func (s *DockerSuite) TestLinksPingLinkedContainersOnRename(c *testing.T) {
|
|||
dockerCmd(c, "exec", "container2", "ping", "-c", "1", "alias1", "-W", "1")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunMutableNetworkFiles(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestRunMutableNetworkFiles(c *testing.T) {
|
||||
// Not applicable on Windows to Windows CI.
|
||||
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
|
||||
for _, fn := range []string{"resolv.conf", "hosts"} {
|
||||
|
@ -421,7 +433,7 @@ func (s *DockerSuite) TestRunMutableNetworkFiles(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecWithUser(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecWithUser(c *testing.T) {
|
||||
// TODO Windows CI: This may be fixable in the future once Windows
|
||||
// supports users
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
@ -434,7 +446,7 @@ func (s *DockerSuite) TestExecWithUser(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "uid=0(root) gid=0(root)"), "exec with user by id expected daemon user got %s", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecWithPrivileged(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecWithPrivileged(c *testing.T) {
|
||||
// Not applicable on Windows
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
// Start main loop which attempts mknod repeatedly
|
||||
|
@ -464,7 +476,7 @@ func (s *DockerSuite) TestExecWithPrivileged(c *testing.T) {
|
|||
assert.Assert(c, !strings.Contains(result.Combined(), "Success"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecWithImageUser(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecWithImageUser(c *testing.T) {
|
||||
// Not applicable on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "testbuilduser"
|
||||
|
@ -477,7 +489,7 @@ func (s *DockerSuite) TestExecWithImageUser(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "dockerio"), "exec with user by id expected dockerio user got %s", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecOnReadonlyContainer(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecOnReadonlyContainer(c *testing.T) {
|
||||
// Windows does not support read-only
|
||||
// --read-only + userns has remount issues
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
|
@ -485,7 +497,7 @@ func (s *DockerSuite) TestExecOnReadonlyContainer(c *testing.T) {
|
|||
dockerCmd(c, "exec", "parent", "true")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecUlimits(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecUlimits(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "testexeculimits"
|
||||
runSleepingContainer(c, "-d", "--ulimit", "nofile=511:511", "--name", name)
|
||||
|
@ -497,7 +509,7 @@ func (s *DockerSuite) TestExecUlimits(c *testing.T) {
|
|||
}
|
||||
|
||||
// #15750
|
||||
func (s *DockerSuite) TestExecStartFails(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecStartFails(c *testing.T) {
|
||||
// TODO Windows CI. This test should be portable. Figure out why it fails
|
||||
// currently.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
@ -511,7 +523,7 @@ func (s *DockerSuite) TestExecStartFails(c *testing.T) {
|
|||
}
|
||||
|
||||
// Fix regression in https://github.com/docker/docker/pull/26461#issuecomment-250287297
|
||||
func (s *DockerSuite) TestExecWindowsPathNotWiped(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecWindowsPathNotWiped(c *testing.T) {
|
||||
testRequires(c, DaemonIsWindows)
|
||||
out, _ := dockerCmd(c, "run", "-d", "--name", "testing", minimalBaseImage(), "powershell", "start-sleep", "60")
|
||||
assert.NilError(c, waitRun(strings.TrimSpace(out)))
|
||||
|
@ -521,7 +533,7 @@ func (s *DockerSuite) TestExecWindowsPathNotWiped(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, `windowspowershell\v1.0`))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecEnvLinksHost(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecEnvLinksHost(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
runSleepingContainer(c, "-d", "--name", "foo")
|
||||
runSleepingContainer(c, "-d", "--link", "foo:db", "--hostname", "myhost", "--name", "bar")
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
// regression test for #12546
|
||||
func (s *DockerSuite) TestExecInteractiveStdinClose(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecInteractiveStdinClose(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-itd", "busybox", "/bin/cat")
|
||||
contID := strings.TrimSpace(out)
|
||||
|
@ -45,7 +45,7 @@ func (s *DockerSuite) TestExecInteractiveStdinClose(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestExecTTY(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecTTY(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
dockerCmd(c, "run", "-d", "--name=test", "busybox", "sh", "-c", "echo hello > /foo && top")
|
||||
|
||||
|
@ -75,7 +75,7 @@ func (s *DockerSuite) TestExecTTY(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test the TERM env var is set when -t is provided on exec
|
||||
func (s *DockerSuite) TestExecWithTERM(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecWithTERM(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
out, _ := dockerCmd(c, "run", "-id", "busybox", "/bin/cat")
|
||||
contID := strings.TrimSpace(out)
|
||||
|
@ -87,7 +87,7 @@ func (s *DockerSuite) TestExecWithTERM(c *testing.T) {
|
|||
|
||||
// Test that the TERM env var is not set on exec when -t is not provided, even if it was set
|
||||
// on run
|
||||
func (s *DockerSuite) TestExecWithNoTERM(c *testing.T) {
|
||||
func (s *DockerCLIExecSuite) TestExecWithNoTERM(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
out, _ := dockerCmd(c, "run", "-itd", "busybox", "/bin/cat")
|
||||
contID := strings.TrimSpace(out)
|
||||
|
|
|
@ -12,6 +12,18 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
type DockerCLIHealthSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIHealthSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIHealthSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func waitForHealthStatus(c *testing.T, name string, prev string, expected string) {
|
||||
prev = prev + "\n"
|
||||
expected = expected + "\n"
|
||||
|
@ -36,7 +48,7 @@ func getHealth(c *testing.T, name string) *types.Health {
|
|||
return &health
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestHealth(c *testing.T) {
|
||||
func (s *DockerCLIHealthSuite) TestHealth(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows
|
||||
|
||||
existingContainers := ExistingContainerIDs(c)
|
||||
|
@ -144,7 +156,7 @@ func (s *DockerSuite) TestHealth(c *testing.T) {
|
|||
}
|
||||
|
||||
// GitHub #33021
|
||||
func (s *DockerSuite) TestUnsetEnvVarHealthCheck(c *testing.T) {
|
||||
func (s *DockerCLIHealthSuite) TestUnsetEnvVarHealthCheck(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows
|
||||
|
||||
imageName := "testhealth"
|
||||
|
|
|
@ -12,9 +12,21 @@ import (
|
|||
"gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
type DockerCLIHistorySuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIHistorySuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIHistorySuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
// This is a heisen-test. Because the created timestamp of images and the behavior of
|
||||
// sort is not predictable it doesn't always fail.
|
||||
func (s *DockerSuite) TestBuildHistory(c *testing.T) {
|
||||
func (s *DockerCLIHistorySuite) TestBuildHistory(c *testing.T) {
|
||||
name := "testbuildhistory"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(`FROM `+minimalBaseImage()+`
|
||||
LABEL label.A="A"
|
||||
|
@ -56,16 +68,16 @@ LABEL label.Z="Z"`))
|
|||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestHistoryExistentImage(c *testing.T) {
|
||||
func (s *DockerCLIHistorySuite) TestHistoryExistentImage(c *testing.T) {
|
||||
dockerCmd(c, "history", "busybox")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestHistoryNonExistentImage(c *testing.T) {
|
||||
func (s *DockerCLIHistorySuite) TestHistoryNonExistentImage(c *testing.T) {
|
||||
_, _, err := dockerCmdWithError("history", "testHistoryNonExistentImage")
|
||||
assert.Assert(c, err != nil, "history on a non-existent image should fail.")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestHistoryImageWithComment(c *testing.T) {
|
||||
func (s *DockerCLIHistorySuite) TestHistoryImageWithComment(c *testing.T) {
|
||||
name := "testhistoryimagewithcomment"
|
||||
|
||||
// make an image through docker commit <container id> [ -m messages ]
|
||||
|
@ -84,7 +96,7 @@ func (s *DockerSuite) TestHistoryImageWithComment(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(actualValue, comment))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestHistoryHumanOptionFalse(c *testing.T) {
|
||||
func (s *DockerCLIHistorySuite) TestHistoryHumanOptionFalse(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "history", "--human=false", "busybox")
|
||||
lines := strings.Split(out, "\n")
|
||||
sizeColumnRegex, _ := regexp.Compile("SIZE +")
|
||||
|
@ -102,7 +114,7 @@ func (s *DockerSuite) TestHistoryHumanOptionFalse(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestHistoryHumanOptionTrue(c *testing.T) {
|
||||
func (s *DockerCLIHistorySuite) TestHistoryHumanOptionTrue(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "history", "--human=true", "busybox")
|
||||
lines := strings.Split(out, "\n")
|
||||
sizeColumnRegex, _ := regexp.Compile("SIZE +")
|
||||
|
|
|
@ -17,12 +17,24 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestImagesEnsureImageIsListed(c *testing.T) {
|
||||
type DockerCLIImagesSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIImagesSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIImagesSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIImagesSuite) TestImagesEnsureImageIsListed(c *testing.T) {
|
||||
imagesOut, _ := dockerCmd(c, "images")
|
||||
assert.Assert(c, strings.Contains(imagesOut, "busybox"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImagesEnsureImageWithTagIsListed(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesEnsureImageWithTagIsListed(c *testing.T) {
|
||||
name := "imagewithtag"
|
||||
dockerCmd(c, "tag", "busybox", name+":v1")
|
||||
dockerCmd(c, "tag", "busybox", name+":v1v1")
|
||||
|
@ -40,12 +52,12 @@ func (s *DockerSuite) TestImagesEnsureImageWithTagIsListed(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(imagesOut, "v2"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImagesEnsureImageWithBadTagIsNotListed(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesEnsureImageWithBadTagIsNotListed(c *testing.T) {
|
||||
imagesOut, _ := dockerCmd(c, "images", "busybox:nonexistent")
|
||||
assert.Assert(c, !strings.Contains(imagesOut, "busybox"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImagesOrderedByCreationDate(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesOrderedByCreationDate(c *testing.T) {
|
||||
buildImageSuccessfully(c, "order:test_a", build.WithDockerfile(`FROM busybox
|
||||
MAINTAINER dockerio1`))
|
||||
id1 := getIDByName(c, "order:test_a")
|
||||
|
@ -65,13 +77,13 @@ func (s *DockerSuite) TestImagesOrderedByCreationDate(c *testing.T) {
|
|||
assert.Equal(c, imgs[2], id1, fmt.Sprintf("First image must be %s, got %s", id1, imgs[2]))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImagesErrorWithInvalidFilterNameTest(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesErrorWithInvalidFilterNameTest(c *testing.T) {
|
||||
out, _, err := dockerCmdWithError("images", "-f", "FOO=123")
|
||||
assert.ErrorContains(c, err, "")
|
||||
assert.Assert(c, strings.Contains(out, "invalid filter"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImagesFilterLabelMatch(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesFilterLabelMatch(c *testing.T) {
|
||||
imageName1 := "images_filter_test1"
|
||||
imageName2 := "images_filter_test2"
|
||||
imageName3 := "images_filter_test3"
|
||||
|
@ -101,7 +113,7 @@ func (s *DockerSuite) TestImagesFilterLabelMatch(c *testing.T) {
|
|||
}
|
||||
|
||||
// Regression : #15659
|
||||
func (s *DockerSuite) TestCommitWithFilterLabel(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestCommitWithFilterLabel(c *testing.T) {
|
||||
// Create a container
|
||||
dockerCmd(c, "run", "--name", "bar", "busybox", "/bin/sh")
|
||||
// Commit with labels "using changes"
|
||||
|
@ -113,7 +125,7 @@ func (s *DockerSuite) TestCommitWithFilterLabel(c *testing.T) {
|
|||
assert.Equal(c, out, imageID)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImagesFilterSinceAndBefore(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesFilterSinceAndBefore(c *testing.T) {
|
||||
buildImageSuccessfully(c, "image:1", build.WithDockerfile(`FROM `+minimalBaseImage()+`
|
||||
LABEL number=1`))
|
||||
imageID1 := getIDByName(c, "image:1")
|
||||
|
@ -183,7 +195,7 @@ func assertImageList(out string, expected []string) bool {
|
|||
}
|
||||
|
||||
// FIXME(vdemeester) should be a unit test on `docker image ls`
|
||||
func (s *DockerSuite) TestImagesFilterSpaceTrimCase(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesFilterSpaceTrimCase(c *testing.T) {
|
||||
imageName := "images_filter_test"
|
||||
// Build a image and fail to build so that we have dangling images ?
|
||||
buildImage(imageName, build.WithDockerfile(`FROM busybox
|
||||
|
@ -223,7 +235,7 @@ func (s *DockerSuite) TestImagesFilterSpaceTrimCase(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
// create container 1
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
||||
|
@ -249,13 +261,13 @@ func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *testing.T)
|
|||
}
|
||||
|
||||
// FIXME(vdemeester) should be a unit test for `docker image ls`
|
||||
func (s *DockerSuite) TestImagesWithIncorrectFilter(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesWithIncorrectFilter(c *testing.T) {
|
||||
out, _, err := dockerCmdWithError("images", "-f", "dangling=invalid")
|
||||
assert.ErrorContains(c, err, "")
|
||||
assert.Assert(c, strings.Contains(out, "invalid filter"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImagesEnsureOnlyHeadsImagesShown(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesEnsureOnlyHeadsImagesShown(c *testing.T) {
|
||||
dockerfile := `
|
||||
FROM busybox
|
||||
MAINTAINER docker
|
||||
|
@ -278,7 +290,7 @@ func (s *DockerSuite) TestImagesEnsureOnlyHeadsImagesShown(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, stringid.TruncateID(id)))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImagesEnsureImagesFromScratchShown(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesEnsureImagesFromScratchShown(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // Windows does not support FROM scratch
|
||||
dockerfile := `
|
||||
FROM scratch
|
||||
|
@ -295,7 +307,7 @@ func (s *DockerSuite) TestImagesEnsureImagesFromScratchShown(c *testing.T) {
|
|||
|
||||
// For W2W - equivalent to TestImagesEnsureImagesFromScratchShown but Windows
|
||||
// doesn't support from scratch
|
||||
func (s *DockerSuite) TestImagesEnsureImagesFromBusyboxShown(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesEnsureImagesFromBusyboxShown(c *testing.T) {
|
||||
dockerfile := `
|
||||
FROM busybox
|
||||
MAINTAINER docker`
|
||||
|
@ -310,7 +322,7 @@ func (s *DockerSuite) TestImagesEnsureImagesFromBusyboxShown(c *testing.T) {
|
|||
}
|
||||
|
||||
// #18181
|
||||
func (s *DockerSuite) TestImagesFilterNameWithPort(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesFilterNameWithPort(c *testing.T) {
|
||||
tag := "a.b.c.d:5000/hello"
|
||||
dockerCmd(c, "tag", "busybox", tag)
|
||||
out, _ := dockerCmd(c, "images", tag)
|
||||
|
@ -321,7 +333,7 @@ func (s *DockerSuite) TestImagesFilterNameWithPort(c *testing.T) {
|
|||
assert.Assert(c, !strings.Contains(out, tag))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImagesFormat(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesFormat(c *testing.T) {
|
||||
// testRequires(c, DaemonIsLinux)
|
||||
tag := "myimage"
|
||||
dockerCmd(c, "tag", "busybox", tag+":v1")
|
||||
|
@ -337,7 +349,7 @@ func (s *DockerSuite) TestImagesFormat(c *testing.T) {
|
|||
}
|
||||
|
||||
// ImagesDefaultFormatAndQuiet
|
||||
func (s *DockerSuite) TestImagesFormatDefaultFormat(c *testing.T) {
|
||||
func (s *DockerCLIImagesSuite) TestImagesFormatDefaultFormat(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
// create container 1
|
||||
|
|
|
@ -14,7 +14,19 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestImportDisplay(c *testing.T) {
|
||||
type DockerCLIImportSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIImportSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIImportSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIImportSuite) TestImportDisplay(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
@ -32,7 +44,7 @@ func (s *DockerSuite) TestImportDisplay(c *testing.T) {
|
|||
assert.Equal(c, out, "", "command output should've been nothing.")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImportBadURL(c *testing.T) {
|
||||
func (s *DockerCLIImportSuite) TestImportBadURL(c *testing.T) {
|
||||
out, _, err := dockerCmdWithError("import", "https://nosuchdomain.invalid/bad")
|
||||
assert.Assert(c, err != nil, "import was supposed to fail but didn't")
|
||||
// Depending on your system you can get either of these errors
|
||||
|
@ -43,7 +55,7 @@ func (s *DockerSuite) TestImportBadURL(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImportFile(c *testing.T) {
|
||||
func (s *DockerCLIImportSuite) TestImportFile(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "--name", "test-import", "busybox", "true")
|
||||
|
||||
|
@ -64,7 +76,7 @@ func (s *DockerSuite) TestImportFile(c *testing.T) {
|
|||
assert.Equal(c, out, "", "command output should've been nothing.")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImportGzipped(c *testing.T) {
|
||||
func (s *DockerCLIImportSuite) TestImportGzipped(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "--name", "test-import", "busybox", "true")
|
||||
|
||||
|
@ -87,7 +99,7 @@ func (s *DockerSuite) TestImportGzipped(c *testing.T) {
|
|||
assert.Equal(c, out, "", "command output should've been nothing.")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImportFileWithMessage(c *testing.T) {
|
||||
func (s *DockerCLIImportSuite) TestImportFileWithMessage(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "--name", "test-import", "busybox", "true")
|
||||
|
||||
|
@ -118,12 +130,12 @@ func (s *DockerSuite) TestImportFileWithMessage(c *testing.T) {
|
|||
assert.Equal(c, out, "", "command output should've been nothing")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImportFileNonExistentFile(c *testing.T) {
|
||||
func (s *DockerCLIImportSuite) TestImportFileNonExistentFile(c *testing.T) {
|
||||
_, _, err := dockerCmdWithError("import", "example.com/myImage.tar")
|
||||
assert.Assert(c, err != nil, "import non-existing file must failed")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestImportWithQuotedChanges(c *testing.T) {
|
||||
func (s *DockerCLIImportSuite) TestImportWithQuotedChanges(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
cli.DockerCmd(c, "run", "--name", "test-import", "busybox", "true")
|
||||
|
||||
|
|
|
@ -9,8 +9,20 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
type DockerCLIInfoSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIInfoSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIInfoSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
// ensure docker info succeeds
|
||||
func (s *DockerSuite) TestInfoEnsureSucceeds(c *testing.T) {
|
||||
func (s *DockerCLIInfoSuite) TestInfoEnsureSucceeds(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "info")
|
||||
|
||||
// always shown fields
|
||||
|
@ -53,7 +65,7 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInfoDisplaysRunningContainers(c *testing.T) {
|
||||
func (s *DockerCLIInfoSuite) TestInfoDisplaysRunningContainers(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
existing := existingContainerStates(c)
|
||||
|
@ -66,7 +78,7 @@ func (s *DockerSuite) TestInfoDisplaysRunningContainers(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"])))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInfoDisplaysPausedContainers(c *testing.T) {
|
||||
func (s *DockerCLIInfoSuite) TestInfoDisplaysPausedContainers(c *testing.T) {
|
||||
testRequires(c, IsPausable)
|
||||
|
||||
existing := existingContainerStates(c)
|
||||
|
@ -83,7 +95,7 @@ func (s *DockerSuite) TestInfoDisplaysPausedContainers(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"])))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInfoDisplaysStoppedContainers(c *testing.T) {
|
||||
func (s *DockerCLIInfoSuite) TestInfoDisplaysStoppedContainers(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
existing := existingContainerStates(c)
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestInfoSecurityOptions(c *testing.T) {
|
||||
func (s *DockerCLIInfoSuite) TestInfoSecurityOptions(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
|
||||
if !seccompEnabled() && !Apparmor() {
|
||||
c.Skip("test requires Seccomp and/or AppArmor")
|
||||
|
|
|
@ -15,13 +15,25 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
type DockerCLIInspectSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIInspectSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIInspectSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func checkValidGraphDriver(c *testing.T, name string) {
|
||||
if name != "devicemapper" && name != "overlay" && name != "vfs" && name != "zfs" && name != "btrfs" && name != "aufs" {
|
||||
c.Fatalf("%v is not a valid graph driver name", name)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectImage(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectImage(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
imageTest := "emptyfs"
|
||||
// It is important that this ID remain stable. If a code change causes
|
||||
|
@ -35,13 +47,13 @@ func (s *DockerSuite) TestInspectImage(c *testing.T) {
|
|||
assert.Equal(c, id, imageTestID)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectInt64(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectInt64(c *testing.T) {
|
||||
dockerCmd(c, "run", "-d", "-m=300M", "--name", "inspectTest", "busybox", "true")
|
||||
inspectOut := inspectField(c, "inspectTest", "HostConfig.Memory")
|
||||
assert.Equal(c, inspectOut, "314572800")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectDefault(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectDefault(c *testing.T) {
|
||||
// Both the container and image are named busybox. docker inspect will fetch the container JSON.
|
||||
// If the container JSON is not available, it will go for the image JSON.
|
||||
|
||||
|
@ -52,7 +64,7 @@ func (s *DockerSuite) TestInspectDefault(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(inspectOut), containerID)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectStatus(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectStatus(c *testing.T) {
|
||||
out := runSleepingContainer(c, "-d")
|
||||
out = strings.TrimSpace(out)
|
||||
|
||||
|
@ -77,7 +89,7 @@ func (s *DockerSuite) TestInspectStatus(c *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectTypeFlagContainer(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectTypeFlagContainer(c *testing.T) {
|
||||
// Both the container and image are named busybox. docker inspect will fetch container
|
||||
// JSON State.Running field. If the field is true, it's a container.
|
||||
runSleepingContainer(c, "--name=busybox", "-d")
|
||||
|
@ -87,7 +99,7 @@ func (s *DockerSuite) TestInspectTypeFlagContainer(c *testing.T) {
|
|||
assert.Equal(c, out, "true\n") // not a container JSON
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectTypeFlagWithNoContainer(c *testing.T) {
|
||||
// Run this test on an image named busybox. docker inspect will try to fetch container
|
||||
// JSON. Since there is no container named busybox and --type=container, docker inspect will
|
||||
// not try to get the image JSON. It will throw an error.
|
||||
|
@ -99,7 +111,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *testing.T) {
|
|||
assert.ErrorContains(c, err, "")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectTypeFlagWithImage(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectTypeFlagWithImage(c *testing.T) {
|
||||
// Both the container and image are named busybox. docker inspect will fetch image
|
||||
// JSON as --type=image. if there is no image with name busybox, docker inspect
|
||||
// will throw an error.
|
||||
|
@ -111,7 +123,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithImage(c *testing.T) {
|
|||
assert.Assert(c, !strings.Contains(out, "State"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectTypeFlagWithInvalidValue(c *testing.T) {
|
||||
// Both the container and image are named busybox. docker inspect will fail
|
||||
// as --type=foobar is not a valid value for the flag.
|
||||
|
||||
|
@ -123,7 +135,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "not a valid value for --type"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectImageFilterInt(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectImageFilterInt(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
imageTest := "emptyfs"
|
||||
out := inspectField(c, imageTest, "Size")
|
||||
|
@ -139,7 +151,7 @@ func (s *DockerSuite) TestInspectImageFilterInt(c *testing.T) {
|
|||
assert.Equal(c, result, true)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectContainerFilterInt(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectContainerFilterInt(c *testing.T) {
|
||||
result := icmd.RunCmd(icmd.Cmd{
|
||||
Command: []string{dockerBinary, "run", "-i", "-a", "stdin", "busybox", "cat"},
|
||||
Stdin: strings.NewReader("blahblah"),
|
||||
|
@ -161,7 +173,7 @@ func (s *DockerSuite) TestInspectContainerFilterInt(c *testing.T) {
|
|||
assert.Equal(c, inspectResult, true)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectImageGraphDriver(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectImageGraphDriver(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, Devicemapper)
|
||||
imageTest := "emptyfs"
|
||||
name := inspectField(c, imageTest, "GraphDriver.Name")
|
||||
|
@ -179,7 +191,7 @@ func (s *DockerSuite) TestInspectImageGraphDriver(c *testing.T) {
|
|||
assert.Assert(c, err == nil, "failed to inspect DeviceSize of the image: %s, %v", deviceSize, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectContainerGraphDriver(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectContainerGraphDriver(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, Devicemapper)
|
||||
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
||||
|
@ -204,7 +216,7 @@ func (s *DockerSuite) TestInspectContainerGraphDriver(c *testing.T) {
|
|||
assert.Assert(c, err == nil, "failed to inspect DeviceSize of the image: %s, %v", deviceSize, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectBindMountPoint(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectBindMountPoint(c *testing.T) {
|
||||
modifier := ",z"
|
||||
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
||||
if testEnv.OSType == "windows" {
|
||||
|
@ -236,7 +248,7 @@ func (s *DockerSuite) TestInspectBindMountPoint(c *testing.T) {
|
|||
assert.Equal(c, m.RW, false)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectNamedMountPoint(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectNamedMountPoint(c *testing.T) {
|
||||
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
||||
|
||||
dockerCmd(c, "run", "-d", "--name", "test", "-v", "data:"+prefix+slash+"data", "busybox", "cat")
|
||||
|
@ -260,7 +272,7 @@ func (s *DockerSuite) TestInspectNamedMountPoint(c *testing.T) {
|
|||
}
|
||||
|
||||
// #14947
|
||||
func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectTimesAsRFC3339Nano(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
||||
id := strings.TrimSpace(out)
|
||||
startedAt := inspectField(c, id, "State.StartedAt")
|
||||
|
@ -281,7 +293,7 @@ func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *testing.T) {
|
|||
}
|
||||
|
||||
// #15633
|
||||
func (s *DockerSuite) TestInspectLogConfigNoType(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectLogConfigNoType(c *testing.T) {
|
||||
dockerCmd(c, "create", "--name=test", "--log-opt", "max-file=42", "busybox")
|
||||
var logConfig container.LogConfig
|
||||
|
||||
|
@ -294,7 +306,7 @@ func (s *DockerSuite) TestInspectLogConfigNoType(c *testing.T) {
|
|||
assert.Equal(c, logConfig.Config["max-file"], "42", fmt.Sprintf("%v", logConfig))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectNoSizeFlagContainer(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectNoSizeFlagContainer(c *testing.T) {
|
||||
// Both the container and image are named busybox. docker inspect will fetch container
|
||||
// JSON SizeRw and SizeRootFs field. If there is no flag --size/-s, there are no size fields.
|
||||
|
||||
|
@ -305,7 +317,7 @@ func (s *DockerSuite) TestInspectNoSizeFlagContainer(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), "<nil>,<nil>", fmt.Sprintf("Expected not to display size info: %s", out))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectSizeFlagContainer(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectSizeFlagContainer(c *testing.T) {
|
||||
runSleepingContainer(c, "--name=busybox", "-d")
|
||||
|
||||
formatStr := "--format='{{.SizeRw}},{{.SizeRootFs}}'"
|
||||
|
@ -316,7 +328,7 @@ func (s *DockerSuite) TestInspectSizeFlagContainer(c *testing.T) {
|
|||
assert.Assert(c, strings.TrimSpace(sz[1]) != "<nil>")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectTemplateError(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectTemplateError(c *testing.T) {
|
||||
// Template parsing error for both the container and image.
|
||||
|
||||
runSleepingContainer(c, "--name=container1", "-d")
|
||||
|
@ -329,7 +341,7 @@ func (s *DockerSuite) TestInspectTemplateError(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "Template parsing error"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectJSONFields(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectJSONFields(c *testing.T) {
|
||||
runSleepingContainer(c, "--name=busybox", "-d")
|
||||
out, _, err := dockerCmdWithError("inspect", "--type=container", "--format={{.HostConfig.Dns}}", "busybox")
|
||||
|
||||
|
@ -337,7 +349,7 @@ func (s *DockerSuite) TestInspectJSONFields(c *testing.T) {
|
|||
assert.Equal(c, out, "[]\n")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectByPrefix(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectByPrefix(c *testing.T) {
|
||||
id := inspectField(c, "busybox", "Id")
|
||||
assert.Assert(c, strings.HasPrefix(id, "sha256:"))
|
||||
|
||||
|
@ -348,7 +360,7 @@ func (s *DockerSuite) TestInspectByPrefix(c *testing.T) {
|
|||
assert.Equal(c, id, id3)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectStopWhenNotFound(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectStopWhenNotFound(c *testing.T) {
|
||||
runSleepingContainer(c, "--name=busybox1", "-d")
|
||||
runSleepingContainer(c, "--name=busybox2", "-d")
|
||||
result := dockerCmdWithResult("inspect", "--type=container", "--format='{{.Name}}'", "busybox1", "busybox2", "missing")
|
||||
|
@ -366,7 +378,7 @@ func (s *DockerSuite) TestInspectStopWhenNotFound(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(result.Stderr(), "Error: No such container: missing"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectHistory(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectHistory(c *testing.T) {
|
||||
dockerCmd(c, "run", "--name=testcont", "busybox", "echo", "hello")
|
||||
dockerCmd(c, "commit", "-m", "test comment", "testcont", "testimg")
|
||||
out, _, err := dockerCmdWithError("inspect", "--format='{{.Comment}}'", "testimg")
|
||||
|
@ -374,7 +386,7 @@ func (s *DockerSuite) TestInspectHistory(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "test comment"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectContainerNetworkDefault(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectContainerNetworkDefault(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
contName := "test1"
|
||||
|
@ -386,7 +398,7 @@ func (s *DockerSuite) TestInspectContainerNetworkDefault(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), strings.TrimSpace(netOut))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectContainerNetworkCustom(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectContainerNetworkCustom(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
netOut, _ := dockerCmd(c, "network", "create", "net1")
|
||||
|
@ -397,7 +409,7 @@ func (s *DockerSuite) TestInspectContainerNetworkCustom(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), strings.TrimSpace(netOut))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectRootFS(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectRootFS(c *testing.T) {
|
||||
out, _, err := dockerCmdWithError("inspect", "busybox")
|
||||
assert.NilError(c, err)
|
||||
|
||||
|
@ -407,7 +419,7 @@ func (s *DockerSuite) TestInspectRootFS(c *testing.T) {
|
|||
assert.Assert(c, len(imageJSON[0].RootFS.Layers) >= 1)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectAmpersand(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectAmpersand(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
name := "test"
|
||||
|
@ -417,7 +429,7 @@ func (s *DockerSuite) TestInspectAmpersand(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, `soanni&rtr`))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectPlugin(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectPlugin(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, IsAmd64, Network)
|
||||
_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag)
|
||||
assert.NilError(c, err)
|
||||
|
@ -448,7 +460,7 @@ func (s *DockerSuite) TestInspectPlugin(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test case for 29185
|
||||
func (s *DockerSuite) TestInspectUnknownObject(c *testing.T) {
|
||||
func (s *DockerCLIInspectSuite) TestInspectUnknownObject(c *testing.T) {
|
||||
// This test should work on both Windows and Linux
|
||||
out, _, err := dockerCmdWithError("inspect", "foobar")
|
||||
assert.ErrorContains(c, err, "")
|
||||
|
|
|
@ -13,7 +13,19 @@ import (
|
|||
"gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *testing.T) {
|
||||
type DockerCLILinksSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLILinksSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLILinksSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLILinksSuite) TestLinksPingUnlinkedContainers(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
_, exitCode, err := dockerCmdWithError("run", "--rm", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1")
|
||||
|
||||
|
@ -22,7 +34,7 @@ func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test for appropriate error when calling --link with an invalid target container
|
||||
func (s *DockerSuite) TestLinksInvalidContainerTarget(c *testing.T) {
|
||||
func (s *DockerCLILinksSuite) TestLinksInvalidContainerTarget(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _, err := dockerCmdWithError("run", "--link", "bogus:alias", "busybox", "true")
|
||||
|
||||
|
@ -34,7 +46,7 @@ func (s *DockerSuite) TestLinksInvalidContainerTarget(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(strings.ToLower(out), "could not get container"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksPingLinkedContainers(c *testing.T) {
|
||||
func (s *DockerCLILinksSuite) TestLinksPingLinkedContainers(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
// Test with the three different ways of specifying the default network on Linux
|
||||
testLinkPingOnNetwork(c, "")
|
||||
|
@ -78,7 +90,7 @@ func testLinkPingOnNetwork(c *testing.T, network string) {
|
|||
dockerCmd(c, "rm", "-f", "container2")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksPingLinkedContainersAfterRename(c *testing.T) {
|
||||
func (s *DockerCLILinksSuite) TestLinksPingLinkedContainersAfterRename(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top")
|
||||
idA := strings.TrimSpace(out)
|
||||
|
@ -91,7 +103,7 @@ func (s *DockerSuite) TestLinksPingLinkedContainersAfterRename(c *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksInspectLinksStarted(c *testing.T) {
|
||||
func (s *DockerCLILinksSuite) TestLinksInspectLinksStarted(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top")
|
||||
dockerCmd(c, "run", "-d", "--name", "container2", "busybox", "top")
|
||||
|
@ -110,7 +122,7 @@ func (s *DockerSuite) TestLinksInspectLinksStarted(c *testing.T) {
|
|||
assert.DeepEqual(c, result, expected)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksInspectLinksStopped(c *testing.T) {
|
||||
func (s *DockerCLILinksSuite) TestLinksInspectLinksStopped(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top")
|
||||
|
@ -130,7 +142,7 @@ func (s *DockerSuite) TestLinksInspectLinksStopped(c *testing.T) {
|
|||
assert.DeepEqual(c, result, expected)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksNotStartedParentNotFail(c *testing.T) {
|
||||
func (s *DockerCLILinksSuite) TestLinksNotStartedParentNotFail(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "create", "--name=first", "busybox", "top")
|
||||
dockerCmd(c, "create", "--name=second", "--link=first:first", "busybox", "top")
|
||||
|
@ -138,7 +150,7 @@ func (s *DockerSuite) TestLinksNotStartedParentNotFail(c *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksHostsFilesInject(c *testing.T) {
|
||||
func (s *DockerCLILinksSuite) TestLinksHostsFilesInject(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, testEnv.IsLocalDaemon)
|
||||
|
||||
|
@ -156,7 +168,7 @@ func (s *DockerSuite) TestLinksHostsFilesInject(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(string(contentTwo), "onetwo"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksUpdateOnRestart(c *testing.T) {
|
||||
func (s *DockerCLILinksSuite) TestLinksUpdateOnRestart(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, testEnv.IsLocalDaemon)
|
||||
dockerCmd(c, "run", "-d", "--name", "one", "busybox", "top")
|
||||
|
@ -189,7 +201,7 @@ func (s *DockerSuite) TestLinksUpdateOnRestart(c *testing.T) {
|
|||
assert.Equal(c, ip, realIP)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksEnvs(c *testing.T) {
|
||||
func (s *DockerCLILinksSuite) TestLinksEnvs(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "-d", "-e", "e1=", "-e", "e2=v2", "-e", "e3=v3=v3", "--name=first", "busybox", "top")
|
||||
out, _ := dockerCmd(c, "run", "--name=second", "--link=first:first", "busybox", "env")
|
||||
|
@ -198,7 +210,7 @@ func (s *DockerSuite) TestLinksEnvs(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "FIRST_ENV_e3=v3=v3"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinkShortDefinition(c *testing.T) {
|
||||
func (s *DockerCLILinksSuite) TestLinkShortDefinition(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "--name", "shortlinkdef", "busybox", "top")
|
||||
|
||||
|
@ -214,7 +226,7 @@ func (s *DockerSuite) TestLinkShortDefinition(c *testing.T) {
|
|||
assert.Equal(c, links, "[\"/shortlinkdef:/link2/shortlinkdef\"]")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksNetworkHostContainer(c *testing.T) {
|
||||
func (s *DockerCLILinksSuite) TestLinksNetworkHostContainer(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
dockerCmd(c, "run", "-d", "--net", "host", "--name", "host_container", "busybox", "top")
|
||||
out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true")
|
||||
|
@ -225,14 +237,14 @@ func (s *DockerSuite) TestLinksNetworkHostContainer(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, runconfig.ErrConflictHostNetworkAndLinks.Error()))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *testing.T) {
|
||||
func (s *DockerCLILinksSuite) TestLinksEtcHostsRegularFile(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts")
|
||||
// /etc/hosts should be a regular file
|
||||
assert.Assert(c, cmp.Regexp("^-.+\n$", out))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksMultipleWithSameName(c *testing.T) {
|
||||
func (s *DockerCLILinksSuite) TestLinksMultipleWithSameName(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "-d", "--name=upstream-a", "busybox", "top")
|
||||
dockerCmd(c, "run", "-d", "--name=upstream-b", "busybox", "top")
|
||||
|
|
|
@ -9,7 +9,19 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestLoginWithoutTTY(c *testing.T) {
|
||||
type DockerCLILoginSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLILoginSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLILoginSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLILoginSuite) TestLoginWithoutTTY(c *testing.T) {
|
||||
cmd := exec.Command(dockerBinary, "login")
|
||||
|
||||
// Send to stdin so the process does not get the TTY
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) BenchmarkLogsCLIRotateFollow(c *testing.B) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "--log-opt", "max-size=1b", "--log-opt", "max-file=10", "busybox", "sh", "-c", "while true; do usleep 50000; echo hello; done")
|
||||
id := strings.TrimSpace(out)
|
||||
ch := make(chan error, 1)
|
||||
go func() {
|
||||
ch <- nil
|
||||
out, _, _ := dockerCmdWithError("logs", "-f", id)
|
||||
// if this returns at all, it's an error
|
||||
ch <- fmt.Errorf(out)
|
||||
}()
|
||||
|
||||
<-ch
|
||||
select {
|
||||
case <-time.After(30 * time.Second):
|
||||
// ran for 30 seconds with no problem
|
||||
return
|
||||
case err := <-ch:
|
||||
if err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,18 +15,30 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
type DockerCLILogsSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLILogsSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLILogsSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
// This used to work, it test a log of PageSize-1 (gh#4851)
|
||||
func (s *DockerSuite) TestLogsContainerSmallerThanPage(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsContainerSmallerThanPage(c *testing.T) {
|
||||
testLogsContainerPagination(c, 32767)
|
||||
}
|
||||
|
||||
// Regression test: When going over the PageSize, it used to panic (gh#4851)
|
||||
func (s *DockerSuite) TestLogsContainerBiggerThanPage(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsContainerBiggerThanPage(c *testing.T) {
|
||||
testLogsContainerPagination(c, 32768)
|
||||
}
|
||||
|
||||
// Regression test: When going much over the PageSize, it used to block (gh#4851)
|
||||
func (s *DockerSuite) TestLogsContainerMuchBiggerThanPage(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsContainerMuchBiggerThanPage(c *testing.T) {
|
||||
testLogsContainerPagination(c, 33000)
|
||||
}
|
||||
|
||||
|
@ -38,7 +50,7 @@ func testLogsContainerPagination(c *testing.T, testLen int) {
|
|||
assert.Equal(c, len(out), testLen+1)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsTimestamps(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsTimestamps(c *testing.T) {
|
||||
testLen := 100
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo = >> a.a; done; cat a.a", testLen))
|
||||
|
||||
|
@ -63,7 +75,7 @@ func (s *DockerSuite) TestLogsTimestamps(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsSeparateStderr(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsSeparateStderr(c *testing.T) {
|
||||
msg := "stderr_log"
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("echo %s 1>&2", msg)).Combined()
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -74,7 +86,7 @@ func (s *DockerSuite) TestLogsSeparateStderr(c *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsStderrInStdout(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsStderrInStdout(c *testing.T) {
|
||||
// TODO Windows: Needs investigation why this fails. Obtained string includes
|
||||
// a bunch of ANSI escape sequences before the "stderr_log" message.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
@ -89,7 +101,7 @@ func (s *DockerSuite) TestLogsStderrInStdout(c *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsTail(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsTail(c *testing.T) {
|
||||
testLen := 100
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen)).Combined()
|
||||
|
||||
|
@ -121,7 +133,7 @@ func (s *DockerSuite) TestLogsTail(c *testing.T) {
|
|||
assert.Equal(c, len(lines), testLen+1)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsFollowStopped(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsFollowStopped(c *testing.T) {
|
||||
dockerCmd(c, "run", "--name=test", "busybox", "echo", "hello")
|
||||
id := getIDByName(c, "test")
|
||||
|
||||
|
@ -142,7 +154,7 @@ func (s *DockerSuite) TestLogsFollowStopped(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsSince(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsSince(c *testing.T) {
|
||||
name := "testlogssince"
|
||||
dockerCmd(c, "run", "--name="+name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do sleep 2; echo log$i; done")
|
||||
out, _ := dockerCmd(c, "logs", "-t", name)
|
||||
|
@ -177,7 +189,7 @@ func (s *DockerSuite) TestLogsSince(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsSinceFutureFollow(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsSinceFutureFollow(c *testing.T) {
|
||||
// TODO Windows TP5 - Figure out why this test is so flakey. Disabled for now.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "testlogssincefuturefollow"
|
||||
|
@ -211,7 +223,7 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *testing.T) {
|
|||
}
|
||||
|
||||
// Regression test for #8832
|
||||
func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsFollowSlowStdoutConsumer(c *testing.T) {
|
||||
// TODO Windows: Fix this test for TP5.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
expected := 150000
|
||||
|
@ -269,7 +281,7 @@ func ConsumeWithSpeed(reader io.Reader, chunkSize int, interval time.Duration, s
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsFollowGoroutinesWithStdout(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 2; done")
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
|
@ -297,7 +309,7 @@ func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *testing.T) {
|
|||
assert.NilError(c, waitForGoroutines(nroutines))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsFollowGoroutinesNoOutput(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do sleep 2; done")
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
|
@ -315,14 +327,14 @@ func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *testing.T) {
|
|||
assert.NilError(c, waitForGoroutines(nroutines))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsCLIContainerNotFound(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsCLIContainerNotFound(c *testing.T) {
|
||||
name := "testlogsnocontainer"
|
||||
out, _, _ := dockerCmdWithError("logs", name)
|
||||
message := fmt.Sprintf("No such container: %s\n", name)
|
||||
assert.Assert(c, strings.Contains(out, message))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLogsWithDetails(c *testing.T) {
|
||||
func (s *DockerCLILogsSuite) TestLogsWithDetails(c *testing.T) {
|
||||
dockerCmd(c, "run", "--name=test", "--label", "foo=bar", "-e", "baz=qux", "--log-opt", "labels=foo", "--log-opt", "env=baz", "busybox", "echo", "hello")
|
||||
out, _ := dockerCmd(c, "logs", "--details", "--timestamps", "test")
|
||||
|
||||
|
|
|
@ -14,6 +14,18 @@ import (
|
|||
// the command executed in a container did really run PS correctly.
|
||||
const stringCheckPS = "PID USER"
|
||||
|
||||
type DockerCLINetmodeSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLINetmodeSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLINetmodeSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
// DockerCmdWithFail executes a docker command that is supposed to fail and returns
|
||||
// the output, the exit code. If the command returns a Nil error, it will fail and
|
||||
// stop the tests.
|
||||
|
@ -23,14 +35,14 @@ func dockerCmdWithFail(c *testing.T, args ...string) (string, int) {
|
|||
return out, status
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestNetHostnameWithNetHost(c *testing.T) {
|
||||
func (s *DockerCLINetmodeSuite) TestNetHostnameWithNetHost(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
|
||||
out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ps")
|
||||
assert.Assert(c, strings.Contains(out, stringCheckPS))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestNetHostname(c *testing.T) {
|
||||
func (s *DockerCLINetmodeSuite) TestNetHostname(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
out, _ := dockerCmd(c, "run", "-h=name", "busybox", "ps")
|
||||
|
@ -47,28 +59,28 @@ func (s *DockerSuite) TestNetHostname(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(strings.ToLower(out), "not found"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestConflictContainerNetworkAndLinks(c *testing.T) {
|
||||
func (s *DockerCLINetmodeSuite) TestConflictContainerNetworkAndLinks(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
out, _ := dockerCmdWithFail(c, "run", "--net=container:other", "--link=zip:zap", "busybox", "ps")
|
||||
assert.Assert(c, strings.Contains(out, runconfig.ErrConflictContainerNetworkAndLinks.Error()))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestConflictContainerNetworkHostAndLinks(c *testing.T) {
|
||||
func (s *DockerCLINetmodeSuite) TestConflictContainerNetworkHostAndLinks(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
|
||||
out, _ := dockerCmdWithFail(c, "run", "--net=host", "--link=zip:zap", "busybox", "ps")
|
||||
assert.Assert(c, strings.Contains(out, runconfig.ErrConflictHostNetworkAndLinks.Error()))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestConflictNetworkModeNetHostAndOptions(c *testing.T) {
|
||||
func (s *DockerCLINetmodeSuite) TestConflictNetworkModeNetHostAndOptions(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
|
||||
out, _ := dockerCmdWithFail(c, "run", "--net=host", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps")
|
||||
assert.Assert(c, strings.Contains(out, runconfig.ErrConflictContainerNetworkAndMac.Error()))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestConflictNetworkModeAndOptions(c *testing.T) {
|
||||
func (s *DockerCLINetmodeSuite) TestConflictNetworkModeAndOptions(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
out, _ := dockerCmdWithFail(c, "run", "--net=container:other", "--dns=8.8.8.8", "busybox", "ps")
|
||||
|
|
|
@ -2,10 +2,23 @@ package main
|
|||
|
||||
import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/integration-cli/daemon"
|
||||
)
|
||||
|
||||
type DockerCLINetworkSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLINetworkSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLINetworkSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
type DockerNetworkSuite struct {
|
||||
server *httptest.Server
|
||||
ds *DockerSuite
|
||||
|
|
|
@ -383,12 +383,12 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreateLabel(c *testing.T) {
|
|||
assertNwNotAvailable(c, testNet)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDockerNetworkDeleteNotExists(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestDockerNetworkDeleteNotExists(c *testing.T) {
|
||||
out, _, err := dockerCmdWithError("network", "rm", "test")
|
||||
assert.ErrorContains(c, err, "", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestDockerNetworkDeleteMultiple(c *testing.T) {
|
||||
dockerCmd(c, "network", "create", "testDelMulti0")
|
||||
assertNwIsAvailable(c, "testDelMulti0")
|
||||
dockerCmd(c, "network", "create", "testDelMulti1")
|
||||
|
@ -412,7 +412,7 @@ func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *testing.T) {
|
|||
assertNwIsAvailable(c, "testDelMulti2")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDockerNetworkInspect(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestDockerNetworkInspect(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "network", "inspect", "host")
|
||||
var networkResources []types.NetworkResource
|
||||
err := json.Unmarshal([]byte(out), &networkResources)
|
||||
|
@ -423,7 +423,7 @@ func (s *DockerSuite) TestDockerNetworkInspect(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), "host")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDockerNetworkInspectWithID(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestDockerNetworkInspectWithID(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "network", "create", "test2")
|
||||
networkID := strings.TrimSpace(out)
|
||||
assertNwIsAvailable(c, "test2")
|
||||
|
@ -434,7 +434,7 @@ func (s *DockerSuite) TestDockerNetworkInspectWithID(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), networkID)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestDockerInspectMultipleNetwork(c *testing.T) {
|
||||
result := dockerCmdWithResult("network", "inspect", "host", "none")
|
||||
result.Assert(c, icmd.Success)
|
||||
|
||||
|
@ -444,7 +444,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *testing.T) {
|
|||
assert.Equal(c, len(networkResources), 2)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *testing.T) {
|
||||
// non-existent network was not at the beginning of the inspect list
|
||||
// This should print an error, return an exitCode 1 and print the host network
|
||||
result := dockerCmdWithResult("network", "inspect", "host", "nonexistent")
|
||||
|
@ -483,7 +483,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *t
|
|||
assert.Equal(c, len(networkResources), 1)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestDockerInspectNetworkWithContainerName(c *testing.T) {
|
||||
dockerCmd(c, "network", "create", "brNetForInspect")
|
||||
assertNwIsAvailable(c, "brNetForInspect")
|
||||
defer func() {
|
||||
|
@ -999,7 +999,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkMacInspect(c *testing.T) {
|
|||
assert.Equal(c, mac, "a0:b1:c2:d3:e4:f5")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectAPIMultipleNetworks(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestInspectAPIMultipleNetworks(c *testing.T) {
|
||||
dockerCmd(c, "network", "create", "mybridge1")
|
||||
dockerCmd(c, "network", "create", "mybridge2")
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
|
@ -1418,7 +1418,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectLinkLocalIP(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectLink(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestUserDefinedNetworkConnectDisconnectLink(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm)
|
||||
dockerCmd(c, "network", "create", "-d", "bridge", "foo1")
|
||||
dockerCmd(c, "network", "create", "-d", "bridge", "foo2")
|
||||
|
@ -1492,7 +1492,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectWithAliasOnDefaultNetworks(
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm)
|
||||
dockerCmd(c, "network", "create", "-d", "bridge", "net1")
|
||||
dockerCmd(c, "network", "create", "-d", "bridge", "net2")
|
||||
|
@ -1546,7 +1546,7 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *testing.T)
|
|||
assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndAlias.Error()))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUserDefinedNetworkConnectivity(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestUserDefinedNetworkConnectivity(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
dockerCmd(c, "network", "create", "-d", "bridge", "br.net1")
|
||||
|
||||
|
@ -1569,7 +1569,7 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectivity(c *testing.T) {
|
|||
assert.ErrorContains(c, err, "")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestEmbeddedDNSInvalidInput(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestEmbeddedDNSInvalidInput(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
dockerCmd(c, "network", "create", "-d", "bridge", "nw1")
|
||||
|
||||
|
@ -1577,7 +1577,7 @@ func (s *DockerSuite) TestEmbeddedDNSInvalidInput(c *testing.T) {
|
|||
dockerCmd(c, "run", "-i", "--net=nw1", "--name=c1", "debian:bullseye-slim", "bash", "-c", "echo InvalidQuery > /dev/udp/127.0.0.11/53")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDockerNetworkConnectFailsNoInspectChange(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestDockerNetworkConnectFailsNoInspectChange(c *testing.T) {
|
||||
dockerCmd(c, "run", "-d", "--name=bb", "busybox", "top")
|
||||
assert.Assert(c, waitRun("bb") == nil)
|
||||
defer dockerCmd(c, "stop", "bb")
|
||||
|
@ -1592,7 +1592,7 @@ func (s *DockerSuite) TestDockerNetworkConnectFailsNoInspectChange(c *testing.T)
|
|||
assert.Equal(c, ns1, ns0)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDockerNetworkInternalMode(c *testing.T) {
|
||||
func (s *DockerCLINetworkSuite) TestDockerNetworkInternalMode(c *testing.T) {
|
||||
dockerCmd(c, "network", "create", "--driver=bridge", "--internal", "internal")
|
||||
assertNwIsAvailable(c, "internal")
|
||||
nr := getNetworkResource(c, "internal")
|
||||
|
|
|
@ -9,7 +9,19 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestPluginLogDriver(c *testing.T) {
|
||||
type DockerCLIPluginLogDriverSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIPluginLogDriverSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIPluginLogDriverSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIPluginLogDriverSuite) TestPluginLogDriver(c *testing.T) {
|
||||
testRequires(c, IsAmd64, DaemonIsLinux)
|
||||
|
||||
pluginName := "cpuguy83/docker-logdriver-test:latest"
|
||||
|
@ -29,7 +41,7 @@ func (s *DockerSuite) TestPluginLogDriver(c *testing.T) {
|
|||
}
|
||||
|
||||
// Make sure log drivers are listed in info, and v2 plugins are not.
|
||||
func (s *DockerSuite) TestPluginLogDriverInfoList(c *testing.T) {
|
||||
func (s *DockerCLIPluginLogDriverSuite) TestPluginLogDriverInfoList(c *testing.T) {
|
||||
testRequires(c, IsAmd64, DaemonIsLinux)
|
||||
pluginName := "cpuguy83/docker-logdriver-test"
|
||||
|
||||
|
|
|
@ -28,6 +28,18 @@ var (
|
|||
npNameWithTag = npName + ":" + pTag
|
||||
)
|
||||
|
||||
type DockerCLIPluginsSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIPluginsSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIPluginsSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (ps *DockerPluginSuite) TestPluginBasicOps(c *testing.T) {
|
||||
plugin := ps.getPluginRepoWithTag()
|
||||
_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", plugin)
|
||||
|
@ -69,7 +81,7 @@ func (ps *DockerPluginSuite) TestPluginForceRemove(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, pNameWithTag))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPluginActive(c *testing.T) {
|
||||
func (s *DockerCLIPluginsSuite) TestPluginActive(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, IsAmd64, Network)
|
||||
|
||||
_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag)
|
||||
|
@ -91,7 +103,7 @@ func (s *DockerSuite) TestPluginActive(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, pNameWithTag))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPluginActiveNetwork(c *testing.T) {
|
||||
func (s *DockerCLIPluginsSuite) TestPluginActiveNetwork(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, IsAmd64, Network)
|
||||
_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", npNameWithTag)
|
||||
assert.NilError(c, err)
|
||||
|
@ -136,7 +148,7 @@ func (ps *DockerPluginSuite) TestPluginInstallDisable(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(strings.TrimSpace(out), pName))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPluginInstallDisableVolumeLs(c *testing.T) {
|
||||
func (s *DockerCLIPluginsSuite) TestPluginInstallDisableVolumeLs(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, IsAmd64, Network)
|
||||
out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", pName)
|
||||
assert.NilError(c, err)
|
||||
|
@ -316,7 +328,7 @@ func (ps *DockerPluginSuite) TestPluginInspect(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test case for https://github.com/docker/docker/pull/29186#discussion_r91277345
|
||||
func (s *DockerSuite) TestPluginInspectOnWindows(c *testing.T) {
|
||||
func (s *DockerCLIPluginsSuite) TestPluginInspectOnWindows(c *testing.T) {
|
||||
// This test should work on Windows only
|
||||
testRequires(c, DaemonIsWindows)
|
||||
|
||||
|
@ -411,7 +423,7 @@ enabled: false`, id, name)
|
|||
assert.Assert(c, strings.Contains(strings.TrimSpace(out), expectedOutput))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPluginUpgrade(c *testing.T) {
|
||||
func (s *DockerCLIPluginsSuite) TestPluginUpgrade(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, Network, testEnv.IsLocalDaemon, IsAmd64, NotUserNamespace)
|
||||
plugin := "cpuguy83/docker-volume-driver-plugin-local:latest"
|
||||
pluginV2 := "cpuguy83/docker-volume-driver-plugin-local:v2"
|
||||
|
@ -442,7 +454,7 @@ func (s *DockerSuite) TestPluginUpgrade(c *testing.T) {
|
|||
dockerCmd(c, "run", "--rm", "-v", "bananas:/apple", "busybox", "sh", "-c", "ls -lh /apple/core")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPluginMetricsCollector(c *testing.T) {
|
||||
func (s *DockerCLIPluginsSuite) TestPluginMetricsCollector(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, Network, testEnv.IsLocalDaemon, IsAmd64)
|
||||
d := daemon.New(c, dockerBinary, dockerdBinary)
|
||||
d.Start(c)
|
||||
|
|
|
@ -12,7 +12,19 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestPortList(c *testing.T) {
|
||||
type DockerCLIPortSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIPortSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIPortSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIPortSuite) TestPortList(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
// one port
|
||||
out, _ := dockerCmd(c, "run", "-d", "-p", "9876:80", "busybox", "top")
|
||||
|
@ -241,7 +253,7 @@ func stopRemoveContainer(id string, c *testing.T) {
|
|||
dockerCmd(c, "rm", "-f", id)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *testing.T) {
|
||||
func (s *DockerCLIPortSuite) TestUnpublishedPortsInPsOutput(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
// Run busybox with command line expose (equivalent to EXPOSE in image's Dockerfile) for the following ports
|
||||
port1 := 80
|
||||
|
@ -312,7 +324,7 @@ func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, expBnd2))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPortHostBinding(c *testing.T) {
|
||||
func (s *DockerCLIPortSuite) TestPortHostBinding(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
out, _ := dockerCmd(c, "run", "-d", "-p", "9876:80", "busybox", "nc", "-l", "-p", "80")
|
||||
firstID := strings.TrimSpace(out)
|
||||
|
@ -332,7 +344,7 @@ func (s *DockerSuite) TestPortHostBinding(c *testing.T) {
|
|||
assert.Assert(c, err != nil, "out: %s", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPortExposeHostBinding(c *testing.T) {
|
||||
func (s *DockerCLIPortSuite) TestPortExposeHostBinding(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
out, _ := dockerCmd(c, "run", "-d", "-P", "--expose", "80", "busybox", "nc", "-l", "-p", "80")
|
||||
firstID := strings.TrimSpace(out)
|
||||
|
@ -349,7 +361,7 @@ func (s *DockerSuite) TestPortExposeHostBinding(c *testing.T) {
|
|||
assert.Assert(c, err != nil, "out: %s", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPortBindingOnSandbox(c *testing.T) {
|
||||
func (s *DockerCLIPortSuite) TestPortBindingOnSandbox(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
dockerCmd(c, "network", "create", "--internal", "-d", "bridge", "internal-net")
|
||||
nr := getNetworkResource(c, "internal-net")
|
||||
|
|
|
@ -9,7 +9,19 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestCLIProxyDisableProxyUnixSock(c *testing.T) {
|
||||
type DockerCLIProxySuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIProxySuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIProxySuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIProxySuite) TestCLIProxyDisableProxyUnixSock(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
|
||||
icmd.RunCmd(icmd.Cmd{
|
||||
|
|
5
integration-cli/docker_cli_prune_test.go
Normal file
5
integration-cli/docker_cli_prune_test.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package main
|
||||
|
||||
type DockerCLIPruneSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
|
@ -20,6 +20,14 @@ import (
|
|||
"gotest.tools/v3/poll"
|
||||
)
|
||||
|
||||
func (s *DockerCLIPruneSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIPruneSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func pruneNetworkAndVerify(c *testing.T, d *daemon.Daemon, kept, pruned []string) {
|
||||
_, err := d.Cmd("network", "prune", "--force")
|
||||
assert.NilError(c, err)
|
||||
|
@ -109,7 +117,7 @@ func (s *DockerDaemonSuite) TestPruneImageDangling(c *testing.T) {
|
|||
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPruneContainerUntil(c *testing.T) {
|
||||
func (s *DockerCLIPruneSuite) TestPruneContainerUntil(c *testing.T) {
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox").Combined()
|
||||
id1 := strings.TrimSpace(out)
|
||||
cli.WaitExited(c, id1, 5*time.Second)
|
||||
|
@ -128,7 +136,7 @@ func (s *DockerSuite) TestPruneContainerUntil(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(strings.TrimSpace(out), id2))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPruneContainerLabel(c *testing.T) {
|
||||
func (s *DockerCLIPruneSuite) TestPruneContainerLabel(c *testing.T) {
|
||||
out := cli.DockerCmd(c, "run", "-d", "--label", "foo", "busybox").Combined()
|
||||
id1 := strings.TrimSpace(out)
|
||||
cli.WaitExited(c, id1, 5*time.Second)
|
||||
|
@ -180,7 +188,7 @@ func (s *DockerSuite) TestPruneContainerLabel(c *testing.T) {
|
|||
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id2))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPruneVolumeLabel(c *testing.T) {
|
||||
func (s *DockerCLIPruneSuite) TestPruneVolumeLabel(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "volume", "create", "--label", "foo")
|
||||
id1 := strings.TrimSpace(out)
|
||||
assert.Assert(c, id1 != "")
|
||||
|
@ -232,7 +240,7 @@ func (s *DockerSuite) TestPruneVolumeLabel(c *testing.T) {
|
|||
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id2))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPruneNetworkLabel(c *testing.T) {
|
||||
func (s *DockerCLIPruneSuite) TestPruneNetworkLabel(c *testing.T) {
|
||||
dockerCmd(c, "network", "create", "--label", "foo", "n1")
|
||||
dockerCmd(c, "network", "create", "--label", "bar", "n2")
|
||||
dockerCmd(c, "network", "create", "n3")
|
||||
|
|
|
@ -18,7 +18,19 @@ import (
|
|||
"gotest.tools/v3/skip"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestPsListContainersBase(c *testing.T) {
|
||||
type DockerCLIPsSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIPsSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIPsSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIPsSuite) TestPsListContainersBase(c *testing.T) {
|
||||
existingContainers := ExistingContainerIDs(c)
|
||||
|
||||
out := runSleepingContainer(c, "-d")
|
||||
|
@ -139,7 +151,7 @@ func assertContainerList(out string, expected []string) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsListContainersSize(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsListContainersSize(c *testing.T) {
|
||||
// Problematic on Windows as it doesn't report the size correctly @swernli
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "-d", "busybox")
|
||||
|
@ -179,7 +191,7 @@ func (s *DockerSuite) TestPsListContainersSize(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(foundSize, expectedSize), "Expected size %q, got %q", expectedSize, foundSize)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsListContainersFilterStatus(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsListContainersFilterStatus(c *testing.T) {
|
||||
existingContainers := ExistingContainerIDs(c)
|
||||
|
||||
// start exited container
|
||||
|
@ -226,7 +238,7 @@ func (s *DockerSuite) TestPsListContainersFilterStatus(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsListContainersFilterHealth(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsListContainersFilterHealth(c *testing.T) {
|
||||
skip.If(c, RuntimeIsWindowsContainerd(), "FIXME. Hang on Windows + containerd combination")
|
||||
existingContainers := ExistingContainerIDs(c)
|
||||
// Test legacy no health check
|
||||
|
@ -270,7 +282,7 @@ func (s *DockerSuite) TestPsListContainersFilterHealth(c *testing.T) {
|
|||
assert.Equal(c, containerOut, containerID, fmt.Sprintf("Expected containerID %s, got %s for healthy filter, output: %q", containerID, containerOut, out))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsListContainersFilterID(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsListContainersFilterID(c *testing.T) {
|
||||
// start container
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox")
|
||||
firstID := strings.TrimSpace(out)
|
||||
|
@ -284,7 +296,7 @@ func (s *DockerSuite) TestPsListContainersFilterID(c *testing.T) {
|
|||
assert.Equal(c, containerOut, firstID[:12], fmt.Sprintf("Expected id %s, got %s for exited filter, output: %q", firstID[:12], containerOut, out))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsListContainersFilterName(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsListContainersFilterName(c *testing.T) {
|
||||
// start container
|
||||
dockerCmd(c, "run", "--name=a_name_to_match", "busybox")
|
||||
id := getIDByName(c, "a_name_to_match")
|
||||
|
@ -306,7 +318,7 @@ func (s *DockerSuite) TestPsListContainersFilterName(c *testing.T) {
|
|||
// - Create an image based on the previous image (images_ps_filter_test2)
|
||||
// - Run containers for each of those image (busybox, images_ps_filter_test1, images_ps_filter_test2)
|
||||
// - Filter them out :P
|
||||
func (s *DockerSuite) TestPsListContainersFilterAncestorImage(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsListContainersFilterAncestorImage(c *testing.T) {
|
||||
existingContainers := ExistingContainerIDs(c)
|
||||
|
||||
// Build images
|
||||
|
@ -401,7 +413,7 @@ func checkPsAncestorFilterOutput(c *testing.T, out string, filterName string, ex
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsListContainersFilterLabel(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsListContainersFilterLabel(c *testing.T) {
|
||||
// start container
|
||||
dockerCmd(c, "run", "--name=first", "-l", "match=me", "-l", "second=tag", "busybox")
|
||||
firstID := getIDByName(c, "first")
|
||||
|
@ -437,7 +449,7 @@ func (s *DockerSuite) TestPsListContainersFilterLabel(c *testing.T) {
|
|||
assert.Assert(c, !strings.Contains(containerOut, thirdID))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsListContainersFilterExited(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsListContainersFilterExited(c *testing.T) {
|
||||
// TODO Flaky on Windows CI [both RS1 and RS5]
|
||||
// On slower machines the container may not have exited
|
||||
// yet when we filter below by exit status/exit value.
|
||||
|
@ -468,7 +480,7 @@ func (s *DockerSuite) TestPsListContainersFilterExited(c *testing.T) {
|
|||
assert.Assert(c, !strings.Contains(out, strings.TrimSpace(secondZero)))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsRightTagName(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsRightTagName(c *testing.T) {
|
||||
// TODO Investigate further why this fails on Windows to Windows CI
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -514,7 +526,7 @@ func (s *DockerSuite) TestPsRightTagName(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsListContainersFilterCreated(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsListContainersFilterCreated(c *testing.T) {
|
||||
// create a container
|
||||
out, _ := dockerCmd(c, "create", "busybox")
|
||||
cID := strings.TrimSpace(out)
|
||||
|
@ -544,7 +556,7 @@ func (s *DockerSuite) TestPsListContainersFilterCreated(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test for GitHub issue #12595
|
||||
func (s *DockerSuite) TestPsImageIDAfterUpdate(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsImageIDAfterUpdate(c *testing.T) {
|
||||
// TODO: Investigate why this fails on Windows to Windows CI further.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
originalImageName := "busybox:TestPsImageIDAfterUpdate-original"
|
||||
|
@ -593,7 +605,7 @@ func (s *DockerSuite) TestPsImageIDAfterUpdate(c *testing.T) {
|
|||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsNotShowPortsOfStoppedContainer(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsNotShowPortsOfStoppedContainer(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "--name=foo", "-d", "-p", "6000:5000", "busybox", "top")
|
||||
assert.Assert(c, waitRun("foo") == nil)
|
||||
|
@ -607,7 +619,7 @@ func (s *DockerSuite) TestPsNotShowPortsOfStoppedContainer(c *testing.T) {
|
|||
assert.Equal(c, ports, "", "Should not got %v", expected)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsShowMounts(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsShowMounts(c *testing.T) {
|
||||
existingContainers := ExistingContainerNames(c)
|
||||
|
||||
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
||||
|
@ -707,7 +719,7 @@ func (s *DockerSuite) TestPsShowMounts(c *testing.T) {
|
|||
assert.Equal(c, len(strings.TrimSpace(out)), 0)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsListContainersFilterNetwork(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsListContainersFilterNetwork(c *testing.T) {
|
||||
existing := ExistingContainerIDs(c)
|
||||
|
||||
// TODO default network on Windows is not called "bridge", and creating a
|
||||
|
@ -784,7 +796,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(containerOut, "onbridgenetwork"), "Missing the container on network\n")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsByOrder(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsByOrder(c *testing.T) {
|
||||
out := runSleepingContainer(c, "--name", "xyz-abc")
|
||||
container1 := strings.TrimSpace(out)
|
||||
|
||||
|
@ -803,7 +815,7 @@ func (s *DockerSuite) TestPsByOrder(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), fmt.Sprintf("%s\n%s", container2, container1))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsListContainersFilterPorts(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsListContainersFilterPorts(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
existingContainers := ExistingContainerIDs(c)
|
||||
|
||||
|
@ -853,7 +865,7 @@ func (s *DockerSuite) TestPsListContainersFilterPorts(c *testing.T) {
|
|||
assert.Assert(c, strings.TrimSpace(out) != id3)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestPsNotShowLinknamesOfDeletedContainer(c *testing.T) {
|
||||
func (s *DockerCLIPsSuite) TestPsNotShowLinknamesOfDeletedContainer(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, MinimumAPIVersion("1.31"))
|
||||
existingContainers := ExistingContainerNames(c)
|
||||
|
||||
|
|
|
@ -13,6 +13,18 @@ import (
|
|||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
type DockerCLIPullSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIPullSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIPullSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
// TestPullFromCentralRegistry pulls an image from the central registry and verifies that the client
|
||||
// prints all expected output.
|
||||
func (s *DockerHubPullSuite) TestPullFromCentralRegistry(c *testing.T) {
|
||||
|
@ -263,14 +275,14 @@ func (s *DockerHubPullSuite) TestPullClientDisconnect(c *testing.T) {
|
|||
}
|
||||
|
||||
// Regression test for https://github.com/docker/docker/issues/26429
|
||||
func (s *DockerSuite) TestPullLinuxImageFailsOnWindows(c *testing.T) {
|
||||
func (s *DockerCLIPullSuite) TestPullLinuxImageFailsOnWindows(c *testing.T) {
|
||||
testRequires(c, DaemonIsWindows, Network)
|
||||
_, _, err := dockerCmdWithError("pull", "ubuntu")
|
||||
assert.ErrorContains(c, err, "no matching manifest for windows")
|
||||
}
|
||||
|
||||
// Regression test for https://github.com/docker/docker/issues/28892
|
||||
func (s *DockerSuite) TestPullWindowsImageFailsOnLinux(c *testing.T) {
|
||||
func (s *DockerCLIPullSuite) TestPullWindowsImageFailsOnLinux(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, Network)
|
||||
_, _, err := dockerCmdWithError("pull", "mcr.microsoft.com/windows/servercore:ltsc2019")
|
||||
assert.ErrorContains(c, err, "no matching manifest for linux")
|
||||
|
|
|
@ -17,6 +17,18 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
type DockerCLIPushSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIPushSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIPushSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerRegistrySuite) TestPushBusyboxImage(c *testing.T) {
|
||||
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
||||
// tag the image to upload it to the private registry
|
||||
|
@ -26,7 +38,7 @@ func (s *DockerRegistrySuite) TestPushBusyboxImage(c *testing.T) {
|
|||
}
|
||||
|
||||
// pushing an image without a prefix should throw an error
|
||||
func (s *DockerSuite) TestPushUnprefixedRepo(c *testing.T) {
|
||||
func (s *DockerCLIPushSuite) TestPushUnprefixedRepo(c *testing.T) {
|
||||
out, _, err := dockerCmdWithError("push", "busybox")
|
||||
assert.ErrorContains(c, err, "", "pushing an unprefixed repo didn't result in a non-zero exit status: %s", out)
|
||||
}
|
||||
|
@ -208,7 +220,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPushNoCredentialsNoRetry(c *testin
|
|||
}
|
||||
|
||||
// This may be flaky but it's needed not to regress on unauthorized push, see #21054
|
||||
func (s *DockerSuite) TestPushToCentralRegistryUnauthorized(c *testing.T) {
|
||||
func (s *DockerCLIPushSuite) TestPushToCentralRegistryUnauthorized(c *testing.T) {
|
||||
testRequires(c, Network)
|
||||
repoName := "test/busybox"
|
||||
dockerCmd(c, "tag", "busybox", repoName)
|
||||
|
|
|
@ -14,7 +14,19 @@ import (
|
|||
"gotest.tools/v3/skip"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestRestartStoppedContainer(c *testing.T) {
|
||||
type DockerCLIRestartSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIRestartSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIRestartSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIRestartSuite) TestRestartStoppedContainer(c *testing.T) {
|
||||
dockerCmd(c, "run", "--name=test", "busybox", "echo", "foobar")
|
||||
cleanedContainerID := getIDByName(c, "test")
|
||||
|
||||
|
@ -31,7 +43,7 @@ func (s *DockerSuite) TestRestartStoppedContainer(c *testing.T) {
|
|||
assert.Equal(c, out, "foobar\nfoobar\n")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRestartRunningContainer(c *testing.T) {
|
||||
func (s *DockerCLIRestartSuite) TestRestartRunningContainer(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", "echo foobar && sleep 30 && echo 'should not print this'")
|
||||
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
@ -54,7 +66,7 @@ func (s *DockerSuite) TestRestartRunningContainer(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test that restarting a container with a volume does not create a new volume on restart. Regression test for #819.
|
||||
func (s *DockerSuite) TestRestartWithVolumes(c *testing.T) {
|
||||
func (s *DockerCLIRestartSuite) TestRestartWithVolumes(c *testing.T) {
|
||||
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
||||
out := runSleepingContainer(c, "-d", "-v", prefix+slash+"test")
|
||||
|
||||
|
@ -79,7 +91,7 @@ func (s *DockerSuite) TestRestartWithVolumes(c *testing.T) {
|
|||
assert.Equal(c, source, sourceAfterRestart)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRestartDisconnectedContainer(c *testing.T) {
|
||||
func (s *DockerCLIRestartSuite) TestRestartDisconnectedContainer(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon, NotUserNamespace, NotArm)
|
||||
|
||||
// Run a container on the default bridge network
|
||||
|
@ -96,7 +108,7 @@ func (s *DockerSuite) TestRestartDisconnectedContainer(c *testing.T) {
|
|||
assert.Assert(c, exitCode == 0, out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRestartPolicyNO(c *testing.T) {
|
||||
func (s *DockerCLIRestartSuite) TestRestartPolicyNO(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "create", "--restart=no", "busybox")
|
||||
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -104,7 +116,7 @@ func (s *DockerSuite) TestRestartPolicyNO(c *testing.T) {
|
|||
assert.Equal(c, name, "no")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRestartPolicyAlways(c *testing.T) {
|
||||
func (s *DockerCLIRestartSuite) TestRestartPolicyAlways(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "create", "--restart=always", "busybox")
|
||||
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -117,7 +129,7 @@ func (s *DockerSuite) TestRestartPolicyAlways(c *testing.T) {
|
|||
assert.Equal(c, MaximumRetryCount, "0")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRestartPolicyOnFailure(c *testing.T) {
|
||||
func (s *DockerCLIRestartSuite) TestRestartPolicyOnFailure(c *testing.T) {
|
||||
out, _, err := dockerCmdWithError("create", "--restart=on-failure:-1", "busybox")
|
||||
assert.ErrorContains(c, err, "", out)
|
||||
assert.Assert(c, strings.Contains(out, "maximum retry count cannot be negative"))
|
||||
|
@ -152,7 +164,7 @@ func (s *DockerSuite) TestRestartPolicyOnFailure(c *testing.T) {
|
|||
|
||||
// a good container with --restart=on-failure:3
|
||||
// MaximumRetryCount!=0; RestartCount=0
|
||||
func (s *DockerSuite) TestRestartContainerwithGoodContainer(c *testing.T) {
|
||||
func (s *DockerCLIRestartSuite) TestRestartContainerwithGoodContainer(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "true")
|
||||
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -166,7 +178,7 @@ func (s *DockerSuite) TestRestartContainerwithGoodContainer(c *testing.T) {
|
|||
assert.Equal(c, MaximumRetryCount, "3")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRestartContainerSuccess(c *testing.T) {
|
||||
func (s *DockerCLIRestartSuite) TestRestartContainerSuccess(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon)
|
||||
// Skipped for Hyper-V isolated containers. Test is currently written
|
||||
// such that it assumes there is a host process to kill. In Hyper-V
|
||||
|
@ -199,7 +211,7 @@ func (s *DockerSuite) TestRestartContainerSuccess(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRestartWithPolicyUserDefinedNetwork(c *testing.T) {
|
||||
func (s *DockerCLIRestartSuite) TestRestartWithPolicyUserDefinedNetwork(c *testing.T) {
|
||||
// TODO Windows. This may be portable following HNS integration post TP5.
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon, NotUserNamespace, NotArm)
|
||||
dockerCmd(c, "network", "create", "-d", "bridge", "udNet")
|
||||
|
@ -243,7 +255,7 @@ func (s *DockerSuite) TestRestartWithPolicyUserDefinedNetwork(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRestartPolicyAfterRestart(c *testing.T) {
|
||||
func (s *DockerCLIRestartSuite) TestRestartPolicyAfterRestart(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon)
|
||||
// Skipped for Hyper-V isolated containers. Test is currently written
|
||||
// such that it assumes there is a host process to kill. In Hyper-V
|
||||
|
@ -280,7 +292,7 @@ func (s *DockerSuite) TestRestartPolicyAfterRestart(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *testing.T) {
|
||||
func (s *DockerCLIRestartSuite) TestRestartContainerwithRestartPolicy(c *testing.T) {
|
||||
out1, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "false")
|
||||
out2, _ := dockerCmd(c, "run", "-d", "--restart=always", "busybox", "false")
|
||||
|
||||
|
@ -311,7 +323,7 @@ func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRestartAutoRemoveContainer(c *testing.T) {
|
||||
func (s *DockerCLIRestartSuite) TestRestartAutoRemoveContainer(c *testing.T) {
|
||||
out := runSleepingContainer(c, "--rm")
|
||||
|
||||
id := strings.TrimSpace(out)
|
||||
|
|
|
@ -13,7 +13,19 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestRmiWithContainerFails(c *testing.T) {
|
||||
type DockerCLIRmiSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIRmiSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIRmiSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIRmiSuite) TestRmiWithContainerFails(c *testing.T) {
|
||||
errSubstr := "is using it"
|
||||
|
||||
// create a container
|
||||
|
@ -33,7 +45,7 @@ func (s *DockerSuite) TestRmiWithContainerFails(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(images, "busybox"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRmiTag(c *testing.T) {
|
||||
func (s *DockerCLIRmiSuite) TestRmiTag(c *testing.T) {
|
||||
imagesBefore, _ := dockerCmd(c, "images", "-a")
|
||||
dockerCmd(c, "tag", "busybox", "utest:tag1")
|
||||
dockerCmd(c, "tag", "busybox", "utest/docker:tag2")
|
||||
|
@ -61,7 +73,7 @@ func (s *DockerSuite) TestRmiTag(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRmiImgIDMultipleTag(c *testing.T) {
|
||||
func (s *DockerCLIRmiSuite) TestRmiImgIDMultipleTag(c *testing.T) {
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-one'").Combined()
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
||||
|
@ -102,7 +114,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *testing.T) {
|
|||
assert.Assert(c, !strings.Contains(imagesAfter, imgID[:12]), "ImageID:%q; ImagesAfter: %q", imgID, imagesAfter)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRmiImgIDForce(c *testing.T) {
|
||||
func (s *DockerCLIRmiSuite) TestRmiImgIDForce(c *testing.T) {
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-test'").Combined()
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
||||
|
@ -140,7 +152,7 @@ func (s *DockerSuite) TestRmiImgIDForce(c *testing.T) {
|
|||
}
|
||||
|
||||
// See https://github.com/docker/docker/issues/14116
|
||||
func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c *testing.T) {
|
||||
func (s *DockerCLIRmiSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c *testing.T) {
|
||||
dockerfile := "FROM busybox\nRUN echo test 14116\n"
|
||||
buildImageSuccessfully(c, "test-14116", build.WithDockerfile(dockerfile))
|
||||
imgID := getIDByName(c, "test-14116")
|
||||
|
@ -155,7 +167,7 @@ func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c
|
|||
assert.Assert(c, strings.Contains(out, "(cannot be forced) - image is being used by running container"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRmiTagWithExistingContainers(c *testing.T) {
|
||||
func (s *DockerCLIRmiSuite) TestRmiTagWithExistingContainers(c *testing.T) {
|
||||
container := "test-delete-tag"
|
||||
newtag := "busybox:newtag"
|
||||
bb := "busybox:latest"
|
||||
|
@ -167,7 +179,7 @@ func (s *DockerSuite) TestRmiTagWithExistingContainers(c *testing.T) {
|
|||
assert.Equal(c, strings.Count(out, "Untagged: "), 1)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRmiForceWithExistingContainers(c *testing.T) {
|
||||
func (s *DockerCLIRmiSuite) TestRmiForceWithExistingContainers(c *testing.T) {
|
||||
image := "busybox-clone"
|
||||
|
||||
icmd.RunCmd(icmd.Cmd{
|
||||
|
@ -181,7 +193,7 @@ MAINTAINER foo`),
|
|||
dockerCmd(c, "rmi", "-f", image)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRmiWithMultipleRepositories(c *testing.T) {
|
||||
func (s *DockerCLIRmiSuite) TestRmiWithMultipleRepositories(c *testing.T) {
|
||||
newRepo := "127.0.0.1:5000/busybox"
|
||||
oldRepo := "busybox"
|
||||
newTag := "busybox:test"
|
||||
|
@ -195,7 +207,7 @@ func (s *DockerSuite) TestRmiWithMultipleRepositories(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "Untagged: "+newTag))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *testing.T) {
|
||||
func (s *DockerCLIRmiSuite) TestRmiForceWithMultipleRepositories(c *testing.T) {
|
||||
imageName := "rmiimage"
|
||||
tag1 := imageName + ":tag1"
|
||||
tag2 := imageName + ":tag2"
|
||||
|
@ -212,7 +224,7 @@ func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(images, imageName), "Built image missing %q; Images: %q", imageName, images)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRmiBlank(c *testing.T) {
|
||||
func (s *DockerCLIRmiSuite) TestRmiBlank(c *testing.T) {
|
||||
out, _, err := dockerCmdWithError("rmi", " ")
|
||||
// Should have failed to delete ' ' image
|
||||
assert.ErrorContains(c, err, "")
|
||||
|
@ -222,7 +234,7 @@ func (s *DockerSuite) TestRmiBlank(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "image name cannot be blank"), "out: %s", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRmiContainerImageNotFound(c *testing.T) {
|
||||
func (s *DockerCLIRmiSuite) TestRmiContainerImageNotFound(c *testing.T) {
|
||||
// Build 2 images for testing.
|
||||
imageNames := []string{"test1", "test2"}
|
||||
imageIds := make([]string, 2)
|
||||
|
@ -248,7 +260,7 @@ func (s *DockerSuite) TestRmiContainerImageNotFound(c *testing.T) {
|
|||
}
|
||||
|
||||
// #13422
|
||||
func (s *DockerSuite) TestRmiUntagHistoryLayer(c *testing.T) {
|
||||
func (s *DockerCLIRmiSuite) TestRmiUntagHistoryLayer(c *testing.T) {
|
||||
image := "tmp1"
|
||||
// Build an image for testing.
|
||||
dockerfile := `FROM busybox
|
||||
|
@ -291,7 +303,7 @@ RUN echo 2 #layer2
|
|||
assert.Assert(c, strings.Contains(out, fmt.Sprintf("Untagged: %s:latest", newTag)))
|
||||
}
|
||||
|
||||
func (*DockerSuite) TestRmiParentImageFail(c *testing.T) {
|
||||
func (*DockerCLIRmiSuite) TestRmiParentImageFail(c *testing.T) {
|
||||
buildImageSuccessfully(c, "test", build.WithDockerfile(`
|
||||
FROM busybox
|
||||
RUN echo hello`))
|
||||
|
@ -304,7 +316,7 @@ func (*DockerSuite) TestRmiParentImageFail(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRmiWithParentInUse(c *testing.T) {
|
||||
func (s *DockerCLIRmiSuite) TestRmiWithParentInUse(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "create", "busybox")
|
||||
cID := strings.TrimSpace(out)
|
||||
|
||||
|
@ -321,7 +333,7 @@ func (s *DockerSuite) TestRmiWithParentInUse(c *testing.T) {
|
|||
}
|
||||
|
||||
// #18873
|
||||
func (s *DockerSuite) TestRmiByIDHardConflict(c *testing.T) {
|
||||
func (s *DockerCLIRmiSuite) TestRmiByIDHardConflict(c *testing.T) {
|
||||
dockerCmd(c, "create", "busybox")
|
||||
|
||||
imgID := inspectField(c, "busybox:latest", "Id")
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -31,7 +31,7 @@ import (
|
|||
)
|
||||
|
||||
// #6509
|
||||
func (s *DockerSuite) TestRunRedirectStdout(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunRedirectStdout(c *testing.T) {
|
||||
checkRedirect := func(command string) {
|
||||
_, tty, err := pty.Open()
|
||||
assert.Assert(c, err == nil, "Could not open pty")
|
||||
|
@ -59,7 +59,7 @@ func (s *DockerSuite) TestRunRedirectStdout(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test recursive bind mount works by default
|
||||
func (s *DockerSuite) TestRunWithVolumesIsRecursive(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithVolumesIsRecursive(c *testing.T) {
|
||||
// /tmp gets permission denied
|
||||
testRequires(c, NotUserNamespace, testEnv.IsLocalDaemon)
|
||||
tmpDir, err := os.MkdirTemp("", "docker_recursive_mount_test")
|
||||
|
@ -80,7 +80,7 @@ func (s *DockerSuite) TestRunWithVolumesIsRecursive(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, filepath.Base(f.Name())), "Recursive bind mount test failed. Expected file not found")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunDeviceDirectory(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunDeviceDirectory(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm)
|
||||
if _, err := os.Stat("/dev/snd"); err != nil {
|
||||
c.Skip("Host does not have /dev/snd")
|
||||
|
@ -93,7 +93,7 @@ func (s *DockerSuite) TestRunDeviceDirectory(c *testing.T) {
|
|||
}
|
||||
|
||||
// TestRunAttachDetach checks attaching and detaching with the default escape sequence.
|
||||
func (s *DockerSuite) TestRunAttachDetach(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunAttachDetach(c *testing.T) {
|
||||
name := "attach-detach"
|
||||
|
||||
dockerCmd(c, "run", "--name", name, "-itd", "busybox", "cat")
|
||||
|
@ -144,7 +144,7 @@ func (s *DockerSuite) TestRunAttachDetach(c *testing.T) {
|
|||
}
|
||||
|
||||
// TestRunAttachDetachFromFlag checks attaching and detaching with the escape sequence specified via flags.
|
||||
func (s *DockerSuite) TestRunAttachDetachFromFlag(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunAttachDetachFromFlag(c *testing.T) {
|
||||
name := "attach-detach"
|
||||
keyCtrlA := []byte{1}
|
||||
keyA := []byte{97}
|
||||
|
@ -205,7 +205,7 @@ func (s *DockerSuite) TestRunAttachDetachFromFlag(c *testing.T) {
|
|||
}
|
||||
|
||||
// TestRunAttachDetachFromInvalidFlag checks attaching and detaching with the escape sequence specified via flags.
|
||||
func (s *DockerSuite) TestRunAttachDetachFromInvalidFlag(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunAttachDetachFromInvalidFlag(c *testing.T) {
|
||||
name := "attach-detach"
|
||||
dockerCmd(c, "run", "--name", name, "-itd", "busybox", "top")
|
||||
assert.Assert(c, waitRun(name) == nil)
|
||||
|
@ -238,7 +238,7 @@ func (s *DockerSuite) TestRunAttachDetachFromInvalidFlag(c *testing.T) {
|
|||
}
|
||||
|
||||
// TestRunAttachDetachFromConfig checks attaching and detaching with the escape sequence specified via config file.
|
||||
func (s *DockerSuite) TestRunAttachDetachFromConfig(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunAttachDetachFromConfig(c *testing.T) {
|
||||
keyCtrlA := []byte{1}
|
||||
keyA := []byte{97}
|
||||
|
||||
|
@ -318,7 +318,7 @@ func (s *DockerSuite) TestRunAttachDetachFromConfig(c *testing.T) {
|
|||
}
|
||||
|
||||
// TestRunAttachDetachKeysOverrideConfig checks attaching and detaching with the detach flags, making sure it overrides config file
|
||||
func (s *DockerSuite) TestRunAttachDetachKeysOverrideConfig(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunAttachDetachKeysOverrideConfig(c *testing.T) {
|
||||
keyCtrlA := []byte{1}
|
||||
keyA := []byte{97}
|
||||
|
||||
|
@ -397,7 +397,7 @@ func (s *DockerSuite) TestRunAttachDetachKeysOverrideConfig(c *testing.T) {
|
|||
assert.Equal(c, running, "true", "expected container to still be running")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunAttachInvalidDetachKeySequencePreserved(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunAttachInvalidDetachKeySequencePreserved(c *testing.T) {
|
||||
name := "attach-detach"
|
||||
keyA := []byte{97}
|
||||
keyB := []byte{98}
|
||||
|
@ -448,7 +448,7 @@ func (s *DockerSuite) TestRunAttachInvalidDetachKeySequencePreserved(c *testing.
|
|||
}
|
||||
|
||||
// "test" should be printed
|
||||
func (s *DockerSuite) TestRunWithCPUQuota(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithCPUQuota(c *testing.T) {
|
||||
testRequires(c, cpuCfsQuota)
|
||||
|
||||
file := "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"
|
||||
|
@ -459,7 +459,7 @@ func (s *DockerSuite) TestRunWithCPUQuota(c *testing.T) {
|
|||
assert.Equal(c, out, "8000", "setting the CPU CFS quota failed")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithCpuPeriod(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithCpuPeriod(c *testing.T) {
|
||||
testRequires(c, cpuCfsPeriod)
|
||||
|
||||
file := "/sys/fs/cgroup/cpu/cpu.cfs_period_us"
|
||||
|
@ -473,7 +473,7 @@ func (s *DockerSuite) TestRunWithCpuPeriod(c *testing.T) {
|
|||
assert.Equal(c, out, "50000", "setting the CPU CFS period failed")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithInvalidCpuPeriod(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithInvalidCpuPeriod(c *testing.T) {
|
||||
testRequires(c, cpuCfsPeriod)
|
||||
out, _, err := dockerCmdWithError("run", "--cpu-period", "900", "busybox", "true")
|
||||
assert.ErrorContains(c, err, "")
|
||||
|
@ -489,7 +489,7 @@ func (s *DockerSuite) TestRunWithInvalidCpuPeriod(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, expected))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithCPUShares(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithCPUShares(c *testing.T) {
|
||||
testRequires(c, cpuShare)
|
||||
|
||||
file := "/sys/fs/cgroup/cpu/cpu.shares"
|
||||
|
@ -501,7 +501,7 @@ func (s *DockerSuite) TestRunWithCPUShares(c *testing.T) {
|
|||
}
|
||||
|
||||
// "test" should be printed
|
||||
func (s *DockerSuite) TestRunEchoStdoutWithCPUSharesAndMemoryLimit(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunEchoStdoutWithCPUSharesAndMemoryLimit(c *testing.T) {
|
||||
testRequires(c, cpuShare)
|
||||
testRequires(c, memoryLimitSupport)
|
||||
cli.DockerCmd(c, "run", "--cpu-shares", "1000", "-m", "32m", "busybox", "echo", "test").Assert(c, icmd.Expected{
|
||||
|
@ -509,7 +509,7 @@ func (s *DockerSuite) TestRunEchoStdoutWithCPUSharesAndMemoryLimit(c *testing.T)
|
|||
})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithCpusetCpus(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithCpusetCpus(c *testing.T) {
|
||||
testRequires(c, cgroupCpuset)
|
||||
|
||||
file := "/sys/fs/cgroup/cpuset/cpuset.cpus"
|
||||
|
@ -520,7 +520,7 @@ func (s *DockerSuite) TestRunWithCpusetCpus(c *testing.T) {
|
|||
assert.Equal(c, out, "0")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithCpusetMems(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithCpusetMems(c *testing.T) {
|
||||
testRequires(c, cgroupCpuset)
|
||||
|
||||
file := "/sys/fs/cgroup/cpuset/cpuset.mems"
|
||||
|
@ -531,7 +531,7 @@ func (s *DockerSuite) TestRunWithCpusetMems(c *testing.T) {
|
|||
assert.Equal(c, out, "0")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithBlkioWeight(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithBlkioWeight(c *testing.T) {
|
||||
testRequires(c, blkioWeight)
|
||||
|
||||
file := "/sys/fs/cgroup/blkio/blkio.weight"
|
||||
|
@ -542,7 +542,7 @@ func (s *DockerSuite) TestRunWithBlkioWeight(c *testing.T) {
|
|||
assert.Equal(c, out, "300")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithInvalidBlkioWeight(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithInvalidBlkioWeight(c *testing.T) {
|
||||
testRequires(c, blkioWeight)
|
||||
out, _, err := dockerCmdWithError("run", "--blkio-weight", "5", "busybox", "true")
|
||||
assert.ErrorContains(c, err, "", out)
|
||||
|
@ -550,37 +550,37 @@ func (s *DockerSuite) TestRunWithInvalidBlkioWeight(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, expected))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioWeightDevice(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithInvalidPathforBlkioWeightDevice(c *testing.T) {
|
||||
testRequires(c, blkioWeight)
|
||||
out, _, err := dockerCmdWithError("run", "--blkio-weight-device", "/dev/sdX:100", "busybox", "true")
|
||||
assert.ErrorContains(c, err, "", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadBps(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithInvalidPathforBlkioDeviceReadBps(c *testing.T) {
|
||||
testRequires(c, blkioWeight)
|
||||
out, _, err := dockerCmdWithError("run", "--device-read-bps", "/dev/sdX:500", "busybox", "true")
|
||||
assert.ErrorContains(c, err, "", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteBps(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithInvalidPathforBlkioDeviceWriteBps(c *testing.T) {
|
||||
testRequires(c, blkioWeight)
|
||||
out, _, err := dockerCmdWithError("run", "--device-write-bps", "/dev/sdX:500", "busybox", "true")
|
||||
assert.ErrorContains(c, err, "", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadIOps(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithInvalidPathforBlkioDeviceReadIOps(c *testing.T) {
|
||||
testRequires(c, blkioWeight)
|
||||
out, _, err := dockerCmdWithError("run", "--device-read-iops", "/dev/sdX:500", "busybox", "true")
|
||||
assert.ErrorContains(c, err, "", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteIOps(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithInvalidPathforBlkioDeviceWriteIOps(c *testing.T) {
|
||||
testRequires(c, blkioWeight)
|
||||
out, _, err := dockerCmdWithError("run", "--device-write-iops", "/dev/sdX:500", "busybox", "true")
|
||||
assert.ErrorContains(c, err, "", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunOOMExitCode(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunOOMExitCode(c *testing.T) {
|
||||
testRequires(c, memoryLimitSupport, swapMemorySupport, NotPpc64le)
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
|
@ -600,7 +600,7 @@ func (s *DockerSuite) TestRunOOMExitCode(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithMemoryLimit(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithMemoryLimit(c *testing.T) {
|
||||
testRequires(c, memoryLimitSupport)
|
||||
|
||||
file := "/sys/fs/cgroup/memory/memory.limit_in_bytes"
|
||||
|
@ -616,14 +616,14 @@ func (s *DockerSuite) TestRunWithMemoryLimit(c *testing.T) {
|
|||
// memory limit, this means the processes in the container can use
|
||||
// 16M memory and as much swap memory as they need (if the host
|
||||
// supports swap memory).
|
||||
func (s *DockerSuite) TestRunWithoutMemoryswapLimit(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithoutMemoryswapLimit(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, memoryLimitSupport)
|
||||
testRequires(c, swapMemorySupport)
|
||||
dockerCmd(c, "run", "-m", "32m", "--memory-swap", "-1", "busybox", "true")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithSwappiness(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithSwappiness(c *testing.T) {
|
||||
testRequires(c, memorySwappinessSupport)
|
||||
file := "/sys/fs/cgroup/memory/memory.swappiness"
|
||||
out, _ := dockerCmd(c, "run", "--memory-swappiness", "0", "--name", "test", "busybox", "cat", file)
|
||||
|
@ -633,7 +633,7 @@ func (s *DockerSuite) TestRunWithSwappiness(c *testing.T) {
|
|||
assert.Equal(c, out, "0")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithSwappinessInvalid(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithSwappinessInvalid(c *testing.T) {
|
||||
testRequires(c, memorySwappinessSupport)
|
||||
out, _, err := dockerCmdWithError("run", "--memory-swappiness", "101", "busybox", "true")
|
||||
assert.ErrorContains(c, err, "")
|
||||
|
@ -644,7 +644,7 @@ func (s *DockerSuite) TestRunWithSwappinessInvalid(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, expected), "Expected output to contain %q, not %q", out, expected)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithMemoryReservation(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithMemoryReservation(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, memoryReservationSupport)
|
||||
|
||||
file := "/sys/fs/cgroup/memory/memory.soft_limit_in_bytes"
|
||||
|
@ -655,7 +655,7 @@ func (s *DockerSuite) TestRunWithMemoryReservation(c *testing.T) {
|
|||
assert.Equal(c, out, "209715200")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithMemoryReservationInvalid(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithMemoryReservationInvalid(c *testing.T) {
|
||||
testRequires(c, memoryLimitSupport)
|
||||
testRequires(c, testEnv.IsLocalDaemon, memoryReservationSupport)
|
||||
out, _, err := dockerCmdWithError("run", "-m", "500M", "--memory-reservation", "800M", "busybox", "true")
|
||||
|
@ -668,7 +668,7 @@ func (s *DockerSuite) TestRunWithMemoryReservationInvalid(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(strings.TrimSpace(out), expected), "run container should fail with invalid memory reservation")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStopContainerSignal(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestStopContainerSignal(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "--stop-signal", "SIGUSR1", "-d", "busybox", "/bin/sh", "-c", `trap 'echo "exit trapped"; exit 0' USR1; while true; do sleep 1; done`)
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
||||
|
@ -680,7 +680,7 @@ func (s *DockerSuite) TestStopContainerSignal(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "exit trapped"), "Expected `exit trapped` in the log")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunSwapLessThanMemoryLimit(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunSwapLessThanMemoryLimit(c *testing.T) {
|
||||
testRequires(c, memoryLimitSupport)
|
||||
testRequires(c, swapMemorySupport)
|
||||
out, _, err := dockerCmdWithError("run", "-m", "16m", "--memory-swap", "15m", "busybox", "echo", "test")
|
||||
|
@ -690,7 +690,7 @@ func (s *DockerSuite) TestRunSwapLessThanMemoryLimit(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, expected))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunInvalidCpusetCpusFlagValue(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunInvalidCpusetCpusFlagValue(c *testing.T) {
|
||||
testRequires(c, cgroupCpuset, testEnv.IsLocalDaemon)
|
||||
|
||||
sysInfo := sysinfo.New()
|
||||
|
@ -709,7 +709,7 @@ func (s *DockerSuite) TestRunInvalidCpusetCpusFlagValue(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, expected))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunInvalidCpusetMemsFlagValue(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunInvalidCpusetMemsFlagValue(c *testing.T) {
|
||||
testRequires(c, cgroupCpuset)
|
||||
|
||||
sysInfo := sysinfo.New()
|
||||
|
@ -728,7 +728,7 @@ func (s *DockerSuite) TestRunInvalidCpusetMemsFlagValue(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, expected))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunInvalidCPUShares(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunInvalidCPUShares(c *testing.T) {
|
||||
testRequires(c, cpuShare, DaemonIsLinux)
|
||||
out, _, err := dockerCmdWithError("run", "--cpu-shares", "1", "busybox", "echo", "test")
|
||||
assert.ErrorContains(c, err, "", out)
|
||||
|
@ -746,7 +746,7 @@ func (s *DockerSuite) TestRunInvalidCPUShares(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, expected))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithDefaultShmSize(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithDefaultShmSize(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
name := "shm-default"
|
||||
|
@ -759,7 +759,7 @@ func (s *DockerSuite) TestRunWithDefaultShmSize(c *testing.T) {
|
|||
assert.Equal(c, shmSize, "67108864")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithShmSize(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithShmSize(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
name := "shm"
|
||||
|
@ -772,7 +772,7 @@ func (s *DockerSuite) TestRunWithShmSize(c *testing.T) {
|
|||
assert.Equal(c, shmSize, "1073741824")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunTmpfsMountsEnsureOrdered(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunTmpfsMountsEnsureOrdered(c *testing.T) {
|
||||
tmpFile, err := os.CreateTemp("", "test")
|
||||
assert.NilError(c, err)
|
||||
defer tmpFile.Close()
|
||||
|
@ -780,7 +780,7 @@ func (s *DockerSuite) TestRunTmpfsMountsEnsureOrdered(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "test"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunTmpfsMounts(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunTmpfsMounts(c *testing.T) {
|
||||
// TODO Windows (Post TP5): This test cannot run on a Windows daemon as
|
||||
// Windows does not support tmpfs mounts.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
@ -801,7 +801,7 @@ func (s *DockerSuite) TestRunTmpfsMounts(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunTmpfsMountsOverrideImageVolumes(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunTmpfsMountsOverrideImageVolumes(c *testing.T) {
|
||||
name := "img-with-volumes"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(`
|
||||
FROM busybox
|
||||
|
@ -813,7 +813,7 @@ func (s *DockerSuite) TestRunTmpfsMountsOverrideImageVolumes(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test case for #22420
|
||||
func (s *DockerSuite) TestRunTmpfsMountsWithOptions(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunTmpfsMountsWithOptions(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
expectedOptions := []string{"rw", "nosuid", "nodev", "noexec", "relatime"}
|
||||
|
@ -851,7 +851,7 @@ func (s *DockerSuite) TestRunTmpfsMountsWithOptions(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunSysctls(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunSysctls(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
var err error
|
||||
|
||||
|
@ -882,7 +882,7 @@ func (s *DockerSuite) TestRunSysctls(c *testing.T) {
|
|||
}
|
||||
|
||||
// TestRunSeccompProfileDenyUnshare checks that 'docker run --security-opt seccomp=/tmp/profile.json debian:bullseye-slim unshare' exits with operation not permitted.
|
||||
func (s *DockerSuite) TestRunSeccompProfileDenyUnshare(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunSeccompProfileDenyUnshare(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, NotArm, Apparmor)
|
||||
jsonData := `{
|
||||
"defaultAction": "SCMP_ACT_ALLOW",
|
||||
|
@ -911,7 +911,7 @@ func (s *DockerSuite) TestRunSeccompProfileDenyUnshare(c *testing.T) {
|
|||
}
|
||||
|
||||
// TestRunSeccompProfileDenyChmod checks that 'docker run --security-opt seccomp=/tmp/profile.json busybox chmod 400 /etc/hostname' exits with operation not permitted.
|
||||
func (s *DockerSuite) TestRunSeccompProfileDenyChmod(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunSeccompProfileDenyChmod(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled)
|
||||
jsonData := `{
|
||||
"defaultAction": "SCMP_ACT_ALLOW",
|
||||
|
@ -946,7 +946,7 @@ func (s *DockerSuite) TestRunSeccompProfileDenyChmod(c *testing.T) {
|
|||
|
||||
// TestRunSeccompProfileDenyUnshareUserns checks that 'docker run debian:bullseye-slim unshare --map-root-user --user sh -c whoami' with a specific profile to
|
||||
// deny unshare of a userns exits with operation not permitted.
|
||||
func (s *DockerSuite) TestRunSeccompProfileDenyUnshareUserns(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunSeccompProfileDenyUnshareUserns(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, NotArm, Apparmor)
|
||||
// from sched.h
|
||||
jsonData := fmt.Sprintf(`{
|
||||
|
@ -984,7 +984,7 @@ func (s *DockerSuite) TestRunSeccompProfileDenyUnshareUserns(c *testing.T) {
|
|||
|
||||
// TestRunSeccompProfileDenyCloneUserns checks that 'docker run syscall-test'
|
||||
// with a the default seccomp profile exits with operation not permitted.
|
||||
func (s *DockerSuite) TestRunSeccompProfileDenyCloneUserns(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunSeccompProfileDenyCloneUserns(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -996,7 +996,7 @@ func (s *DockerSuite) TestRunSeccompProfileDenyCloneUserns(c *testing.T) {
|
|||
|
||||
// TestRunSeccompUnconfinedCloneUserns checks that
|
||||
// 'docker run --security-opt seccomp=unconfined syscall-test' allows creating a userns.
|
||||
func (s *DockerSuite) TestRunSeccompUnconfinedCloneUserns(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunSeccompUnconfinedCloneUserns(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, UserNamespaceInKernel, NotUserNamespace, unprivilegedUsernsClone)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1009,7 +1009,7 @@ func (s *DockerSuite) TestRunSeccompUnconfinedCloneUserns(c *testing.T) {
|
|||
|
||||
// TestRunSeccompAllowPrivCloneUserns checks that 'docker run --privileged syscall-test'
|
||||
// allows creating a userns.
|
||||
func (s *DockerSuite) TestRunSeccompAllowPrivCloneUserns(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunSeccompAllowPrivCloneUserns(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, UserNamespaceInKernel, NotUserNamespace)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1021,7 +1021,7 @@ func (s *DockerSuite) TestRunSeccompAllowPrivCloneUserns(c *testing.T) {
|
|||
|
||||
// TestRunSeccompProfileAllow32Bit checks that 32 bit code can run on x86_64
|
||||
// with the default seccomp profile.
|
||||
func (s *DockerSuite) TestRunSeccompProfileAllow32Bit(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunSeccompProfileAllow32Bit(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, IsAmd64)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1029,14 +1029,14 @@ func (s *DockerSuite) TestRunSeccompProfileAllow32Bit(c *testing.T) {
|
|||
}
|
||||
|
||||
// TestRunSeccompAllowSetrlimit checks that 'docker run debian:bullseye-slim ulimit -v 1048510' succeeds.
|
||||
func (s *DockerSuite) TestRunSeccompAllowSetrlimit(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunSeccompAllowSetrlimit(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled)
|
||||
|
||||
// ulimit uses setrlimit, so we want to make sure we don't break it
|
||||
icmd.RunCommand(dockerBinary, "run", "debian:bullseye-slim", "bash", "-c", "ulimit -v 1048510").Assert(c, icmd.Success)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunSeccompDefaultProfileAcct(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunSeccompDefaultProfileAcct(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, NotUserNamespace)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1066,7 +1066,7 @@ func (s *DockerSuite) TestRunSeccompDefaultProfileAcct(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunSeccompDefaultProfileNS(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunSeccompDefaultProfileNS(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, NotUserNamespace)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1103,7 +1103,7 @@ func (s *DockerSuite) TestRunSeccompDefaultProfileNS(c *testing.T) {
|
|||
|
||||
// TestRunNoNewPrivSetuid checks that --security-opt='no-new-privileges=true' prevents
|
||||
// effective uid transitions on executing setuid binaries.
|
||||
func (s *DockerSuite) TestRunNoNewPrivSetuid(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunNoNewPrivSetuid(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace, testEnv.IsLocalDaemon)
|
||||
ensureNNPTest(c)
|
||||
|
||||
|
@ -1116,7 +1116,7 @@ func (s *DockerSuite) TestRunNoNewPrivSetuid(c *testing.T) {
|
|||
|
||||
// TestLegacyRunNoNewPrivSetuid checks that --security-opt=no-new-privileges prevents
|
||||
// effective uid transitions on executing setuid binaries.
|
||||
func (s *DockerSuite) TestLegacyRunNoNewPrivSetuid(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestLegacyRunNoNewPrivSetuid(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace, testEnv.IsLocalDaemon)
|
||||
ensureNNPTest(c)
|
||||
|
||||
|
@ -1127,7 +1127,7 @@ func (s *DockerSuite) TestLegacyRunNoNewPrivSetuid(c *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUserNoEffectiveCapabilitiesChown(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestUserNoEffectiveCapabilitiesChown(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1145,7 +1145,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesChown(c *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUserNoEffectiveCapabilitiesDacOverride(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestUserNoEffectiveCapabilitiesDacOverride(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1158,7 +1158,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesDacOverride(c *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUserNoEffectiveCapabilitiesFowner(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestUserNoEffectiveCapabilitiesFowner(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1174,7 +1174,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesFowner(c *testing.T) {
|
|||
|
||||
// TODO CAP_KILL
|
||||
|
||||
func (s *DockerSuite) TestUserNoEffectiveCapabilitiesSetuid(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestUserNoEffectiveCapabilitiesSetuid(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1192,7 +1192,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesSetuid(c *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUserNoEffectiveCapabilitiesSetgid(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestUserNoEffectiveCapabilitiesSetgid(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1220,7 +1220,7 @@ func sysctlExists(s string) bool {
|
|||
return err == nil
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUserNoEffectiveCapabilitiesNetBindService(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestUserNoEffectiveCapabilitiesNetBindService(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1249,7 +1249,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesNetBindService(c *testing.T
|
|||
})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUserNoEffectiveCapabilitiesNetRaw(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestUserNoEffectiveCapabilitiesNetRaw(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1267,7 +1267,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesNetRaw(c *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUserNoEffectiveCapabilitiesChroot(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestUserNoEffectiveCapabilitiesChroot(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1285,7 +1285,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesChroot(c *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUserNoEffectiveCapabilitiesMknod(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestUserNoEffectiveCapabilitiesMknod(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace, testEnv.IsLocalDaemon)
|
||||
ensureSyscallTest(c)
|
||||
|
||||
|
@ -1307,7 +1307,7 @@ func (s *DockerSuite) TestUserNoEffectiveCapabilitiesMknod(c *testing.T) {
|
|||
// TODO CAP_AUDIT_WRITE
|
||||
// TODO CAP_SETFCAP
|
||||
|
||||
func (s *DockerSuite) TestRunApparmorProcDirectory(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunApparmorProcDirectory(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, Apparmor)
|
||||
|
||||
// running w seccomp unconfined tests the apparmor profile
|
||||
|
@ -1326,7 +1326,7 @@ func (s *DockerSuite) TestRunApparmorProcDirectory(c *testing.T) {
|
|||
|
||||
// make sure the default profile can be successfully parsed (using unshare as it is
|
||||
// something which we know is blocked in the default profile)
|
||||
func (s *DockerSuite) TestRunSeccompWithDefaultProfile(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunSeccompWithDefaultProfile(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled)
|
||||
|
||||
out, _, err := dockerCmdWithError("run", "--security-opt", "seccomp=../profiles/seccomp/default.json", "debian:bullseye-slim", "unshare", "--map-root-user", "--user", "sh", "-c", "whoami")
|
||||
|
@ -1335,7 +1335,7 @@ func (s *DockerSuite) TestRunSeccompWithDefaultProfile(c *testing.T) {
|
|||
}
|
||||
|
||||
// TestRunDeviceSymlink checks run with device that follows symlink (#13840 and #22271)
|
||||
func (s *DockerSuite) TestRunDeviceSymlink(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunDeviceSymlink(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm, testEnv.IsLocalDaemon)
|
||||
if _, err := os.Stat("/dev/zero"); err != nil {
|
||||
c.Skip("Host does not have /dev/zero")
|
||||
|
@ -1382,7 +1382,7 @@ func (s *DockerSuite) TestRunDeviceSymlink(c *testing.T) {
|
|||
}
|
||||
|
||||
// TestRunPIDsLimit makes sure the pids cgroup is set with --pids-limit
|
||||
func (s *DockerSuite) TestRunPIDsLimit(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunPIDsLimit(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, pidsLimit)
|
||||
|
||||
file := "/sys/fs/cgroup/pids/pids.max"
|
||||
|
@ -1393,7 +1393,7 @@ func (s *DockerSuite) TestRunPIDsLimit(c *testing.T) {
|
|||
assert.Equal(c, out, "4", "setting the pids limit failed")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunPrivilegedAllowedDevices(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunPrivilegedAllowedDevices(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
|
||||
file := "/sys/fs/cgroup/devices/devices.list"
|
||||
|
@ -1402,7 +1402,7 @@ func (s *DockerSuite) TestRunPrivilegedAllowedDevices(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), "a *:* rwm")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunUserDeviceAllowed(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunUserDeviceAllowed(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
fi, err := os.Stat("/dev/snd/timer")
|
||||
|
@ -1543,7 +1543,7 @@ func (s *DockerDaemonSuite) TestRunWithDaemonDefaultSeccompProfile(c *testing.T)
|
|||
assert.Assert(c, strings.Contains(out, "Operation not permitted"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithNanoCPUs(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunWithNanoCPUs(c *testing.T) {
|
||||
testRequires(c, cpuCfsQuota, cpuCfsPeriod)
|
||||
|
||||
file1 := "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"
|
||||
|
|
|
@ -22,8 +22,20 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
type DockerCLISaveLoadSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLISaveLoadSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLISaveLoadSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
// save a repo using gz compression and try to load it using stdout
|
||||
func (s *DockerSuite) TestSaveXzAndLoadRepoStdout(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveXzAndLoadRepoStdout(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-save-xz-and-load-repo-stdout"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "true")
|
||||
|
@ -52,7 +64,7 @@ func (s *DockerSuite) TestSaveXzAndLoadRepoStdout(c *testing.T) {
|
|||
}
|
||||
|
||||
// save a repo using xz+gz compression and try to load it using stdout
|
||||
func (s *DockerSuite) TestSaveXzGzAndLoadRepoStdout(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveXzGzAndLoadRepoStdout(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-save-xz-gz-and-load-repo-stdout"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "true")
|
||||
|
@ -81,7 +93,7 @@ func (s *DockerSuite) TestSaveXzGzAndLoadRepoStdout(c *testing.T) {
|
|||
assert.ErrorContains(c, err, "", "the repo should not exist: %v", after)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestSaveSingleTag(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveSingleTag(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
repoName := "foobar-save-single-tag-test"
|
||||
dockerCmd(c, "tag", "busybox:latest", fmt.Sprintf("%v:latest", repoName))
|
||||
|
@ -96,7 +108,7 @@ func (s *DockerSuite) TestSaveSingleTag(c *testing.T) {
|
|||
assert.NilError(c, err, "failed to save repo with image ID and 'repositories' file: %s, %v", out, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestSaveCheckTimes(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveCheckTimes(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
repoName := "busybox:latest"
|
||||
out, _ := dockerCmd(c, "inspect", repoName)
|
||||
|
@ -115,7 +127,7 @@ func (s *DockerSuite) TestSaveCheckTimes(c *testing.T) {
|
|||
assert.NilError(c, err, "failed to save repo with image ID and 'repositories' file: %s, %v", out, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestSaveImageId(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveImageId(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
repoName := "foobar-save-image-id-test"
|
||||
dockerCmd(c, "tag", "emptyfs:latest", fmt.Sprintf("%v:latest", repoName))
|
||||
|
@ -154,7 +166,7 @@ func (s *DockerSuite) TestSaveImageId(c *testing.T) {
|
|||
}
|
||||
|
||||
// save a repo and try to load it using flags
|
||||
func (s *DockerSuite) TestSaveAndLoadRepoFlags(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveAndLoadRepoFlags(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-save-and-load-repo-flags"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "true")
|
||||
|
@ -175,7 +187,7 @@ func (s *DockerSuite) TestSaveAndLoadRepoFlags(c *testing.T) {
|
|||
assert.Equal(c, before, after, "inspect is not the same after a save / load")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestSaveWithNoExistImage(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveWithNoExistImage(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
imgName := "foobar-non-existing-image"
|
||||
|
@ -185,7 +197,7 @@ func (s *DockerSuite) TestSaveWithNoExistImage(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, fmt.Sprintf("No such image: %s", imgName)))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestSaveMultipleNames(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveMultipleNames(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
repoName := "foobar-save-multi-name-test"
|
||||
|
||||
|
@ -203,7 +215,7 @@ func (s *DockerSuite) TestSaveMultipleNames(c *testing.T) {
|
|||
assert.NilError(c, err, "failed to save multiple repos: %s, %v", out, err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestSaveRepoWithMultipleImages(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveRepoWithMultipleImages(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
makeImage := func(from string, tag string) string {
|
||||
var (
|
||||
|
@ -255,7 +267,7 @@ func (s *DockerSuite) TestSaveRepoWithMultipleImages(c *testing.T) {
|
|||
}
|
||||
|
||||
// Issue #6722 #5892 ensure directories are included in changes
|
||||
func (s *DockerSuite) TestSaveDirectoryPermissions(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveDirectoryPermissions(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
layerEntries := []string{"opt/", "opt/a/", "opt/a/b/", "opt/a/b/c"}
|
||||
layerEntriesAUFS := []string{"./", ".wh..wh.aufs", ".wh..wh.orph/", ".wh..wh.plnk/", "opt/", "opt/a/", "opt/a/b/", "opt/a/b/c"}
|
||||
|
@ -329,7 +341,7 @@ func listTar(f io.Reader) ([]string, error) {
|
|||
// Test loading a weird image where one of the layers is of zero size.
|
||||
// The layer.tar file is actually zero bytes, no padding or anything else.
|
||||
// See issue: 18170
|
||||
func (s *DockerSuite) TestLoadZeroSizeLayer(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestLoadZeroSizeLayer(c *testing.T) {
|
||||
// this will definitely not work if using remote daemon
|
||||
// very weird test
|
||||
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
||||
|
@ -337,7 +349,7 @@ func (s *DockerSuite) TestLoadZeroSizeLayer(c *testing.T) {
|
|||
dockerCmd(c, "load", "-i", "testdata/emptyLayer.tar")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestSaveLoadParents(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveLoadParents(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
makeImage := func(from string, addfile string) string {
|
||||
|
@ -376,7 +388,7 @@ func (s *DockerSuite) TestSaveLoadParents(c *testing.T) {
|
|||
assert.Equal(c, inspectOut, "")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestSaveLoadNoTag(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveLoadNoTag(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
name := "saveloadnotag"
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
// save a repo and try to load it using stdout
|
||||
func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveAndLoadRepoStdout(c *testing.T) {
|
||||
name := "test-save-and-load-repo-stdout"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "true")
|
||||
|
||||
|
@ -70,7 +70,7 @@ func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(string(buf[:n]), "cowardly refusing"), "help output is not being yielded")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestSaveAndLoadWithProgressBar(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestSaveAndLoadWithProgressBar(c *testing.T) {
|
||||
name := "test-load"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox
|
||||
RUN touch aa
|
||||
|
@ -88,7 +88,7 @@ func (s *DockerSuite) TestSaveAndLoadWithProgressBar(c *testing.T) {
|
|||
}
|
||||
|
||||
// fail because load didn't receive data from stdin
|
||||
func (s *DockerSuite) TestLoadNoStdinFail(c *testing.T) {
|
||||
func (s *DockerCLISaveLoadSuite) TestLoadNoStdinFail(c *testing.T) {
|
||||
pty, tty, err := pty.Open()
|
||||
assert.NilError(c, err)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
|
|
|
@ -8,13 +8,25 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
type DockerCLISearchSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLISearchSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLISearchSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
// search for repos named "registry" on the central registry
|
||||
func (s *DockerSuite) TestSearchOnCentralRegistry(c *testing.T) {
|
||||
func (s *DockerCLISearchSuite) TestSearchOnCentralRegistry(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "search", "busybox")
|
||||
assert.Assert(c, strings.Contains(out, "Busybox base image."), "couldn't find any repository named (or containing) 'Busybox base image.'")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *testing.T) {
|
||||
func (s *DockerCLISearchSuite) TestSearchStarsOptionWithWrongParameter(c *testing.T) {
|
||||
out, _, err := dockerCmdWithError("search", "--filter", "stars=a", "busybox")
|
||||
assert.ErrorContains(c, err, "", out)
|
||||
assert.Assert(c, strings.Contains(out, "invalid filter"), "couldn't find the invalid filter warning")
|
||||
|
@ -32,7 +44,7 @@ func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "invalid filter"), "couldn't find the invalid filter warning")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestSearchCmdOptions(c *testing.T) {
|
||||
func (s *DockerCLISearchSuite) TestSearchCmdOptions(c *testing.T) {
|
||||
outSearchCmd, _ := dockerCmd(c, "search", "busybox")
|
||||
assert.Assert(c, strings.Count(outSearchCmd, "\n") > 3, outSearchCmd)
|
||||
|
||||
|
@ -60,12 +72,12 @@ func (s *DockerSuite) TestSearchCmdOptions(c *testing.T) {
|
|||
}
|
||||
|
||||
// search for repos which start with "ubuntu-" on the central registry
|
||||
func (s *DockerSuite) TestSearchOnCentralRegistryWithDash(c *testing.T) {
|
||||
func (s *DockerCLISearchSuite) TestSearchOnCentralRegistryWithDash(c *testing.T) {
|
||||
dockerCmd(c, "search", "ubuntu-")
|
||||
}
|
||||
|
||||
// test case for #23055
|
||||
func (s *DockerSuite) TestSearchWithLimit(c *testing.T) {
|
||||
func (s *DockerCLISearchSuite) TestSearchWithLimit(c *testing.T) {
|
||||
for _, limit := range []int{10, 50, 100} {
|
||||
out, _, err := dockerCmdWithError("search", fmt.Sprintf("--limit=%d", limit), "docker")
|
||||
assert.NilError(c, err)
|
||||
|
|
|
@ -14,7 +14,19 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestClientSetsTLSServerName(c *testing.T) {
|
||||
type DockerCLISNISuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLISNISuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLISNISuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLISNISuite) TestClientSetsTLSServerName(c *testing.T) {
|
||||
c.Skip("Flakey test")
|
||||
// there may be more than one hit to the server for each registry request
|
||||
var serverNameReceived []string
|
||||
|
|
|
@ -11,8 +11,20 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
type DockerCLIStartSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIStartSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIStartSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
// Regression test for https://github.com/docker/docker/issues/7843
|
||||
func (s *DockerSuite) TestStartAttachReturnsOnError(c *testing.T) {
|
||||
func (s *DockerCLIStartSuite) TestStartAttachReturnsOnError(c *testing.T) {
|
||||
// Windows does not support link
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "--name", "test", "busybox")
|
||||
|
@ -41,7 +53,7 @@ func (s *DockerSuite) TestStartAttachReturnsOnError(c *testing.T) {
|
|||
}
|
||||
|
||||
// gh#8555: Exit code should be passed through when using start -a
|
||||
func (s *DockerSuite) TestStartAttachCorrectExitCode(c *testing.T) {
|
||||
func (s *DockerCLIStartSuite) TestStartAttachCorrectExitCode(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "sh", "-c", "sleep 2; exit 1").Stdout()
|
||||
out = strings.TrimSpace(out)
|
||||
|
@ -54,7 +66,7 @@ func (s *DockerSuite) TestStartAttachCorrectExitCode(c *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStartAttachSilent(c *testing.T) {
|
||||
func (s *DockerCLIStartSuite) TestStartAttachSilent(c *testing.T) {
|
||||
name := "teststartattachcorrectexitcode"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "echo", "test")
|
||||
|
||||
|
@ -66,7 +78,7 @@ func (s *DockerSuite) TestStartAttachSilent(c *testing.T) {
|
|||
assert.Equal(c, startOut, "test\n")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStartRecordError(c *testing.T) {
|
||||
func (s *DockerCLIStartSuite) TestStartRecordError(c *testing.T) {
|
||||
// TODO Windows CI: Requires further porting work. Should be possible.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
// when container runs successfully, we should not have state.Error
|
||||
|
@ -90,7 +102,7 @@ func (s *DockerSuite) TestStartRecordError(c *testing.T) {
|
|||
assert.Equal(c, stateErr, "")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStartPausedContainer(c *testing.T) {
|
||||
func (s *DockerCLIStartSuite) TestStartPausedContainer(c *testing.T) {
|
||||
// Windows does not support pausing containers
|
||||
testRequires(c, IsPausable)
|
||||
|
||||
|
@ -105,7 +117,7 @@ func (s *DockerSuite) TestStartPausedContainer(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(strings.ToLower(out), "cannot start a paused container, try unpause instead"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStartMultipleContainers(c *testing.T) {
|
||||
func (s *DockerCLIStartSuite) TestStartMultipleContainers(c *testing.T) {
|
||||
// Windows does not support --link
|
||||
testRequires(c, DaemonIsLinux)
|
||||
// run a container named 'parent' and create two container link to `parent`
|
||||
|
@ -141,7 +153,7 @@ func (s *DockerSuite) TestStartMultipleContainers(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStartAttachMultipleContainers(c *testing.T) {
|
||||
func (s *DockerCLIStartSuite) TestStartAttachMultipleContainers(c *testing.T) {
|
||||
// run multiple containers to test
|
||||
for _, container := range []string{"test1", "test2", "test3"} {
|
||||
runSleepingContainer(c, "--name", container)
|
||||
|
@ -170,7 +182,7 @@ func (s *DockerSuite) TestStartAttachMultipleContainers(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test case for #23716
|
||||
func (s *DockerSuite) TestStartAttachWithRename(c *testing.T) {
|
||||
func (s *DockerCLIStartSuite) TestStartAttachWithRename(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
cli.DockerCmd(c, "create", "-t", "--name", "before", "busybox")
|
||||
go func() {
|
||||
|
@ -185,7 +197,7 @@ func (s *DockerSuite) TestStartAttachWithRename(c *testing.T) {
|
|||
assert.Assert(c, !strings.Contains(result.Stderr(), "No such container"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStartReturnCorrectExitCode(c *testing.T) {
|
||||
func (s *DockerCLIStartSuite) TestStartReturnCorrectExitCode(c *testing.T) {
|
||||
cli.DockerCmd(c, "create", "--restart=on-failure:2", "--name", "withRestart", "busybox", "sh", "-c", "exit 11")
|
||||
cli.DockerCmd(c, "create", "--rm", "--name", "withRm", "busybox", "sh", "-c", "exit 12")
|
||||
cli.Docker(cli.Args("start", "-a", "withRestart")).Assert(c, icmd.Expected{ExitCode: 11})
|
||||
|
|
|
@ -13,7 +13,19 @@ import (
|
|||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestStatsNoStream(c *testing.T) {
|
||||
type DockerCLIStatsSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIStatsSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIStatsSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIStatsSuite) TestStatsNoStream(c *testing.T) {
|
||||
// Windows does not support stats
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
|
@ -42,7 +54,7 @@ func (s *DockerSuite) TestStatsNoStream(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStatsContainerNotFound(c *testing.T) {
|
||||
func (s *DockerCLIStatsSuite) TestStatsContainerNotFound(c *testing.T) {
|
||||
// Windows does not support stats
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -55,7 +67,7 @@ func (s *DockerSuite) TestStatsContainerNotFound(c *testing.T) {
|
|||
assert.Assert(c, is.Contains(out, "No such container: notfound"), "Expected to fail on not found container stats with --no-stream, got %q instead", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStatsAllRunningNoStream(c *testing.T) {
|
||||
func (s *DockerCLIStatsSuite) TestStatsAllRunningNoStream(c *testing.T) {
|
||||
// Windows does not support stats
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -91,7 +103,7 @@ func (s *DockerSuite) TestStatsAllRunningNoStream(c *testing.T) {
|
|||
assert.Assert(c, realData != nil, "stat result are empty: %s", out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStatsAllNoStream(c *testing.T) {
|
||||
func (s *DockerCLIStatsSuite) TestStatsAllNoStream(c *testing.T) {
|
||||
// Windows does not support stats
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -121,7 +133,7 @@ func (s *DockerSuite) TestStatsAllNoStream(c *testing.T) {
|
|||
assert.Assert(c, realData == nil, "stat result of %s should be empty : %s", id1, out)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStatsAllNewContainersAdded(c *testing.T) {
|
||||
func (s *DockerCLIStatsSuite) TestStatsAllNewContainersAdded(c *testing.T) {
|
||||
// Windows does not support stats
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
@ -162,7 +174,7 @@ func (s *DockerSuite) TestStatsAllNewContainersAdded(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestStatsFormatAll(c *testing.T) {
|
||||
func (s *DockerCLIStatsSuite) TestStatsFormatAll(c *testing.T) {
|
||||
// Windows does not support stats
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
|
|
|
@ -8,7 +8,19 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestTopMultipleArgs(c *testing.T) {
|
||||
type DockerCLITopSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLITopSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLITopSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLITopSuite) TestTopMultipleArgs(c *testing.T) {
|
||||
out := runSleepingContainer(c, "-d")
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
||||
|
@ -23,7 +35,7 @@ func (s *DockerSuite) TestTopMultipleArgs(c *testing.T) {
|
|||
result.Assert(c, expected)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestTopNonPrivileged(c *testing.T) {
|
||||
func (s *DockerCLITopSuite) TestTopNonPrivileged(c *testing.T) {
|
||||
out := runSleepingContainer(c, "-d")
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
||||
|
@ -47,7 +59,7 @@ func (s *DockerSuite) TestTopNonPrivileged(c *testing.T) {
|
|||
// TestTopWindowsCoreProcesses validates that there are lines for the critical
|
||||
// processes which are found in a Windows container. Note Windows is architecturally
|
||||
// very different to Linux in this regard.
|
||||
func (s *DockerSuite) TestTopWindowsCoreProcesses(c *testing.T) {
|
||||
func (s *DockerCLITopSuite) TestTopWindowsCoreProcesses(c *testing.T) {
|
||||
testRequires(c, DaemonIsWindows)
|
||||
out := runSleepingContainer(c, "-d")
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
@ -58,7 +70,7 @@ func (s *DockerSuite) TestTopWindowsCoreProcesses(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestTopPrivileged(c *testing.T) {
|
||||
func (s *DockerCLITopSuite) TestTopPrivileged(c *testing.T) {
|
||||
// Windows does not support --privileged
|
||||
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
||||
out, _ := dockerCmd(c, "run", "--privileged", "-i", "-d", "busybox", "top")
|
||||
|
|
5
integration-cli/docker_cli_update_test.go
Normal file
5
integration-cli/docker_cli_update_test.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package main
|
||||
|
||||
type DockerCLIUpdateSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
|
@ -19,7 +19,15 @@ import (
|
|||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestUpdateRunningContainer(c *testing.T) {
|
||||
func (s *DockerCLIUpdateSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIUpdateSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIUpdateSuite) TestUpdateRunningContainer(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, memoryLimitSupport)
|
||||
|
||||
|
@ -34,7 +42,7 @@ func (s *DockerSuite) TestUpdateRunningContainer(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), "524288000")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUpdateRunningContainerWithRestart(c *testing.T) {
|
||||
func (s *DockerCLIUpdateSuite) TestUpdateRunningContainerWithRestart(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, memoryLimitSupport)
|
||||
|
||||
|
@ -50,7 +58,7 @@ func (s *DockerSuite) TestUpdateRunningContainerWithRestart(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), "524288000")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUpdateStoppedContainer(c *testing.T) {
|
||||
func (s *DockerCLIUpdateSuite) TestUpdateStoppedContainer(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, memoryLimitSupport)
|
||||
|
||||
|
@ -65,7 +73,7 @@ func (s *DockerSuite) TestUpdateStoppedContainer(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), "524288000")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUpdatePausedContainer(c *testing.T) {
|
||||
func (s *DockerCLIUpdateSuite) TestUpdatePausedContainer(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, cpuShare)
|
||||
|
||||
|
@ -82,7 +90,7 @@ func (s *DockerSuite) TestUpdatePausedContainer(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), "500")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUpdateWithUntouchedFields(c *testing.T) {
|
||||
func (s *DockerCLIUpdateSuite) TestUpdateWithUntouchedFields(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, memoryLimitSupport)
|
||||
testRequires(c, cpuShare)
|
||||
|
@ -100,7 +108,7 @@ func (s *DockerSuite) TestUpdateWithUntouchedFields(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), "800")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUpdateContainerInvalidValue(c *testing.T) {
|
||||
func (s *DockerCLIUpdateSuite) TestUpdateContainerInvalidValue(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, memoryLimitSupport)
|
||||
|
||||
|
@ -112,7 +120,7 @@ func (s *DockerSuite) TestUpdateContainerInvalidValue(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, expected))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUpdateContainerWithoutFlags(c *testing.T) {
|
||||
func (s *DockerCLIUpdateSuite) TestUpdateContainerWithoutFlags(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, memoryLimitSupport)
|
||||
|
||||
|
@ -122,7 +130,7 @@ func (s *DockerSuite) TestUpdateContainerWithoutFlags(c *testing.T) {
|
|||
assert.ErrorContains(c, err, "")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUpdateSwapMemoryOnly(c *testing.T) {
|
||||
func (s *DockerCLIUpdateSuite) TestUpdateSwapMemoryOnly(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, memoryLimitSupport)
|
||||
testRequires(c, swapMemorySupport)
|
||||
|
@ -138,7 +146,7 @@ func (s *DockerSuite) TestUpdateSwapMemoryOnly(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), "629145600")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUpdateInvalidSwapMemory(c *testing.T) {
|
||||
func (s *DockerCLIUpdateSuite) TestUpdateInvalidSwapMemory(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, memoryLimitSupport)
|
||||
testRequires(c, swapMemorySupport)
|
||||
|
@ -163,7 +171,7 @@ func (s *DockerSuite) TestUpdateInvalidSwapMemory(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), "629145600")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUpdateStats(c *testing.T) {
|
||||
func (s *DockerCLIUpdateSuite) TestUpdateStats(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, memoryLimitSupport)
|
||||
testRequires(c, cpuCfsQuota)
|
||||
|
@ -192,7 +200,7 @@ func (s *DockerSuite) TestUpdateStats(c *testing.T) {
|
|||
assert.Equal(c, preMemLimit, curMemLimit)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUpdateMemoryWithSwapMemory(c *testing.T) {
|
||||
func (s *DockerCLIUpdateSuite) TestUpdateMemoryWithSwapMemory(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
testRequires(c, memoryLimitSupport)
|
||||
testRequires(c, swapMemorySupport)
|
||||
|
@ -206,7 +214,7 @@ func (s *DockerSuite) TestUpdateMemoryWithSwapMemory(c *testing.T) {
|
|||
dockerCmd(c, "update", "--memory", "800M", "--memory-swap", "1000M", name)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUpdateNotAffectMonitorRestartPolicy(c *testing.T) {
|
||||
func (s *DockerCLIUpdateSuite) TestUpdateNotAffectMonitorRestartPolicy(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux, cpuShare)
|
||||
|
||||
out, _ := dockerCmd(c, "run", "-tid", "--restart=always", "busybox", "sh")
|
||||
|
@ -234,7 +242,7 @@ func (s *DockerSuite) TestUpdateNotAffectMonitorRestartPolicy(c *testing.T) {
|
|||
assert.NilError(c, waitRun(id))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestUpdateWithNanoCPUs(c *testing.T) {
|
||||
func (s *DockerCLIUpdateSuite) TestUpdateWithNanoCPUs(c *testing.T) {
|
||||
testRequires(c, cpuCfsQuota, cpuCfsPeriod)
|
||||
|
||||
file1 := "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"
|
||||
|
|
|
@ -18,7 +18,19 @@ import (
|
|||
"gotest.tools/v3/icmd"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLICreate(c *testing.T) {
|
||||
type DockerCLIVolumeSuite struct {
|
||||
ds *DockerSuite
|
||||
}
|
||||
|
||||
func (s *DockerCLIVolumeSuite) TearDownTest(c *testing.T) {
|
||||
s.ds.TearDownTest(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIVolumeSuite) OnTimeout(c *testing.T) {
|
||||
s.ds.OnTimeout(c)
|
||||
}
|
||||
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLICreate(c *testing.T) {
|
||||
dockerCmd(c, "volume", "create")
|
||||
|
||||
_, _, err := dockerCmdWithError("volume", "create", "-d", "nosuchdriver")
|
||||
|
@ -34,7 +46,7 @@ func (s *DockerSuite) TestVolumeCLICreate(c *testing.T) {
|
|||
assert.Equal(c, name, "test2")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLIInspect(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLIInspect(c *testing.T) {
|
||||
assert.Assert(c, exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run() != nil, "volume inspect should error on non-existent volume")
|
||||
out, _ := dockerCmd(c, "volume", "create")
|
||||
name := strings.TrimSpace(out)
|
||||
|
@ -46,7 +58,7 @@ func (s *DockerSuite) TestVolumeCLIInspect(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), "test")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLIInspectMulti(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLIInspectMulti(c *testing.T) {
|
||||
dockerCmd(c, "volume", "create", "test1")
|
||||
dockerCmd(c, "volume", "create", "test2")
|
||||
dockerCmd(c, "volume", "create", "test3")
|
||||
|
@ -63,7 +75,7 @@ func (s *DockerSuite) TestVolumeCLIInspectMulti(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "test3"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLILs(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLILs(c *testing.T) {
|
||||
prefix, _ := getPrefixAndSlashFromDaemonPlatform()
|
||||
dockerCmd(c, "volume", "create", "aaa")
|
||||
|
||||
|
@ -76,7 +88,7 @@ func (s *DockerSuite) TestVolumeCLILs(c *testing.T) {
|
|||
assertVolumesInList(c, out, []string{"aaa", "soo", "test"})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeLsFormat(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeLsFormat(c *testing.T) {
|
||||
dockerCmd(c, "volume", "create", "aaa")
|
||||
dockerCmd(c, "volume", "create", "test")
|
||||
dockerCmd(c, "volume", "create", "soo")
|
||||
|
@ -85,7 +97,7 @@ func (s *DockerSuite) TestVolumeLsFormat(c *testing.T) {
|
|||
assertVolumesInList(c, out, []string{"aaa", "soo", "test"})
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeLsFormatDefaultFormat(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeLsFormatDefaultFormat(c *testing.T) {
|
||||
dockerCmd(c, "volume", "create", "aaa")
|
||||
dockerCmd(c, "volume", "create", "test")
|
||||
dockerCmd(c, "volume", "create", "soo")
|
||||
|
@ -118,7 +130,7 @@ func assertVolumesInList(c *testing.T, out string, expected []string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLILsFilterDangling(c *testing.T) {
|
||||
prefix, _ := getPrefixAndSlashFromDaemonPlatform()
|
||||
dockerCmd(c, "volume", "create", "testnotinuse1")
|
||||
dockerCmd(c, "volume", "create", "testisinuse1")
|
||||
|
@ -163,19 +175,19 @@ func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "testisinuse2\n"), "expected volume 'testisinuse2' in output")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLILsErrorWithInvalidFilterName(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLILsErrorWithInvalidFilterName(c *testing.T) {
|
||||
out, _, err := dockerCmdWithError("volume", "ls", "-f", "FOO=123")
|
||||
assert.ErrorContains(c, err, "")
|
||||
assert.Assert(c, strings.Contains(out, "invalid filter"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLILsWithIncorrectFilterValue(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLILsWithIncorrectFilterValue(c *testing.T) {
|
||||
out, _, err := dockerCmdWithError("volume", "ls", "-f", "dangling=invalid")
|
||||
assert.ErrorContains(c, err, "")
|
||||
assert.Assert(c, strings.Contains(out, "invalid filter"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLIRm(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLIRm(c *testing.T) {
|
||||
prefix, _ := getPrefixAndSlashFromDaemonPlatform()
|
||||
out, _ := dockerCmd(c, "volume", "create")
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -207,7 +219,7 @@ func (s *DockerSuite) TestVolumeCLIRm(c *testing.T) {
|
|||
}
|
||||
|
||||
// FIXME(vdemeester) should be a unit test in cli/command/volume package
|
||||
func (s *DockerSuite) TestVolumeCLINoArgs(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLINoArgs(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "volume")
|
||||
// no args should produce the cmd usage output
|
||||
usage := "Usage: docker volume COMMAND"
|
||||
|
@ -229,7 +241,7 @@ func (s *DockerSuite) TestVolumeCLINoArgs(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(result.Stderr(), "unknown flag: --no-such-flag"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLIInspectTmplError(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLIInspectTmplError(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "volume", "create")
|
||||
name := strings.TrimSpace(out)
|
||||
|
||||
|
@ -239,7 +251,7 @@ func (s *DockerSuite) TestVolumeCLIInspectTmplError(c *testing.T) {
|
|||
assert.Assert(c, strings.Contains(out, "Template parsing error"))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLICreateWithOpts(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLICreateWithOpts(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
dockerCmd(c, "volume", "create", "-d", "local", "test", "--opt=type=tmpfs", "--opt=device=tmpfs", "--opt=o=size=1m,uid=1000")
|
||||
|
@ -263,7 +275,7 @@ func (s *DockerSuite) TestVolumeCLICreateWithOpts(c *testing.T) {
|
|||
assert.Equal(c, found, true)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLICreateLabel(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLICreateLabel(c *testing.T) {
|
||||
testVol := "testvolcreatelabel"
|
||||
testLabel := "foo"
|
||||
testValue := "bar"
|
||||
|
@ -275,7 +287,7 @@ func (s *DockerSuite) TestVolumeCLICreateLabel(c *testing.T) {
|
|||
assert.Equal(c, strings.TrimSpace(out), testValue)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLICreateLabelMultiple(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLICreateLabelMultiple(c *testing.T) {
|
||||
testVol := "testvolcreatelabel"
|
||||
|
||||
testLabels := map[string]string{
|
||||
|
@ -302,7 +314,7 @@ func (s *DockerSuite) TestVolumeCLICreateLabelMultiple(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLILsFilterLabels(c *testing.T) {
|
||||
testVol1 := "testvolcreatelabel-1"
|
||||
_, _, err := dockerCmdWithError("volume", "create", "--label", "foo=bar1", testVol1)
|
||||
assert.NilError(c, err)
|
||||
|
@ -330,7 +342,7 @@ func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *testing.T) {
|
|||
assert.Equal(c, len(outArr), 1, fmt.Sprintf("\n%s", out))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLILsFilterDrivers(c *testing.T) {
|
||||
// using default volume driver local to create volumes
|
||||
testVol1 := "testvol-1"
|
||||
_, _, err := dockerCmdWithError("volume", "create", testVol1)
|
||||
|
@ -360,7 +372,7 @@ func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *testing.T) {
|
|||
assert.Equal(c, len(outArr), 1, fmt.Sprintf("\n%s", out))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLIRmForceUsage(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLIRmForceUsage(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "volume", "create")
|
||||
id := strings.TrimSpace(out)
|
||||
|
||||
|
@ -368,7 +380,7 @@ func (s *DockerSuite) TestVolumeCLIRmForceUsage(c *testing.T) {
|
|||
dockerCmd(c, "volume", "rm", "--force", "nonexist")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCLIRmForce(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLIRmForce(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
|
||||
|
||||
name := "test"
|
||||
|
@ -392,7 +404,7 @@ func (s *DockerSuite) TestVolumeCLIRmForce(c *testing.T) {
|
|||
|
||||
// TestVolumeCLIRmForceInUse verifies that repeated `docker volume rm -f` calls does not remove a volume
|
||||
// if it is in use. Test case for https://github.com/docker/docker/issues/31446
|
||||
func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCLIRmForceInUse(c *testing.T) {
|
||||
name := "testvolume"
|
||||
out, _ := dockerCmd(c, "volume", "create", name)
|
||||
id := strings.TrimSpace(out)
|
||||
|
@ -428,7 +440,7 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *testing.T) {
|
|||
assert.Assert(c, !strings.Contains(out, name))
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestVolumeCliInspectWithVolumeOpts(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestVolumeCliInspectWithVolumeOpts(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
// Without options
|
||||
|
@ -449,7 +461,7 @@ func (s *DockerSuite) TestVolumeCliInspectWithVolumeOpts(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test case (1) for 21845: duplicate targets for --volumes-from
|
||||
func (s *DockerSuite) TestDuplicateMountpointsForVolumesFrom(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestDuplicateMountpointsForVolumesFrom(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
image := "vimage"
|
||||
|
@ -490,7 +502,7 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFrom(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test case (2) for 21845: duplicate targets for --volumes-from and -v (bind)
|
||||
func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndBind(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestDuplicateMountpointsForVolumesFromAndBind(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
image := "vimage"
|
||||
|
@ -532,7 +544,7 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndBind(c *testing.T
|
|||
}
|
||||
|
||||
// Test case (3) for 21845: duplicate targets for --volumes-from and `Mounts` (API only)
|
||||
func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c *testing.T) {
|
||||
func (s *DockerCLIVolumeSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
|
||||
|
||||
image := "vimage"
|
||||
|
|
|
@ -18,7 +18,7 @@ func formatV123StartAPIURL(url string) string {
|
|||
return "/v1.23" + url
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDeprecatedContainerAPIStartHostConfig(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestDeprecatedContainerAPIStartHostConfig(c *testing.T) {
|
||||
name := "test-deprecated-api-124"
|
||||
dockerCmd(c, "create", "--name", name, "busybox")
|
||||
config := map[string]interface{}{
|
||||
|
@ -37,7 +37,7 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartHostConfig(c *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumeBinds(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestDeprecatedContainerAPIStartVolumeBinds(c *testing.T) {
|
||||
// TODO Windows CI: Investigate further why this fails on Windows to Windows CI.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
path := "/foo"
|
||||
|
@ -68,7 +68,7 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumeBinds(c *testing.T) {
|
|||
}
|
||||
|
||||
// Test for GH#10618
|
||||
func (s *DockerSuite) TestDeprecatedContainerAPIStartDupVolumeBinds(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestDeprecatedContainerAPIStartDupVolumeBinds(c *testing.T) {
|
||||
// TODO Windows to Windows CI - Port this
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "testdups"
|
||||
|
@ -101,7 +101,7 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartDupVolumeBinds(c *testing.T
|
|||
assert.Assert(c, strings.Contains(string(buf), "Duplicate mount point"), "Expected failure due to duplicate bind mounts to same path, instead got: %q with error: %v", string(buf), err)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumesFrom(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestDeprecatedContainerAPIStartVolumesFrom(c *testing.T) {
|
||||
// TODO Windows to Windows CI - Port this
|
||||
testRequires(c, DaemonIsLinux)
|
||||
volName := "voltst"
|
||||
|
@ -134,7 +134,7 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumesFrom(c *testing.T) {
|
|||
}
|
||||
|
||||
// #9981 - Allow a docker created volume (ie, one in /var/lib/docker/volumes) to be used to overwrite (via passing in Binds on api start) an existing volume
|
||||
func (s *DockerSuite) TestDeprecatedPostContainerBindNormalVolume(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestDeprecatedPostContainerBindNormalVolume(c *testing.T) {
|
||||
// TODO Windows to Windows CI - Port this
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "create", "-v", "/foo", "--name=one", "busybox")
|
||||
|
@ -154,7 +154,7 @@ func (s *DockerSuite) TestDeprecatedPostContainerBindNormalVolume(c *testing.T)
|
|||
assert.Equal(c, fooDir2, fooDir, "expected volume path to be %s, got: %s", fooDir, fooDir2)
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDeprecatedStartWithTooLowMemoryLimit(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestDeprecatedStartWithTooLowMemoryLimit(c *testing.T) {
|
||||
// TODO Windows: Port once memory is supported
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "create", "busybox")
|
||||
|
@ -179,7 +179,7 @@ func (s *DockerSuite) TestDeprecatedStartWithTooLowMemoryLimit(c *testing.T) {
|
|||
}
|
||||
|
||||
// #14640
|
||||
func (s *DockerSuite) TestDeprecatedPostContainersStartWithoutLinksInHostConfig(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestDeprecatedPostContainersStartWithoutLinksInHostConfig(c *testing.T) {
|
||||
// TODO Windows: Windows doesn't support supplying a hostconfig on start.
|
||||
// An alternate test could be written to validate the negative testing aspect of this
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
@ -196,7 +196,7 @@ func (s *DockerSuite) TestDeprecatedPostContainersStartWithoutLinksInHostConfig(
|
|||
}
|
||||
|
||||
// #14640
|
||||
func (s *DockerSuite) TestDeprecatedPostContainersStartWithLinksInHostConfig(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestDeprecatedPostContainersStartWithLinksInHostConfig(c *testing.T) {
|
||||
// TODO Windows: Windows doesn't support supplying a hostconfig on start.
|
||||
// An alternate test could be written to validate the negative testing aspect of this
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
@ -214,7 +214,7 @@ func (s *DockerSuite) TestDeprecatedPostContainersStartWithLinksInHostConfig(c *
|
|||
}
|
||||
|
||||
// #14640
|
||||
func (s *DockerSuite) TestDeprecatedPostContainersStartWithLinksInHostConfigIdLinked(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestDeprecatedPostContainersStartWithLinksInHostConfigIdLinked(c *testing.T) {
|
||||
// Windows does not support links
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-host-config-links"
|
||||
|
@ -233,7 +233,7 @@ func (s *DockerSuite) TestDeprecatedPostContainersStartWithLinksInHostConfigIdLi
|
|||
b.Close()
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestDeprecatedStartWithNilDNS(c *testing.T) {
|
||||
func (s *DockerAPISuite) TestDeprecatedStartWithNilDNS(c *testing.T) {
|
||||
// TODO Windows: Add once DNS is supported
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "create", "busybox")
|
||||
|
|
Loading…
Reference in a new issue