From eae5150bff7d0765399a58c1e6ad0f6480f015d3 Mon Sep 17 00:00:00 2001 From: Soam Vasani Date: Thu, 16 Feb 2017 12:52:06 -0800 Subject: [PATCH] Initial test script Test script that sets up fission on a cluster, runs tests and uninstalls it. Yet to come: 1. The actual tests 2. Builds (for fission-bundle, client, and envs) 3. Automation with github pull requests --- test/test.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 test/test.sh diff --git a/test/test.sh b/test/test.sh new file mode 100755 index 00000000..8ea331d7 --- /dev/null +++ b/test/test.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +set -euo pipefail + +generate_test_id() { + echo $(date|md5|cut -c1-6) +} + +helm_install_fission() { + id=$1 + image=$2 + imageTag=$3 + controllerNodeport=$4 + routerNodeport=$5 + + ns=f-$id + fns=f-func-$id + + helmVars=image=$image,imageTag=$imageTag,namespace=$ns,functionNamespace=$fns,controllerPort=$controllerNodeport,routerPort=$routerNodeport + + echo "Installing fission" + helm install \ + --wait \ + --name $id \ + --set $helmVars \ + ../charts/fission +} + +helm_uninstall_fission() { + echo "Uninstalling fission" + helm delete $1 +} + +run_all_tests() { + echo "Here is where our tests will go" +} + +install_and_test() { + image=$1 + imageTag=$2 + + controllerPort=31234 + routerPort=31235 + + id=$(generate_test_id) + trap "helm_uninstall_fission $id" EXIT + helm_install_fission $id $image $imageTag $controllerPort $routerPort + + run_all_tests $controllerPort $routerPort +} + + +if [ $# -lt 2 ] +then + echo "Usage: test.sh [image] [imageTag]" + exit 1 +fi + +install_and_test $1 $2