Browse code

Validate we're not using the old testing stuff

Signed-off-by: Doug Davis <dug@us.ibm.com>

Doug Davis authored on 2015/04/23 03:20:32
Showing 4 changed files
... ...
@@ -77,7 +77,7 @@ test-docker-py: build
77 77
 	$(DOCKER_RUN_DOCKER) hack/make.sh binary test-docker-py
78 78
 
79 79
 validate: build
80
-	$(DOCKER_RUN_DOCKER) hack/make.sh validate-dco validate-gofmt validate-toml validate-vet
80
+	$(DOCKER_RUN_DOCKER) hack/make.sh validate-dco validate-gofmt validate-test validate-toml validate-vet
81 81
 
82 82
 shell: build
83 83
 	$(DOCKER_RUN_DOCKER) bash
... ...
@@ -46,6 +46,7 @@ echo
46 46
 DEFAULT_BUNDLES=(
47 47
 	validate-dco
48 48
 	validate-gofmt
49
+	validate-test
49 50
 	validate-toml
50 51
 	validate-vet
51 52
 
52 53
new file mode 100644
... ...
@@ -0,0 +1,35 @@
0
+#!/bin/bash
1
+
2
+# Make sure we're not using gos' Testing package any more in integration-cli
3
+
4
+source "${MAKEDIR}/.validate"
5
+
6
+IFS=$'\n'
7
+files=( $(validate_diff --diff-filter=ACMR --name-only -- 'integration-cli/*.go' || true) )
8
+unset IFS
9
+
10
+badFiles=()
11
+for f in "${files[@]}"; do
12
+	# skip check_test.go since it *does* use the testing package
13
+	if [ "$f" = "integration-cli/check_test.go" ]; then
14
+		continue
15
+	fi
16
+
17
+	# we use "git show" here to validate that what's committed is formatted
18
+	if git show "$VALIDATE_HEAD:$f" | grep -q testing.T; then
19
+		badFiles+=( "$f" )
20
+	fi
21
+done
22
+
23
+if [ ${#badFiles[@]} -eq 0 ]; then
24
+	echo 'Congratulations! No testing.T found.'
25
+else
26
+	{
27
+		echo "These files use the wrong testing infrastructure:"
28
+		for f in "${badFiles[@]}"; do
29
+			echo " - $f"
30
+		done
31
+		echo
32
+	} >&2
33
+	false
34
+fi
... ...
@@ -8,7 +8,9 @@ import (
8 8
 	"github.com/go-check/check"
9 9
 )
10 10
 
11
-func Test(t *testing.T) { check.TestingT(t) }
11
+func Test(t *testing.T) {
12
+	check.TestingT(t)
13
+}
12 14
 
13 15
 type TimerSuite struct {
14 16
 	start time.Time