Browse code

integ-cli: skip tests launching registry-v2

Some pull/push tests are launching `registry-v2`
binary which is compiled and installed if the tests
are running in-container through `make test-integration-cli`.

However, registry is not supported to run on non-linux
platforms and we can't really spin up any registry-v2
containers in the remote DOCKER_TEST_HOST at this point.

Just skipping those with the new TestRequirement called
`RegistryHosting`.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>

Ahmet Alp Balkan authored on 2015/02/25 16:19:59
Showing 2 changed files
... ...
@@ -901,6 +901,7 @@ func readContainerFileWithExec(containerId, filename string) ([]byte, error) {
901 901
 }
902 902
 
903 903
 func setupRegistry(t *testing.T) func() {
904
+	testRequires(t, RegistryHosting)
904 905
 	reg, err := newTestRegistryV2(t)
905 906
 	if err != nil {
906 907
 		t.Fatal(err)
... ...
@@ -1,6 +1,8 @@
1 1
 package main
2 2
 
3 3
 import (
4
+	"fmt"
5
+	"os/exec"
4 6
 	"testing"
5 7
 )
6 8
 
... ...
@@ -25,6 +27,16 @@ var (
25 25
 		func() bool { return supportsExec },
26 26
 		"Test requires 'docker exec' capabilities on the tested daemon.",
27 27
 	}
28
+	RegistryHosting = TestRequirement{
29
+		func() bool {
30
+			// for now registry binary is built only if we're running inside
31
+			// container through `make test`. Figure that out by testing if
32
+			// registry binary is in PATH.
33
+			_, err := exec.LookPath(v2binary)
34
+			return err == nil
35
+		},
36
+		fmt.Sprintf("Test requires an environment that can host %s in the same host", v2binary),
37
+	}
28 38
 )
29 39
 
30 40
 // testRequires checks if the environment satisfies the requirements