Permalink
Browse files

Merge pull request #504 from Simon-Li/dev_install_test

Add a script to test installation script
  • Loading branch information...
k8s-ci-robot committed Dec 4, 2018
2 parents 94f6eb5 + 1e9ac15 commit b46e405e647b5f3ac348f29b97677379d248eb45
Showing with 48 additions and 0 deletions.
  1. +1 −0 .travis.yml
  2. +4 −0 scripts/install.sh
  3. +43 −0 scripts/install_test.sh
@@ -23,6 +23,7 @@ install:
script:
- TRACE=1 ./test.sh
- ./scripts/install_test.sh
# TBD. Suppressing for now.
notifications:
@@ -48,6 +48,10 @@ command_exists tar
if [ "x${KUBEBUILDER_VERSION}" = "x" ] ; then
KUBEBUILDER_VERSION=$(curl -L -s https://api.github.com/repos/kubernetes-sigs/kubebuilder/releases/latest | \
grep tag_name | sed "s/ *\"tag_name\": *\"\\(.*\\)\",*/\\1/")
if [ -z "$KUBEBUILDER_VERSION" ]; then
echo "\nUnable to fetch the latest version tag. This may be due to network access problem"
exit 0
fi
fi
KUBEBUILDER_VERSION=${KUBEBUILDER_VERSION#"v"}
@@ -0,0 +1,43 @@
#!/bin/sh
source ./scripts/install.sh
echo "Start test"
if [ -z "$KUBEBUILDER_VERSION" ]; then
echo "\nUnable to fetch the latest version tag. Quit the test"
exit 0
fi
echo "1. Check whether $TMP_DIR folder is removed.\n"
if [ -d "$TMP_DIR" ]; then
echo "$TMP_DIR folder is not removed."
exit 1
fi
echo "passed\n"
echo "2. Check whether $KUBEBUILDER_DIR folder exists.\n"
if [ ! -d "$KUBEBUILDER_DIR" ]; then
echo "$KUBEBUILDER_DIR folder is not existed."
exit 1
fi
echo "passed\n"
echo "3. Check whether kubebuilder is installed properly.\n"
if [ ! -x "$KUBEBUILDER_DIR/bin/kubebuilder" ]; then
echo "$KUBEBUILDER_DIR/bin/kubebuilder is not existed or execute permission not granted."
exit 1
fi
echo "passed\n"
echo "4. Check whether kubebuilder version is same as installed.\n"
KUBEBUILDER_VERSION_FROM_BIN=$($KUBEBUILDER_DIR/bin/kubebuilder version | \
sed 's/^.*KubeBuilderVersion:"\(.*\)", KubernetesVendor.*$/\1/')
if [ ! "${KUBEBUILDER_VERSION_FROM_BIN}" = "${KUBEBUILDER_VERSION}" ]; then
echo "kubebuilder version ${KUBEBUILDER_VERSION_FROM_BIN} mismatched from the version installed (${KUBEBUILDER_VERSION})"
exit 1
fi
echo "passed\n"
echo "install test done successfully\n"
exit 0

0 comments on commit b46e405

Please sign in to comment.