ea1e4c38fa
This reverts commit cdfc94f4e965adf0eb2e29590b84be66f62b3199, reversing changes made to 2051cd3e1ca6ca825fd650646b6718ee05cf3eda. Conflicts: config/config.go config/config_test.go config/etc_hosts.go config/etcd.go config/file.go config/fleet.go config/oem.go config/unit.go config/update.go config/user.go initialize/config.go initialize/config_test.go initialize/env.go initialize/manage_etc_hosts.go initialize/workspace.go system/env.go system/etc_hosts_test.go system/etcd.go system/etcd_test.go system/fleet.go system/fleet_test.go system/oem.go system/oem_test.go system/systemd.go system/update.go system/update_test.go test
64 lines
1.1 KiB
Bash
Executable File
64 lines
1.1 KiB
Bash
Executable File
#!/bin/bash -e
|
|
#
|
|
# Run all coreos-cloudinit tests
|
|
# ./test
|
|
# ./test -v
|
|
#
|
|
# Run tests for one package
|
|
# PKG=initialize ./test
|
|
#
|
|
|
|
# Invoke ./cover for HTML output
|
|
COVER=${COVER:-"-cover"}
|
|
|
|
source ./build
|
|
|
|
declare -a TESTPKGS=(
|
|
datasource
|
|
datasource/configdrive
|
|
datasource/file
|
|
datasource/metadata
|
|
datasource/metadata/cloudsigma
|
|
datasource/metadata/digitalocean
|
|
datasource/metadata/ec2
|
|
datasource/proc_cmdline
|
|
datasource/url
|
|
datasource/waagent
|
|
initialize
|
|
network
|
|
pkg
|
|
system
|
|
)
|
|
|
|
if [ -z "$PKG" ]; then
|
|
GOFMTPATH="${TESTPKGS[*]} coreos-cloudinit.go"
|
|
# prepend repo path to each package
|
|
TESTPKGS="${TESTPKGS[*]/#/${REPO_PATH}/} ./"
|
|
else
|
|
GOFMTPATH="$TESTPKGS"
|
|
# strip out slashes and dots from PKG=./foo/
|
|
TESTPKGS=${PKG//\//}
|
|
TESTPKGS=${TESTPKGS//./}
|
|
TESTPKGS=${TESTPKGS/#/${REPO_PATH}/}
|
|
fi
|
|
|
|
echo "Running tests..."
|
|
go test -i ${TESTPKGS}
|
|
go test ${COVER} $@ ${TESTPKGS}
|
|
|
|
echo "Checking gofmt..."
|
|
fmtRes=$(gofmt -l $GOFMTPATH)
|
|
if [ -n "$fmtRes" ]; then
|
|
echo "$fmtRes"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Checking govet..."
|
|
vetRes=$(go vet $TESTPKGS)
|
|
if [ -n "${vetRes}" ]; then
|
|
echo -e "govet checking failed:\n${vetRes}"
|
|
exit 255
|
|
fi
|
|
|
|
echo "Success"
|