Skip to content

Commit

Permalink
Merge pull request #971 from spencerhance/e2e-tests-add-network
Browse files Browse the repository at this point in the history
e2e test run.sh add network
  • Loading branch information
k8s-ci-robot committed Dec 18, 2019
2 parents adb33c8 + 6071e8a commit 5ac41e7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/e2e-test/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ func TestMain(m *testing.M) {
os.Exit(1)
}
if flags.network == "" {
// TODO(shance): Make this a required flag, error out here
fmt.Println("-network must be set to the network of the cluster")
fmt.Fprintln(os.Stderr, "-network must be set to the network of the cluster")
os.Exit(1)
}

fmt.Printf("Version: %q, Commit: %q\n", version.Version, version.GitCommit)
Expand Down
21 changes: 20 additions & 1 deletion cmd/e2e-test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,29 @@ if [[ -z "${REGION}" ]]; then
fi
echo "Using Region: ${REGION}"

# Get network information
for ATTEMPT in $(seq 60); do
NETWORK_INFO=$(curl -H'Metadata-Flavor:Google' metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/network)
if [[ -n "${NETWORK_INFO}" ]]; then
break
fi
echo "Error: could not get network from the metadata server (attempt ${ATTEMPT})"
sleep 1
done

NETWORK = NETWORK_INFO | sed 's+projects/.*/networks/++'

if [[ -z "${NETWORK}" ]]; then
echo "Error: could not parse network from network info"
echo "Result: 2"
exit
fi
echo "Using Network: ${NETWORK}"

echo
echo ==============================================================================
echo "PROJECT: ${PROJECT}"
CMD="/e2e-test -test.v -test.parallel=100 -run -project ${PROJECT} -region ${REGION} -logtostderr -inCluster -v=2"
CMD="/e2e-test -test.v -test.parallel=100 -run -project ${PROJECT} -region ${REGION} -network ${NETWORK} -logtostderr -inCluster -v=2"
echo "CMD: ${CMD}" $@
echo

Expand Down

0 comments on commit 5ac41e7

Please sign in to comment.