Remove mentions of uninstall tests and other repos from prepare-for-integration-tests.sh

This commit is contained in:
Ryan Richard 2020-09-10 17:36:22 -07:00
parent e6cb2f8220
commit 4fe609a043

View File

@ -2,16 +2,13 @@
# This script can be used to prepare a kind cluster and deploy the app.
# You can call this script again to redeploy the app.
# It will also output instructions on how to run the integration or uninstall tests.
# TODO: get rid of references to ci repo
# TODO: fix uninstall test setup
# TODO: add flag to let user provide registry/tag for their image
# \- (this can be used by kind integration tests from kind-load-and-docker-run-any-script.sh)
# TODO: add flag to setup current-context for integration tests
# It will also output instructions on how to run the integration.
set -euo pipefail
#
# Helper functions
#
function log_note() {
GREEN='\033[0;32m'
NC='\033[0m'
@ -42,9 +39,11 @@ function log_error() {
fi
}
#
# Handle argument parsing and help message
#
help=no
skip_build=no
prepare_for_uninstall_test=no
PARAMS=""
while (("$#")); do
@ -57,10 +56,6 @@ while (("$#")); do
skip_build=yes
shift
;;
-u | --prepare-uninstall)
prepare_for_uninstall_test=yes
shift
;;
-*)
log_error "Unsupported flag $1" >&2
exit 1
@ -76,19 +71,21 @@ eval set -- "$PARAMS"
if [[ "$help" == "yes" ]]; then
me="$(basename "${BASH_SOURCE[0]}")"
echo "Usage:"
echo " $me [flags] [path/to/pinniped] [path/to/pinniped-ci]"
echo " $me [flags] [path/to/pinniped]"
echo
echo " path/to/pinniped default: \$PWD ($PWD)"
echo
echo "Flags:"
echo " -h, --help: print this usage"
echo " -s, --skip-build: reuse the most recently built image of the app instead of building"
echo " -u, --prepare-uninstall: delete the kind cluster and prepare to run the install+uninstall test"
exit 1
fi
pinniped_path="${1-$PWD}"
#
# Check for dependencies
#
if ! command -v kind >/dev/null; then
log_error "Please install kind. e.g. 'brew install kind' for MacOS"
exit 1
@ -116,11 +113,9 @@ if [[ ! -f Dockerfile || ! -d deploy ]]; then
exit 1
fi
if [[ "$prepare_for_uninstall_test" == "yes" ]]; then
log_note "Deleting running kind clusters to prepare a clean slate for the install+uninstall test..."
kind delete cluster
fi
#
# Setup kind and build the app
#
log_note "Checking for running kind clusters..."
if ! kind get clusters | grep -q -e '^kind$'; then
log_note "Creating a kind cluster..."
@ -163,24 +158,6 @@ fi
log_note "Loading the app's container image into the kind cluster..."
kind load docker-image "$registry_repo_tag"
if [[ "$prepare_for_uninstall_test" == "yes" ]]; then
cat <<EOF >/tmp/uninstall-test-env
# The following env vars should be set before running $pinniped_ci_path/pipelines/shared-tasks/run-uninstall-test/run-uninstall-test.sh
export IMAGE_REPO="$registry_repo"
export IMAGE_TAG="$tag"
export PINNIPED_DISCOVERY_URL="$discovery_url"
EOF
log_note "Done!"
log_note
log_note "Ready to run the uninstall test."
log_note " cd $pinniped_path"
log_note ' source /tmp/uninstall-test-env'
log_note " $pinniped_ci_path/pipelines/shared-tasks/run-uninstall-test/run-uninstall-test.sh"
log_note
log_note "When you're finished, use 'kind delete cluster' to tear down the cluster."
else
manifest=/tmp/manifest.yaml
#
@ -213,8 +190,8 @@ else
--from-literal=groups="$test_groups" \
--from-literal=passwordHash="$(htpasswd -nbBC 10 x "$test_password" | sed -e "s/^x://")" \
--dry-run=client \
--output yaml \
| kubectl apply -f -
--output yaml |
kubectl apply -f -
app_name="pinniped"
namespace="integration"
@ -242,6 +219,9 @@ else
popd >/dev/null
#
# Create the environment file
#
kind_capabilities_file="$pinniped_path/test/cluster_capabilities/kind.yaml"
pinniped_cluster_capability_file_content=$(cat "$kind_capabilities_file")
@ -260,6 +240,9 @@ PINNIPED_CLUSTER_CAPABILITY_YAML_EOF
export PINNIPED_CLUSTER_CAPABILITY_YAML
EOF
#
# Print instructions for next steps
#
goland_vars=$(grep -v '^#' /tmp/integration-test-env | grep -E '^export .+=' | sed 's/export //g' | tr '\n' ';')
log_note "Done!"
@ -278,4 +261,3 @@ EOF
log_note "When you're finished, use 'kind delete cluster' to tear down the cluster."
log_note
log_note "To delete the deployments, run 'kapp delete -a local-user-authenticator -y && kapp delete -a pinniped -y'."
fi