github.com/adityamillind98/moby@v23.0.0-rc.4+incompatible/integration-cli/check_test.go (about)

     1  package main
     2  
     3  import (
     4  	"context"
     5  	"flag"
     6  	"fmt"
     7  	"net/http/httptest"
     8  	"os"
     9  	"path"
    10  	"path/filepath"
    11  	"strconv"
    12  	"sync"
    13  	"syscall"
    14  	"testing"
    15  	"time"
    16  
    17  	"github.com/docker/docker/integration-cli/cli"
    18  	"github.com/docker/docker/integration-cli/daemon"
    19  	"github.com/docker/docker/integration-cli/environment"
    20  	"github.com/docker/docker/internal/test/suite"
    21  	"github.com/docker/docker/pkg/reexec"
    22  	testdaemon "github.com/docker/docker/testutil/daemon"
    23  	ienv "github.com/docker/docker/testutil/environment"
    24  	"github.com/docker/docker/testutil/fakestorage"
    25  	"github.com/docker/docker/testutil/fixtures/plugin"
    26  	"github.com/docker/docker/testutil/registry"
    27  	"gotest.tools/v3/assert"
    28  )
    29  
    30  const (
    31  	// the private registry to use for tests
    32  	privateRegistryURL = registry.DefaultURL
    33  
    34  	// path to containerd's ctr binary
    35  	ctrBinary = "ctr"
    36  
    37  	// the docker daemon binary to use
    38  	dockerdBinary = "dockerd"
    39  )
    40  
    41  var (
    42  	testEnv *environment.Execution
    43  
    44  	// the docker client binary to use
    45  	dockerBinary = ""
    46  
    47  	testEnvOnce sync.Once
    48  )
    49  
    50  func init() {
    51  	var err error
    52  
    53  	reexec.Init() // This is required for external graphdriver tests
    54  
    55  	testEnv, err = environment.New()
    56  	if err != nil {
    57  		panic(err)
    58  	}
    59  }
    60  
    61  func TestMain(m *testing.M) {
    62  	flag.Parse()
    63  
    64  	// Global set up
    65  	dockerBinary = testEnv.DockerBinary()
    66  	err := ienv.EnsureFrozenImagesLinux(&testEnv.Execution)
    67  	if err != nil {
    68  		fmt.Println(err)
    69  		os.Exit(1)
    70  	}
    71  
    72  	testEnv.Print()
    73  	os.Exit(m.Run())
    74  }
    75  
    76  func ensureTestEnvSetup(t *testing.T) {
    77  	testEnvOnce.Do(func() {
    78  		cli.SetTestEnvironment(testEnv)
    79  		fakestorage.SetTestEnvironment(&testEnv.Execution)
    80  		ienv.ProtectAll(t, &testEnv.Execution)
    81  	})
    82  }
    83  
    84  func TestDockerAPISuite(t *testing.T) {
    85  	ensureTestEnvSetup(t)
    86  	suite.Run(t, &DockerAPISuite{ds: &DockerSuite{}})
    87  }
    88  
    89  func TestDockerBenchmarkSuite(t *testing.T) {
    90  	ensureTestEnvSetup(t)
    91  	suite.Run(t, &DockerBenchmarkSuite{ds: &DockerSuite{}})
    92  }
    93  
    94  func TestDockerCLIAttachSuite(t *testing.T) {
    95  	ensureTestEnvSetup(t)
    96  	suite.Run(t, &DockerCLIAttachSuite{ds: &DockerSuite{}})
    97  }
    98  
    99  func TestDockerCLIBuildSuite(t *testing.T) {
   100  	ensureTestEnvSetup(t)
   101  	suite.Run(t, &DockerCLIBuildSuite{ds: &DockerSuite{}})
   102  }
   103  
   104  func TestDockerCLICommitSuite(t *testing.T) {
   105  	ensureTestEnvSetup(t)
   106  	suite.Run(t, &DockerCLICommitSuite{ds: &DockerSuite{}})
   107  }
   108  
   109  func TestDockerCLICpSuite(t *testing.T) {
   110  	ensureTestEnvSetup(t)
   111  	suite.Run(t, &DockerCLICpSuite{ds: &DockerSuite{}})
   112  }
   113  
   114  func TestDockerCLICreateSuite(t *testing.T) {
   115  	ensureTestEnvSetup(t)
   116  	suite.Run(t, &DockerCLICreateSuite{ds: &DockerSuite{}})
   117  }
   118  
   119  func TestDockerCLIEventSuite(t *testing.T) {
   120  	ensureTestEnvSetup(t)
   121  	suite.Run(t, &DockerCLIEventSuite{ds: &DockerSuite{}})
   122  }
   123  
   124  func TestDockerCLIExecSuite(t *testing.T) {
   125  	ensureTestEnvSetup(t)
   126  	suite.Run(t, &DockerCLIExecSuite{ds: &DockerSuite{}})
   127  }
   128  
   129  func TestDockerCLIHealthSuite(t *testing.T) {
   130  	ensureTestEnvSetup(t)
   131  	suite.Run(t, &DockerCLIHealthSuite{ds: &DockerSuite{}})
   132  }
   133  
   134  func TestDockerCLIHistorySuite(t *testing.T) {
   135  	ensureTestEnvSetup(t)
   136  	suite.Run(t, &DockerCLIHistorySuite{ds: &DockerSuite{}})
   137  }
   138  
   139  func TestDockerCLIImagesSuite(t *testing.T) {
   140  	ensureTestEnvSetup(t)
   141  	suite.Run(t, &DockerCLIImagesSuite{ds: &DockerSuite{}})
   142  }
   143  
   144  func TestDockerCLIImportSuite(t *testing.T) {
   145  	ensureTestEnvSetup(t)
   146  	suite.Run(t, &DockerCLIImportSuite{ds: &DockerSuite{}})
   147  }
   148  
   149  func TestDockerCLIInfoSuite(t *testing.T) {
   150  	ensureTestEnvSetup(t)
   151  	suite.Run(t, &DockerCLIInfoSuite{ds: &DockerSuite{}})
   152  }
   153  
   154  func TestDockerCLIInspectSuite(t *testing.T) {
   155  	ensureTestEnvSetup(t)
   156  	suite.Run(t, &DockerCLIInspectSuite{ds: &DockerSuite{}})
   157  }
   158  
   159  func TestDockerCLILinksSuite(t *testing.T) {
   160  	ensureTestEnvSetup(t)
   161  	suite.Run(t, &DockerCLILinksSuite{ds: &DockerSuite{}})
   162  }
   163  
   164  func TestDockerCLILoginSuite(t *testing.T) {
   165  	ensureTestEnvSetup(t)
   166  	suite.Run(t, &DockerCLILoginSuite{ds: &DockerSuite{}})
   167  }
   168  
   169  func TestDockerCLILogsSuite(t *testing.T) {
   170  	ensureTestEnvSetup(t)
   171  	suite.Run(t, &DockerCLILogsSuite{ds: &DockerSuite{}})
   172  }
   173  
   174  func TestDockerCLINetmodeSuite(t *testing.T) {
   175  	ensureTestEnvSetup(t)
   176  	suite.Run(t, &DockerCLINetmodeSuite{ds: &DockerSuite{}})
   177  }
   178  
   179  func TestDockerCLINetworkSuite(t *testing.T) {
   180  	ensureTestEnvSetup(t)
   181  	suite.Run(t, &DockerCLINetworkSuite{ds: &DockerSuite{}})
   182  }
   183  
   184  func TestDockerCLIPluginLogDriverSuite(t *testing.T) {
   185  	ensureTestEnvSetup(t)
   186  	suite.Run(t, &DockerCLIPluginLogDriverSuite{ds: &DockerSuite{}})
   187  }
   188  
   189  func TestDockerCLIPluginsSuite(t *testing.T) {
   190  	ensureTestEnvSetup(t)
   191  	suite.Run(t, &DockerCLIPluginsSuite{ds: &DockerSuite{}})
   192  }
   193  
   194  func TestDockerCLIPortSuite(t *testing.T) {
   195  	ensureTestEnvSetup(t)
   196  	suite.Run(t, &DockerCLIPortSuite{ds: &DockerSuite{}})
   197  }
   198  
   199  func TestDockerCLIProxySuite(t *testing.T) {
   200  	ensureTestEnvSetup(t)
   201  	suite.Run(t, &DockerCLIProxySuite{ds: &DockerSuite{}})
   202  }
   203  
   204  func TestDockerCLIPruneSuite(t *testing.T) {
   205  	ensureTestEnvSetup(t)
   206  	suite.Run(t, &DockerCLIPruneSuite{ds: &DockerSuite{}})
   207  }
   208  
   209  func TestDockerCLIPsSuite(t *testing.T) {
   210  	ensureTestEnvSetup(t)
   211  	suite.Run(t, &DockerCLIPsSuite{ds: &DockerSuite{}})
   212  }
   213  
   214  func TestDockerCLIPullSuite(t *testing.T) {
   215  	ensureTestEnvSetup(t)
   216  	suite.Run(t, &DockerCLIPullSuite{ds: &DockerSuite{}})
   217  }
   218  
   219  func TestDockerCLIPushSuite(t *testing.T) {
   220  	ensureTestEnvSetup(t)
   221  	suite.Run(t, &DockerCLIPushSuite{ds: &DockerSuite{}})
   222  }
   223  
   224  func TestDockerCLIRestartSuite(t *testing.T) {
   225  	ensureTestEnvSetup(t)
   226  	suite.Run(t, &DockerCLIRestartSuite{ds: &DockerSuite{}})
   227  }
   228  
   229  func TestDockerCLIRmiSuite(t *testing.T) {
   230  	ensureTestEnvSetup(t)
   231  	suite.Run(t, &DockerCLIRmiSuite{ds: &DockerSuite{}})
   232  }
   233  
   234  func TestDockerCLIRunSuite(t *testing.T) {
   235  	ensureTestEnvSetup(t)
   236  	suite.Run(t, &DockerCLIRunSuite{ds: &DockerSuite{}})
   237  }
   238  
   239  func TestDockerCLISaveLoadSuite(t *testing.T) {
   240  	ensureTestEnvSetup(t)
   241  	suite.Run(t, &DockerCLISaveLoadSuite{ds: &DockerSuite{}})
   242  }
   243  
   244  func TestDockerCLISearchSuite(t *testing.T) {
   245  	ensureTestEnvSetup(t)
   246  	suite.Run(t, &DockerCLISearchSuite{ds: &DockerSuite{}})
   247  }
   248  
   249  func TestDockerCLISNISuite(t *testing.T) {
   250  	ensureTestEnvSetup(t)
   251  	suite.Run(t, &DockerCLISNISuite{ds: &DockerSuite{}})
   252  }
   253  
   254  func TestDockerCLIStartSuite(t *testing.T) {
   255  	ensureTestEnvSetup(t)
   256  	suite.Run(t, &DockerCLIStartSuite{ds: &DockerSuite{}})
   257  }
   258  
   259  func TestDockerCLIStatsSuite(t *testing.T) {
   260  	ensureTestEnvSetup(t)
   261  	suite.Run(t, &DockerCLIStatsSuite{ds: &DockerSuite{}})
   262  }
   263  
   264  func TestDockerCLITopSuite(t *testing.T) {
   265  	ensureTestEnvSetup(t)
   266  	suite.Run(t, &DockerCLITopSuite{ds: &DockerSuite{}})
   267  }
   268  
   269  func TestDockerCLIUpdateSuite(t *testing.T) {
   270  	ensureTestEnvSetup(t)
   271  	suite.Run(t, &DockerCLIUpdateSuite{ds: &DockerSuite{}})
   272  }
   273  
   274  func TestDockerCLIVolumeSuite(t *testing.T) {
   275  	ensureTestEnvSetup(t)
   276  	suite.Run(t, &DockerCLIVolumeSuite{ds: &DockerSuite{}})
   277  }
   278  
   279  func TestDockerRegistrySuite(t *testing.T) {
   280  	ensureTestEnvSetup(t)
   281  	suite.Run(t, &DockerRegistrySuite{ds: &DockerSuite{}})
   282  }
   283  
   284  func TestDockerSchema1RegistrySuite(t *testing.T) {
   285  	ensureTestEnvSetup(t)
   286  	suite.Run(t, &DockerSchema1RegistrySuite{ds: &DockerSuite{}})
   287  }
   288  
   289  func TestDockerRegistryAuthHtpasswdSuite(t *testing.T) {
   290  	ensureTestEnvSetup(t)
   291  	suite.Run(t, &DockerRegistryAuthHtpasswdSuite{ds: &DockerSuite{}})
   292  }
   293  
   294  func TestDockerRegistryAuthTokenSuite(t *testing.T) {
   295  	ensureTestEnvSetup(t)
   296  	suite.Run(t, &DockerRegistryAuthTokenSuite{ds: &DockerSuite{}})
   297  }
   298  
   299  func TestDockerDaemonSuite(t *testing.T) {
   300  	ensureTestEnvSetup(t)
   301  	suite.Run(t, &DockerDaemonSuite{ds: &DockerSuite{}})
   302  }
   303  
   304  func TestDockerSwarmSuite(t *testing.T) {
   305  	ensureTestEnvSetup(t)
   306  	suite.Run(t, &DockerSwarmSuite{ds: &DockerSuite{}})
   307  }
   308  
   309  func TestDockerPluginSuite(t *testing.T) {
   310  	ensureTestEnvSetup(t)
   311  	suite.Run(t, &DockerPluginSuite{ds: &DockerSuite{}})
   312  }
   313  
   314  func TestDockerExternalVolumeSuite(t *testing.T) {
   315  	ensureTestEnvSetup(t)
   316  	testRequires(t, DaemonIsLinux)
   317  	suite.Run(t, &DockerExternalVolumeSuite{ds: &DockerSuite{}})
   318  }
   319  
   320  func TestDockerNetworkSuite(t *testing.T) {
   321  	ensureTestEnvSetup(t)
   322  	testRequires(t, DaemonIsLinux)
   323  	suite.Run(t, &DockerNetworkSuite{ds: &DockerSuite{}})
   324  }
   325  
   326  func TestDockerHubPullSuite(t *testing.T) {
   327  	ensureTestEnvSetup(t)
   328  	// FIXME. Temporarily turning this off for Windows as GH16039 was breaking
   329  	// Windows to Linux CI @icecrime
   330  	testRequires(t, DaemonIsLinux)
   331  	suite.Run(t, newDockerHubPullSuite())
   332  }
   333  
   334  type DockerSuite struct {
   335  }
   336  
   337  func (s *DockerSuite) OnTimeout(c *testing.T) {
   338  	if testEnv.IsRemoteDaemon() {
   339  		return
   340  	}
   341  	path := filepath.Join(os.Getenv("DEST"), "docker.pid")
   342  	b, err := os.ReadFile(path)
   343  	if err != nil {
   344  		c.Fatalf("Failed to get daemon PID from %s\n", path)
   345  	}
   346  
   347  	rawPid, err := strconv.ParseInt(string(b), 10, 32)
   348  	if err != nil {
   349  		c.Fatalf("Failed to parse pid from %s: %s\n", path, err)
   350  	}
   351  
   352  	daemonPid := int(rawPid)
   353  	if daemonPid > 0 {
   354  		testdaemon.SignalDaemonDump(daemonPid)
   355  	}
   356  }
   357  
   358  func (s *DockerSuite) TearDownTest(c *testing.T) {
   359  	testEnv.Clean(c)
   360  }
   361  
   362  type DockerRegistrySuite struct {
   363  	ds  *DockerSuite
   364  	reg *registry.V2
   365  	d   *daemon.Daemon
   366  }
   367  
   368  func (s *DockerRegistrySuite) OnTimeout(c *testing.T) {
   369  	s.d.DumpStackAndQuit()
   370  }
   371  
   372  func (s *DockerRegistrySuite) SetUpTest(c *testing.T) {
   373  	testRequires(c, DaemonIsLinux, RegistryHosting, testEnv.IsLocalDaemon)
   374  	s.reg = registry.NewV2(c)
   375  	s.reg.WaitReady(c)
   376  	s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
   377  }
   378  
   379  func (s *DockerRegistrySuite) TearDownTest(c *testing.T) {
   380  	if s.reg != nil {
   381  		s.reg.Close()
   382  	}
   383  	if s.d != nil {
   384  		s.d.Stop(c)
   385  	}
   386  	s.ds.TearDownTest(c)
   387  }
   388  
   389  type DockerSchema1RegistrySuite struct {
   390  	ds  *DockerSuite
   391  	reg *registry.V2
   392  	d   *daemon.Daemon
   393  }
   394  
   395  func (s *DockerSchema1RegistrySuite) OnTimeout(c *testing.T) {
   396  	s.d.DumpStackAndQuit()
   397  }
   398  
   399  func (s *DockerSchema1RegistrySuite) SetUpTest(c *testing.T) {
   400  	testRequires(c, DaemonIsLinux, RegistryHosting, NotArm64, testEnv.IsLocalDaemon)
   401  	s.reg = registry.NewV2(c, registry.Schema1)
   402  	s.reg.WaitReady(c)
   403  	s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
   404  }
   405  
   406  func (s *DockerSchema1RegistrySuite) TearDownTest(c *testing.T) {
   407  	if s.reg != nil {
   408  		s.reg.Close()
   409  	}
   410  	if s.d != nil {
   411  		s.d.Stop(c)
   412  	}
   413  	s.ds.TearDownTest(c)
   414  }
   415  
   416  type DockerRegistryAuthHtpasswdSuite struct {
   417  	ds  *DockerSuite
   418  	reg *registry.V2
   419  	d   *daemon.Daemon
   420  }
   421  
   422  func (s *DockerRegistryAuthHtpasswdSuite) OnTimeout(c *testing.T) {
   423  	s.d.DumpStackAndQuit()
   424  }
   425  
   426  func (s *DockerRegistryAuthHtpasswdSuite) SetUpTest(c *testing.T) {
   427  	testRequires(c, DaemonIsLinux, RegistryHosting, testEnv.IsLocalDaemon)
   428  	s.reg = registry.NewV2(c, registry.Htpasswd)
   429  	s.reg.WaitReady(c)
   430  	s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
   431  }
   432  
   433  func (s *DockerRegistryAuthHtpasswdSuite) TearDownTest(c *testing.T) {
   434  	if s.reg != nil {
   435  		out, err := s.d.Cmd("logout", privateRegistryURL)
   436  		assert.NilError(c, err, out)
   437  		s.reg.Close()
   438  	}
   439  	if s.d != nil {
   440  		s.d.Stop(c)
   441  	}
   442  	s.ds.TearDownTest(c)
   443  }
   444  
   445  type DockerRegistryAuthTokenSuite struct {
   446  	ds  *DockerSuite
   447  	reg *registry.V2
   448  	d   *daemon.Daemon
   449  }
   450  
   451  func (s *DockerRegistryAuthTokenSuite) OnTimeout(c *testing.T) {
   452  	s.d.DumpStackAndQuit()
   453  }
   454  
   455  func (s *DockerRegistryAuthTokenSuite) SetUpTest(c *testing.T) {
   456  	testRequires(c, DaemonIsLinux, RegistryHosting, testEnv.IsLocalDaemon)
   457  	s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
   458  }
   459  
   460  func (s *DockerRegistryAuthTokenSuite) TearDownTest(c *testing.T) {
   461  	if s.reg != nil {
   462  		out, err := s.d.Cmd("logout", privateRegistryURL)
   463  		assert.NilError(c, err, out)
   464  		s.reg.Close()
   465  	}
   466  	if s.d != nil {
   467  		s.d.Stop(c)
   468  	}
   469  	s.ds.TearDownTest(c)
   470  }
   471  
   472  func (s *DockerRegistryAuthTokenSuite) setupRegistryWithTokenService(c *testing.T, tokenURL string) {
   473  	if s == nil {
   474  		c.Fatal("registry suite isn't initialized")
   475  	}
   476  	s.reg = registry.NewV2(c, registry.Token(tokenURL))
   477  	s.reg.WaitReady(c)
   478  }
   479  
   480  type DockerDaemonSuite struct {
   481  	ds *DockerSuite
   482  	d  *daemon.Daemon
   483  }
   484  
   485  func (s *DockerDaemonSuite) OnTimeout(c *testing.T) {
   486  	s.d.DumpStackAndQuit()
   487  }
   488  
   489  func (s *DockerDaemonSuite) SetUpTest(c *testing.T) {
   490  	testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
   491  	s.d = daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
   492  }
   493  
   494  func (s *DockerDaemonSuite) TearDownTest(c *testing.T) {
   495  	testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
   496  	if s.d != nil {
   497  		s.d.Stop(c)
   498  	}
   499  	s.ds.TearDownTest(c)
   500  }
   501  
   502  func (s *DockerDaemonSuite) TearDownSuite(c *testing.T) {
   503  	filepath.Walk(testdaemon.SockRoot, func(path string, fi os.FileInfo, err error) error {
   504  		if err != nil {
   505  			// ignore errors here
   506  			// not cleaning up sockets is not really an error
   507  			return nil
   508  		}
   509  		if fi.Mode() == os.ModeSocket {
   510  			syscall.Unlink(path)
   511  		}
   512  		return nil
   513  	})
   514  	os.RemoveAll(testdaemon.SockRoot)
   515  }
   516  
   517  const defaultSwarmPort = 2477
   518  
   519  type DockerSwarmSuite struct {
   520  	server      *httptest.Server
   521  	ds          *DockerSuite
   522  	daemonsLock sync.Mutex // protect access to daemons and portIndex
   523  	daemons     []*daemon.Daemon
   524  	portIndex   int
   525  }
   526  
   527  func (s *DockerSwarmSuite) OnTimeout(c *testing.T) {
   528  	s.daemonsLock.Lock()
   529  	defer s.daemonsLock.Unlock()
   530  	for _, d := range s.daemons {
   531  		d.DumpStackAndQuit()
   532  	}
   533  }
   534  
   535  func (s *DockerSwarmSuite) SetUpTest(c *testing.T) {
   536  	testRequires(c, DaemonIsLinux, testEnv.IsLocalDaemon)
   537  }
   538  
   539  func (s *DockerSwarmSuite) AddDaemon(c *testing.T, joinSwarm, manager bool) *daemon.Daemon {
   540  	c.Helper()
   541  	d := daemon.New(c, dockerBinary, dockerdBinary,
   542  		testdaemon.WithEnvironment(testEnv.Execution),
   543  		testdaemon.WithSwarmPort(defaultSwarmPort+s.portIndex),
   544  	)
   545  	if joinSwarm {
   546  		if len(s.daemons) > 0 {
   547  			d.StartAndSwarmJoin(c, s.daemons[0].Daemon, manager)
   548  		} else {
   549  			d.StartAndSwarmInit(c)
   550  		}
   551  	} else {
   552  		d.StartNodeWithBusybox(c)
   553  	}
   554  
   555  	s.daemonsLock.Lock()
   556  	s.portIndex++
   557  	s.daemons = append(s.daemons, d)
   558  	s.daemonsLock.Unlock()
   559  
   560  	return d
   561  }
   562  
   563  func (s *DockerSwarmSuite) TearDownTest(c *testing.T) {
   564  	testRequires(c, DaemonIsLinux)
   565  	s.daemonsLock.Lock()
   566  	for _, d := range s.daemons {
   567  		if d != nil {
   568  			d.Stop(c)
   569  			d.Cleanup(c)
   570  		}
   571  	}
   572  	s.daemons = nil
   573  	s.portIndex = 0
   574  	s.daemonsLock.Unlock()
   575  	s.ds.TearDownTest(c)
   576  }
   577  
   578  type DockerPluginSuite struct {
   579  	ds       *DockerSuite
   580  	registry *registry.V2
   581  }
   582  
   583  func (ps *DockerPluginSuite) registryHost() string {
   584  	return privateRegistryURL
   585  }
   586  
   587  func (ps *DockerPluginSuite) getPluginRepo() string {
   588  	return path.Join(ps.registryHost(), "plugin", "basic")
   589  }
   590  func (ps *DockerPluginSuite) getPluginRepoWithTag() string {
   591  	return ps.getPluginRepo() + ":" + "latest"
   592  }
   593  
   594  func (ps *DockerPluginSuite) SetUpSuite(c *testing.T) {
   595  	testRequires(c, DaemonIsLinux, RegistryHosting)
   596  	ps.registry = registry.NewV2(c)
   597  	ps.registry.WaitReady(c)
   598  
   599  	ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
   600  	defer cancel()
   601  
   602  	err := plugin.CreateInRegistry(ctx, ps.getPluginRepo(), nil)
   603  	assert.NilError(c, err, "failed to create plugin")
   604  }
   605  
   606  func (ps *DockerPluginSuite) TearDownSuite(c *testing.T) {
   607  	if ps.registry != nil {
   608  		ps.registry.Close()
   609  	}
   610  }
   611  
   612  func (ps *DockerPluginSuite) TearDownTest(c *testing.T) {
   613  	ps.ds.TearDownTest(c)
   614  }
   615  
   616  func (ps *DockerPluginSuite) OnTimeout(c *testing.T) {
   617  	ps.ds.OnTimeout(c)
   618  }