2015-04-18 16:46:47 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2018-04-19 22:30:59 +00:00
|
|
|
"context"
|
2019-08-09 00:38:35 +00:00
|
|
|
"flag"
|
2015-06-05 20:09:53 +00:00
|
|
|
"fmt"
|
2016-10-15 17:20:34 +00:00
|
|
|
"net/http/httptest"
|
2016-03-09 08:18:30 +00:00
|
|
|
"os"
|
2017-07-12 20:31:13 +00:00
|
|
|
"path"
|
2016-03-09 08:18:30 +00:00
|
|
|
"path/filepath"
|
2017-08-25 22:48:36 +00:00
|
|
|
"strconv"
|
2016-06-29 18:00:11 +00:00
|
|
|
"sync"
|
2016-07-28 14:19:09 +00:00
|
|
|
"syscall"
|
2015-04-18 16:46:47 +00:00
|
|
|
"testing"
|
2017-07-12 20:31:13 +00:00
|
|
|
"time"
|
2015-04-18 16:46:47 +00:00
|
|
|
|
2017-03-23 17:35:22 +00:00
|
|
|
"github.com/docker/docker/integration-cli/cli"
|
2016-12-09 09:17:53 +00:00
|
|
|
"github.com/docker/docker/integration-cli/daemon"
|
2016-12-25 19:28:38 +00:00
|
|
|
"github.com/docker/docker/integration-cli/environment"
|
2019-08-09 00:38:35 +00:00
|
|
|
"github.com/docker/docker/internal/test/suite"
|
2023-07-14 18:02:38 +00:00
|
|
|
"github.com/docker/docker/testutil"
|
2019-08-29 20:52:40 +00:00
|
|
|
testdaemon "github.com/docker/docker/testutil/daemon"
|
|
|
|
ienv "github.com/docker/docker/testutil/environment"
|
|
|
|
"github.com/docker/docker/testutil/fakestorage"
|
|
|
|
"github.com/docker/docker/testutil/fixtures/plugin"
|
|
|
|
"github.com/docker/docker/testutil/registry"
|
2023-07-14 18:02:38 +00:00
|
|
|
"go.opentelemetry.io/otel"
|
|
|
|
"go.opentelemetry.io/otel/attribute"
|
|
|
|
"go.opentelemetry.io/otel/codes"
|
2020-02-07 13:39:24 +00:00
|
|
|
"gotest.tools/v3/assert"
|
2015-04-18 16:46:47 +00:00
|
|
|
)
|
|
|
|
|
2016-12-25 19:28:38 +00:00
|
|
|
const (
|
|
|
|
// the private registry to use for tests
|
2018-04-13 08:45:34 +00:00
|
|
|
privateRegistryURL = registry.DefaultURL
|
2016-12-25 19:28:38 +00:00
|
|
|
|
|
|
|
// path to containerd's ctr binary
|
2018-09-21 22:58:34 +00:00
|
|
|
ctrBinary = "ctr"
|
2016-12-25 19:28:38 +00:00
|
|
|
|
|
|
|
// the docker daemon binary to use
|
|
|
|
dockerdBinary = "dockerd"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2023-07-14 18:02:38 +00:00
|
|
|
testEnvOnce sync.Once
|
|
|
|
testEnv *environment.Execution
|
2016-12-25 19:28:38 +00:00
|
|
|
|
|
|
|
// the docker client binary to use
|
2017-04-17 23:18:46 +00:00
|
|
|
dockerBinary = ""
|
2019-09-12 18:05:18 +00:00
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
baseContext context.Context
|
2016-12-25 19:28:38 +00:00
|
|
|
)
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func TestMain(m *testing.M) {
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
os.Exit(testRun(m))
|
|
|
|
}
|
|
|
|
|
|
|
|
func testRun(m *testing.M) (ret int) {
|
|
|
|
// Global set up
|
|
|
|
|
2016-12-25 19:28:38 +00:00
|
|
|
var err error
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
shutdown := testutil.ConfigureTracing()
|
|
|
|
ctx, span := otel.Tracer("").Start(context.Background(), "integration-cli/TestMain")
|
|
|
|
defer func() {
|
|
|
|
if err != nil {
|
|
|
|
span.SetStatus(codes.Error, err.Error())
|
|
|
|
ret = 255
|
|
|
|
} else {
|
|
|
|
if ret != 0 {
|
|
|
|
span.SetAttributes(attribute.Int("exitCode", ret))
|
|
|
|
span.SetStatus(codes.Error, "m.Run() exited with non-zero code")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
span.End()
|
|
|
|
shutdown(ctx)
|
|
|
|
}()
|
|
|
|
|
|
|
|
baseContext = ctx
|
|
|
|
|
|
|
|
testEnv, err = environment.New(ctx)
|
2016-12-25 19:28:38 +00:00
|
|
|
if err != nil {
|
2023-07-14 18:02:38 +00:00
|
|
|
return
|
2016-12-25 19:28:38 +00:00
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
if testEnv.IsLocalDaemon() {
|
|
|
|
setupLocalInfo()
|
|
|
|
}
|
2019-08-09 00:38:35 +00:00
|
|
|
|
2017-03-23 17:35:22 +00:00
|
|
|
dockerBinary = testEnv.DockerBinary()
|
2023-07-14 18:02:38 +00:00
|
|
|
|
|
|
|
err = ienv.EnsureFrozenImagesLinux(ctx, &testEnv.Execution)
|
2017-10-24 18:24:25 +00:00
|
|
|
if err != nil {
|
2023-07-14 18:02:38 +00:00
|
|
|
return
|
2017-10-24 18:24:25 +00:00
|
|
|
}
|
|
|
|
|
2017-08-25 22:48:36 +00:00
|
|
|
testEnv.Print()
|
2023-04-19 12:48:47 +00:00
|
|
|
printCliVersion()
|
2023-07-14 18:02:38 +00:00
|
|
|
|
|
|
|
return m.Run()
|
2016-12-25 19:28:38 +00:00
|
|
|
}
|
2015-06-05 20:09:53 +00:00
|
|
|
|
2023-04-19 12:48:47 +00:00
|
|
|
func printCliVersion() {
|
|
|
|
// Print output of "docker version"
|
|
|
|
cli.SetTestEnvironment(testEnv)
|
|
|
|
cmd := cli.Docker(cli.Args("version"))
|
|
|
|
if cmd.Error != nil {
|
2023-07-05 10:12:16 +00:00
|
|
|
fmt.Printf("WARNING: Failed to run 'docker version': %+v\n", cmd.Error)
|
2023-04-19 12:48:47 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("INFO: Testing with docker cli version:")
|
|
|
|
fmt.Println(cmd.Stdout())
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func ensureTestEnvSetup(ctx context.Context, t *testing.T) {
|
2019-09-12 18:05:18 +00:00
|
|
|
testEnvOnce.Do(func() {
|
|
|
|
cli.SetTestEnvironment(testEnv)
|
|
|
|
fakestorage.SetTestEnvironment(&testEnv.Execution)
|
2023-07-14 18:02:38 +00:00
|
|
|
ienv.ProtectAll(ctx, t, &testEnv.Execution)
|
2019-09-12 18:05:18 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-06-16 21:32:10 +00:00
|
|
|
func TestDockerAPISuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerAPISuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerBenchmarkSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerBenchmarkSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIAttachSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIAttachSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIBuildSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIBuildSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLICommitSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLICommitSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLICpSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLICpSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLICreateSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLICreateSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIEventSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIEventSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIExecSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIExecSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIHealthSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIHealthSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIHistorySuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIHistorySuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIImagesSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIImagesSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIImportSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIImportSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIInfoSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIInfoSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIInspectSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIInspectSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLILinksSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLILinksSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLILoginSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLILoginSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLILogsSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLILogsSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLINetmodeSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLINetmodeSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLINetworkSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLINetworkSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIPluginLogDriverSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIPluginLogDriverSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIPluginsSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIPluginsSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIPortSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIPortSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIProxySuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIProxySuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIPruneSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIPruneSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIPsSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIPsSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIPullSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIPullSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIPushSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIPushSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIRestartSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIRestartSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIRmiSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIRmiSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIRunSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIRunSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLISaveLoadSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLISaveLoadSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLISearchSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLISearchSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLISNISuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLISNISuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIStartSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIStartSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIStatsSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIStatsSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLITopSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLITopSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIUpdateSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIUpdateSuite{ds: &DockerSuite{}})
|
2022-06-16 21:32:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerCLIVolumeSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerCLIVolumeSuite{ds: &DockerSuite{}})
|
2019-09-12 18:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerRegistrySuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerRegistrySuite{ds: &DockerSuite{}})
|
2019-09-12 18:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerSchema1RegistrySuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerSchema1RegistrySuite{ds: &DockerSuite{}})
|
2019-09-12 18:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerRegistryAuthHtpasswdSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerRegistryAuthHtpasswdSuite{ds: &DockerSuite{}})
|
2019-09-12 18:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerRegistryAuthTokenSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerRegistryAuthTokenSuite{ds: &DockerSuite{}})
|
2019-09-12 18:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerDaemonSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerDaemonSuite{ds: &DockerSuite{}})
|
2019-09-12 18:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerSwarmSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerSwarmSuite{ds: &DockerSuite{}})
|
2019-09-12 18:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerPluginSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerPluginSuite{ds: &DockerSuite{}})
|
2019-09-12 18:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerExternalVolumeSuite(t *testing.T) {
|
|
|
|
testRequires(t, DaemonIsLinux)
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerExternalVolumeSuite{ds: &DockerSuite{}})
|
2019-09-12 18:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerNetworkSuite(t *testing.T) {
|
|
|
|
testRequires(t, DaemonIsLinux)
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
|
|
|
suite.Run(ctx, t, &DockerNetworkSuite{ds: &DockerSuite{}})
|
2019-09-12 18:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDockerHubPullSuite(t *testing.T) {
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx := testutil.StartSpan(baseContext, t)
|
|
|
|
ensureTestEnvSetup(ctx, t)
|
2019-09-12 18:05:18 +00:00
|
|
|
// FIXME. Temporarily turning this off for Windows as GH16039 was breaking
|
|
|
|
// Windows to Linux CI @icecrime
|
|
|
|
testRequires(t, DaemonIsLinux)
|
2023-07-14 18:02:38 +00:00
|
|
|
suite.Run(ctx, t, newDockerHubPullSuite())
|
2015-04-24 21:16:56 +00:00
|
|
|
}
|
|
|
|
|
2022-01-20 12:43:42 +00:00
|
|
|
type DockerSuite struct{}
|
2015-04-18 16:46:47 +00:00
|
|
|
|
2019-09-09 21:05:55 +00:00
|
|
|
func (s *DockerSuite) OnTimeout(c *testing.T) {
|
2018-03-02 13:45:14 +00:00
|
|
|
if testEnv.IsRemoteDaemon() {
|
2017-09-13 21:00:55 +00:00
|
|
|
return
|
|
|
|
}
|
2017-08-25 22:48:36 +00:00
|
|
|
path := filepath.Join(os.Getenv("DEST"), "docker.pid")
|
2021-08-24 10:10:50 +00:00
|
|
|
b, err := os.ReadFile(path)
|
2017-08-25 22:48:36 +00:00
|
|
|
if err != nil {
|
|
|
|
c.Fatalf("Failed to get daemon PID from %s\n", path)
|
|
|
|
}
|
|
|
|
|
|
|
|
rawPid, err := strconv.ParseInt(string(b), 10, 32)
|
|
|
|
if err != nil {
|
|
|
|
c.Fatalf("Failed to parse pid from %s: %s\n", path, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
daemonPid := int(rawPid)
|
2017-09-13 21:00:55 +00:00
|
|
|
if daemonPid > 0 {
|
2018-04-10 14:29:48 +00:00
|
|
|
testdaemon.SignalDaemonDump(daemonPid)
|
2016-07-27 18:17:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerSuite) TearDownTest(ctx context.Context, c *testing.T) {
|
|
|
|
testEnv.Clean(ctx, c)
|
2015-04-18 16:46:47 +00:00
|
|
|
}
|
|
|
|
|
2015-04-24 21:16:56 +00:00
|
|
|
type DockerRegistrySuite struct {
|
|
|
|
ds *DockerSuite
|
2016-12-30 18:10:04 +00:00
|
|
|
reg *registry.V2
|
2016-12-09 09:17:53 +00:00
|
|
|
d *daemon.Daemon
|
2015-04-24 21:16:56 +00:00
|
|
|
}
|
|
|
|
|
2019-09-09 21:05:55 +00:00
|
|
|
func (s *DockerRegistrySuite) OnTimeout(c *testing.T) {
|
2016-07-27 18:17:44 +00:00
|
|
|
s.d.DumpStackAndQuit()
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerRegistrySuite) SetUpTest(ctx context.Context, c *testing.T) {
|
2018-12-24 12:25:53 +00:00
|
|
|
testRequires(c, DaemonIsLinux, RegistryHosting, testEnv.IsLocalDaemon)
|
2018-04-13 08:45:34 +00:00
|
|
|
s.reg = registry.NewV2(c)
|
|
|
|
s.reg.WaitReady(c)
|
2018-04-13 15:02:56 +00:00
|
|
|
s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
|
2015-04-24 21:16:56 +00:00
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerRegistrySuite) TearDownTest(ctx context.Context, c *testing.T) {
|
2015-07-23 09:40:54 +00:00
|
|
|
if s.reg != nil {
|
|
|
|
s.reg.Close()
|
|
|
|
}
|
2016-01-13 09:51:01 +00:00
|
|
|
if s.d != nil {
|
2016-12-09 22:20:14 +00:00
|
|
|
s.d.Stop(c)
|
2015-07-23 09:40:54 +00:00
|
|
|
}
|
2023-07-14 18:02:38 +00:00
|
|
|
s.ds.TearDownTest(ctx, c)
|
2015-04-24 21:16:56 +00:00
|
|
|
}
|
2015-04-26 02:47:42 +00:00
|
|
|
|
2019-06-17 21:50:31 +00:00
|
|
|
type DockerSchema1RegistrySuite struct {
|
|
|
|
ds *DockerSuite
|
|
|
|
reg *registry.V2
|
|
|
|
d *daemon.Daemon
|
|
|
|
}
|
|
|
|
|
2019-09-09 21:05:55 +00:00
|
|
|
func (s *DockerSchema1RegistrySuite) OnTimeout(c *testing.T) {
|
2019-06-17 21:50:31 +00:00
|
|
|
s.d.DumpStackAndQuit()
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerSchema1RegistrySuite) SetUpTest(ctx context.Context, c *testing.T) {
|
2019-06-17 21:50:31 +00:00
|
|
|
testRequires(c, DaemonIsLinux, RegistryHosting, NotArm64, testEnv.IsLocalDaemon)
|
|
|
|
s.reg = registry.NewV2(c, registry.Schema1)
|
|
|
|
s.reg.WaitReady(c)
|
|
|
|
s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerSchema1RegistrySuite) TearDownTest(ctx context.Context, c *testing.T) {
|
2019-06-17 21:50:31 +00:00
|
|
|
if s.reg != nil {
|
|
|
|
s.reg.Close()
|
|
|
|
}
|
|
|
|
if s.d != nil {
|
|
|
|
s.d.Stop(c)
|
|
|
|
}
|
2023-07-14 18:02:38 +00:00
|
|
|
s.ds.TearDownTest(ctx, c)
|
2019-06-17 21:50:31 +00:00
|
|
|
}
|
|
|
|
|
2016-03-14 20:11:35 +00:00
|
|
|
type DockerRegistryAuthHtpasswdSuite struct {
|
2016-01-23 18:45:01 +00:00
|
|
|
ds *DockerSuite
|
2016-12-30 18:10:04 +00:00
|
|
|
reg *registry.V2
|
2016-12-09 09:17:53 +00:00
|
|
|
d *daemon.Daemon
|
2016-01-23 18:45:01 +00:00
|
|
|
}
|
|
|
|
|
2019-09-09 21:05:55 +00:00
|
|
|
func (s *DockerRegistryAuthHtpasswdSuite) OnTimeout(c *testing.T) {
|
2016-07-27 18:17:44 +00:00
|
|
|
s.d.DumpStackAndQuit()
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerRegistryAuthHtpasswdSuite) SetUpTest(ctx context.Context, c *testing.T) {
|
2018-12-24 12:25:53 +00:00
|
|
|
testRequires(c, DaemonIsLinux, RegistryHosting, testEnv.IsLocalDaemon)
|
2018-04-13 08:45:34 +00:00
|
|
|
s.reg = registry.NewV2(c, registry.Htpasswd)
|
|
|
|
s.reg.WaitReady(c)
|
2018-04-13 15:02:56 +00:00
|
|
|
s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
|
2016-01-23 18:45:01 +00:00
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerRegistryAuthHtpasswdSuite) TearDownTest(ctx context.Context, c *testing.T) {
|
2016-01-23 18:45:01 +00:00
|
|
|
if s.reg != nil {
|
|
|
|
out, err := s.d.Cmd("logout", privateRegistryURL)
|
2019-04-04 13:23:19 +00:00
|
|
|
assert.NilError(c, err, out)
|
2016-01-23 18:45:01 +00:00
|
|
|
s.reg.Close()
|
|
|
|
}
|
|
|
|
if s.d != nil {
|
2016-12-09 22:20:14 +00:00
|
|
|
s.d.Stop(c)
|
2016-01-23 18:45:01 +00:00
|
|
|
}
|
2023-07-14 18:02:38 +00:00
|
|
|
s.ds.TearDownTest(ctx, c)
|
2016-01-23 18:45:01 +00:00
|
|
|
}
|
|
|
|
|
2016-03-14 20:11:35 +00:00
|
|
|
type DockerRegistryAuthTokenSuite struct {
|
|
|
|
ds *DockerSuite
|
2016-12-30 18:10:04 +00:00
|
|
|
reg *registry.V2
|
2016-12-09 09:17:53 +00:00
|
|
|
d *daemon.Daemon
|
2016-03-14 20:11:35 +00:00
|
|
|
}
|
|
|
|
|
2019-09-09 21:05:55 +00:00
|
|
|
func (s *DockerRegistryAuthTokenSuite) OnTimeout(c *testing.T) {
|
2016-07-27 18:17:44 +00:00
|
|
|
s.d.DumpStackAndQuit()
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerRegistryAuthTokenSuite) SetUpTest(ctx context.Context, c *testing.T) {
|
2018-12-24 12:25:53 +00:00
|
|
|
testRequires(c, DaemonIsLinux, RegistryHosting, testEnv.IsLocalDaemon)
|
2018-04-13 15:02:56 +00:00
|
|
|
s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
|
2016-03-14 20:11:35 +00:00
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerRegistryAuthTokenSuite) TearDownTest(ctx context.Context, c *testing.T) {
|
2016-03-14 20:11:35 +00:00
|
|
|
if s.reg != nil {
|
|
|
|
out, err := s.d.Cmd("logout", privateRegistryURL)
|
2019-04-04 13:23:19 +00:00
|
|
|
assert.NilError(c, err, out)
|
2016-03-14 20:11:35 +00:00
|
|
|
s.reg.Close()
|
|
|
|
}
|
|
|
|
if s.d != nil {
|
2016-12-09 22:20:14 +00:00
|
|
|
s.d.Stop(c)
|
2016-03-14 20:11:35 +00:00
|
|
|
}
|
2023-07-14 18:02:38 +00:00
|
|
|
s.ds.TearDownTest(ctx, c)
|
2016-03-14 20:11:35 +00:00
|
|
|
}
|
|
|
|
|
2019-09-09 21:05:55 +00:00
|
|
|
func (s *DockerRegistryAuthTokenSuite) setupRegistryWithTokenService(c *testing.T, tokenURL string) {
|
2016-03-14 20:11:35 +00:00
|
|
|
if s == nil {
|
|
|
|
c.Fatal("registry suite isn't initialized")
|
|
|
|
}
|
2018-04-13 08:45:34 +00:00
|
|
|
s.reg = registry.NewV2(c, registry.Token(tokenURL))
|
|
|
|
s.reg.WaitReady(c)
|
2016-03-14 20:11:35 +00:00
|
|
|
}
|
|
|
|
|
2015-04-26 02:47:42 +00:00
|
|
|
type DockerDaemonSuite struct {
|
|
|
|
ds *DockerSuite
|
2016-12-09 09:17:53 +00:00
|
|
|
d *daemon.Daemon
|
2015-04-26 02:47:42 +00:00
|
|
|
}
|
|
|
|
|
2019-09-09 21:05:55 +00:00
|
|
|
func (s *DockerDaemonSuite) OnTimeout(c *testing.T) {
|
2016-07-27 18:17:44 +00:00
|
|
|
s.d.DumpStackAndQuit()
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerDaemonSuite) SetUpTest(ctx context.Context, c *testing.T) {
|
2018-12-24 12:25:53 +00:00
|
|
|
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
2018-04-13 15:02:56 +00:00
|
|
|
s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
|
2015-04-26 02:47:42 +00:00
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerDaemonSuite) TearDownTest(ctx context.Context, c *testing.T) {
|
2018-12-24 12:25:53 +00:00
|
|
|
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
2016-01-13 09:51:01 +00:00
|
|
|
if s.d != nil {
|
2016-12-09 22:20:14 +00:00
|
|
|
s.d.Stop(c)
|
2016-01-13 09:51:01 +00:00
|
|
|
}
|
2023-07-14 18:02:38 +00:00
|
|
|
s.ds.TearDownTest(ctx, c)
|
2015-04-26 02:47:42 +00:00
|
|
|
}
|
2015-07-20 05:56:10 +00:00
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerDaemonSuite) TearDownSuite(ctx context.Context, c *testing.T) {
|
2018-04-10 14:29:48 +00:00
|
|
|
filepath.Walk(testdaemon.SockRoot, func(path string, fi os.FileInfo, err error) error {
|
2016-07-28 14:19:09 +00:00
|
|
|
if err != nil {
|
2016-08-10 19:18:35 +00:00
|
|
|
// ignore errors here
|
|
|
|
// not cleaning up sockets is not really an error
|
|
|
|
return nil
|
2016-07-28 14:19:09 +00:00
|
|
|
}
|
|
|
|
if fi.Mode() == os.ModeSocket {
|
|
|
|
syscall.Unlink(path)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
})
|
2018-04-10 14:29:48 +00:00
|
|
|
os.RemoveAll(testdaemon.SockRoot)
|
2016-07-28 14:19:09 +00:00
|
|
|
}
|
|
|
|
|
2016-06-14 02:54:20 +00:00
|
|
|
const defaultSwarmPort = 2477
|
|
|
|
|
|
|
|
type DockerSwarmSuite struct {
|
2016-10-15 17:20:34 +00:00
|
|
|
server *httptest.Server
|
2016-06-29 18:00:11 +00:00
|
|
|
ds *DockerSuite
|
2019-07-13 01:13:37 +00:00
|
|
|
daemonsLock sync.Mutex // protect access to daemons and portIndex
|
2018-04-11 10:10:17 +00:00
|
|
|
daemons []*daemon.Daemon
|
2016-06-29 18:00:11 +00:00
|
|
|
portIndex int
|
2016-06-14 02:54:20 +00:00
|
|
|
}
|
|
|
|
|
2019-09-09 21:05:55 +00:00
|
|
|
func (s *DockerSwarmSuite) OnTimeout(c *testing.T) {
|
2016-07-27 18:17:44 +00:00
|
|
|
s.daemonsLock.Lock()
|
|
|
|
defer s.daemonsLock.Unlock()
|
|
|
|
for _, d := range s.daemons {
|
|
|
|
d.DumpStackAndQuit()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerSwarmSuite) SetUpTest(ctx context.Context, c *testing.T) {
|
2018-12-24 12:25:53 +00:00
|
|
|
testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
|
2016-06-14 02:54:20 +00:00
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerSwarmSuite) AddDaemon(ctx context.Context, c *testing.T, joinSwarm, manager bool) *daemon.Daemon {
|
2019-10-21 10:40:22 +00:00
|
|
|
c.Helper()
|
2018-04-13 15:02:56 +00:00
|
|
|
d := daemon.New(c, dockerBinary, dockerdBinary,
|
|
|
|
testdaemon.WithEnvironment(testEnv.Execution),
|
|
|
|
testdaemon.WithSwarmPort(defaultSwarmPort+s.portIndex),
|
|
|
|
)
|
2017-10-17 03:30:05 +00:00
|
|
|
if joinSwarm {
|
2016-06-14 02:54:20 +00:00
|
|
|
if len(s.daemons) > 0 {
|
2023-07-14 18:02:38 +00:00
|
|
|
d.StartAndSwarmJoin(ctx, c, s.daemons[0].Daemon, manager)
|
2016-07-20 18:15:08 +00:00
|
|
|
} else {
|
2023-07-14 18:02:38 +00:00
|
|
|
d.StartAndSwarmInit(ctx, c)
|
2016-06-14 02:54:20 +00:00
|
|
|
}
|
2018-04-13 15:02:56 +00:00
|
|
|
} else {
|
2023-07-14 18:02:38 +00:00
|
|
|
d.StartNodeWithBusybox(ctx, c)
|
2016-06-14 02:54:20 +00:00
|
|
|
}
|
|
|
|
|
2016-06-29 18:00:11 +00:00
|
|
|
s.daemonsLock.Lock()
|
2019-07-13 01:13:37 +00:00
|
|
|
s.portIndex++
|
2016-06-14 02:54:20 +00:00
|
|
|
s.daemons = append(s.daemons, d)
|
2016-06-29 18:00:11 +00:00
|
|
|
s.daemonsLock.Unlock()
|
2016-06-14 02:54:20 +00:00
|
|
|
|
|
|
|
return d
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (s *DockerSwarmSuite) TearDownTest(ctx context.Context, c *testing.T) {
|
2016-06-14 02:54:20 +00:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2016-06-29 18:00:11 +00:00
|
|
|
s.daemonsLock.Lock()
|
2016-06-14 02:54:20 +00:00
|
|
|
for _, d := range s.daemons {
|
2016-11-21 17:37:13 +00:00
|
|
|
if d != nil {
|
2016-12-09 22:20:14 +00:00
|
|
|
d.Stop(c)
|
2018-04-17 10:00:38 +00:00
|
|
|
d.Cleanup(c)
|
2016-11-21 17:37:13 +00:00
|
|
|
}
|
2016-06-14 02:54:20 +00:00
|
|
|
}
|
|
|
|
s.daemons = nil
|
2016-06-29 18:00:11 +00:00
|
|
|
s.portIndex = 0
|
2019-07-13 01:13:37 +00:00
|
|
|
s.daemonsLock.Unlock()
|
2023-07-14 18:02:38 +00:00
|
|
|
s.ds.TearDownTest(ctx, c)
|
2016-06-14 02:54:20 +00:00
|
|
|
}
|
|
|
|
|
2017-07-12 20:31:13 +00:00
|
|
|
type DockerPluginSuite struct {
|
|
|
|
ds *DockerSuite
|
|
|
|
registry *registry.V2
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ps *DockerPluginSuite) registryHost() string {
|
|
|
|
return privateRegistryURL
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ps *DockerPluginSuite) getPluginRepo() string {
|
|
|
|
return path.Join(ps.registryHost(), "plugin", "basic")
|
|
|
|
}
|
2022-01-20 12:43:42 +00:00
|
|
|
|
2017-07-12 20:31:13 +00:00
|
|
|
func (ps *DockerPluginSuite) getPluginRepoWithTag() string {
|
|
|
|
return ps.getPluginRepo() + ":" + "latest"
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (ps *DockerPluginSuite) SetUpSuite(ctx context.Context, c *testing.T) {
|
2018-04-13 08:45:34 +00:00
|
|
|
testRequires(c, DaemonIsLinux, RegistryHosting)
|
|
|
|
ps.registry = registry.NewV2(c)
|
|
|
|
ps.registry.WaitReady(c)
|
2017-07-12 20:31:13 +00:00
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
ctx, cancel := context.WithTimeout(ctx, 60*time.Second)
|
2017-07-12 20:31:13 +00:00
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
err := plugin.CreateInRegistry(ctx, ps.getPluginRepo(), nil)
|
2019-04-04 13:23:19 +00:00
|
|
|
assert.NilError(c, err, "failed to create plugin")
|
2017-07-12 20:31:13 +00:00
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (ps *DockerPluginSuite) TearDownSuite(ctx context.Context, c *testing.T) {
|
2017-07-12 20:31:13 +00:00
|
|
|
if ps.registry != nil {
|
|
|
|
ps.registry.Close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:38 +00:00
|
|
|
func (ps *DockerPluginSuite) TearDownTest(ctx context.Context, c *testing.T) {
|
|
|
|
ps.ds.TearDownTest(ctx, c)
|
2017-07-12 20:31:13 +00:00
|
|
|
}
|
|
|
|
|
2019-09-09 21:05:55 +00:00
|
|
|
func (ps *DockerPluginSuite) OnTimeout(c *testing.T) {
|
2017-07-12 20:31:13 +00:00
|
|
|
ps.ds.OnTimeout(c)
|
|
|
|
}
|