Fission upgrade tests (#605)

Tests for upgrading Fission from the last version to current branch and testing. Currently test is very simple and more tests can be added in future
This commit is contained in:
Vishal
2018-04-24 12:51:17 +05:30
committed by GitHub
parent eb696432d8
commit 7198b24028
5 changed files with 195 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
set -euo pipefail
ROOT_RELPATH=$(dirname $0)/../..
pushd $ROOT_RELPATH
ROOT=$(pwd)
popd
setup_fission_objects() {
log "==== Setting up objects for upgrade test ===="
log "Creating env, function and route"
fission env create --name nodejs --image fission/node-env --mincpu 20 --maxcpu 100 --minmemory 128 --maxmemory 256
fission fn create --name upgradehello --env nodejs --code $ROOT/examples/nodejs/hello.js --executortype poolmgr
fission route create --function upgradehello --url /upgradehello --method GET
log "Waiting for router to catch up"
sleep 5
log "==== Finished setting up objects for upgrade test ===="
}
upgrade_tests() {
log "==== Tests Start ===="
log "Doing an HTTP GET on the function's route"
response=$(curl http://$FISSION_ROUTER/upgradehello)
log "Checking for valid response"
echo $response | grep -i hello
log "==== Tests End ===="
}
validate_post_upgrade() {
echo `fission -v`
echo "Fission environments:"
echo `fission env list`
echo "Fission Functions:"
echo `fission fn list`
echo "Fission Routes:"
echo `fission route list`
}
cleanup_fission_objects() {
log "==== Cleanup Start ===="
log "Input: $1"
id=$1
echo "Cleaning up objects"
fission env delete --name nodejs || true
fission fn delete --name upgradehello || true
echo "Uninstalling fission"
helm delete --purge $id
kubectl delete ns f-$id || true
log "==== Cleanup End ===="
}