1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/hack/make/validate-test
Brian Goff ff91276d1f Move some test fixtures to go
moves ensure-frozen-images to go
moves ensure-syscall-test to go
moves ensure-nnp-test to go
moves ensure-httpserver to go

Also makes some of the fixtures load only for the required tests.
This makes sure that fixtures that won't be needed for a test run such as
`make TESTFLAGS='-check.f Swarm' test-integration-cli` (for example)
aren't loaded... like the syscall tests.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-09-07 17:30:35 -04:00

38 lines
912 B
Bash

#!/bin/bash
# Make sure we're not using gos' Testing package any more in integration-cli
source "${MAKEDIR}/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'integration-cli/*.go' || true) )
unset IFS
badFiles=()
for f in "${files[@]}"; do
# skip check_test.go since it *does* use the testing package
if [ "$f" = "integration-cli/check_test.go" ]; then
continue
fi
# we use "git show" here to validate that what's committed doesn't contain golang built-in testing
if git show "$VALIDATE_HEAD:$f" | grep -q testing.T; then
if [ "$(echo $f | grep '_test')" ]; then
# allow testing.T for non- _test files
badFiles+=( "$f" )
fi
fi
done
if [ ${#badFiles[@]} -eq 0 ]; then
echo 'Congratulations! No testing.T found.'
else
{
echo "These files use the wrong testing infrastructure:"
for f in "${badFiles[@]}"; do
echo " - $f"
done
echo
} >&2
false
fi