Browse code

Fix integration-cli suite setup requirements

This PR moves the testRequires check from within setupRegistry
and setupNotary to when the Suite itself starts up.

This fixes a bug where testRequires() in setupRegistry() would
succeed and start registry, but testRequires() in setupNotary()
would fail. This immediately exits the goroutine with registry
still running.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>

Christopher Jones authored on 2016/01/30 06:35:20
Showing 2 changed files
... ...
@@ -48,7 +48,7 @@ type DockerRegistrySuite struct {
48 48
 }
49 49
 
50 50
 func (s *DockerRegistrySuite) SetUpTest(c *check.C) {
51
-	testRequires(c, DaemonIsLinux)
51
+	testRequires(c, DaemonIsLinux, RegistryHosting)
52 52
 	s.reg = setupRegistry(c, false, false)
53 53
 	s.d = NewDaemon(c)
54 54
 }
... ...
@@ -76,7 +76,7 @@ type DockerSchema1RegistrySuite struct {
76 76
 }
77 77
 
78 78
 func (s *DockerSchema1RegistrySuite) SetUpTest(c *check.C) {
79
-	testRequires(c, DaemonIsLinux)
79
+	testRequires(c, DaemonIsLinux, RegistryHosting)
80 80
 	s.reg = setupRegistry(c, true, false)
81 81
 	s.d = NewDaemon(c)
82 82
 }
... ...
@@ -104,7 +104,7 @@ type DockerRegistryAuthSuite struct {
104 104
 }
105 105
 
106 106
 func (s *DockerRegistryAuthSuite) SetUpTest(c *check.C) {
107
-	testRequires(c, DaemonIsLinux)
107
+	testRequires(c, DaemonIsLinux, RegistryHosting)
108 108
 	s.reg = setupRegistry(c, false, true)
109 109
 	s.d = NewDaemon(c)
110 110
 }
... ...
@@ -158,6 +158,7 @@ type DockerTrustSuite struct {
158 158
 }
159 159
 
160 160
 func (s *DockerTrustSuite) SetUpTest(c *check.C) {
161
+	testRequires(c, RegistryHosting, NotaryHosting)
161 162
 	s.reg = setupRegistry(c, false, false)
162 163
 	s.not = setupNotary(c)
163 164
 }
... ...
@@ -1573,7 +1573,6 @@ func daemonTime(c *check.C) time.Time {
1573 1573
 }
1574 1574
 
1575 1575
 func setupRegistry(c *check.C, schema1, auth bool) *testRegistryV2 {
1576
-	testRequires(c, RegistryHosting)
1577 1576
 	reg, err := newTestRegistryV2(c, schema1, auth)
1578 1577
 	c.Assert(err, check.IsNil)
1579 1578
 
... ...
@@ -1590,7 +1589,6 @@ func setupRegistry(c *check.C, schema1, auth bool) *testRegistryV2 {
1590 1590
 }
1591 1591
 
1592 1592
 func setupNotary(c *check.C) *testNotary {
1593
-	testRequires(c, NotaryHosting)
1594 1593
 	ts, err := newTestNotary(c)
1595 1594
 	c.Assert(err, check.IsNil)
1596 1595