Test framework improvement (#1128)

This commit is contained in:
Chia-Chun Tai
2019-05-23 22:52:39 +08:00
committed by Ta-Ching Chen
parent 1e8dfa38da
commit c3177f9ebd
47 changed files with 1192 additions and 832 deletions
+10 -11
View File
@@ -1,13 +1,19 @@
#!/bin/bash
set -euo pipefail
source $(dirname $0)/../utils.sh
TEST_ID=$(generate_test_id)
echo "TEST_ID = $TEST_ID"
ROOT=$(dirname $0)/../..
env=nodejs-$TEST_ID
fn=nodejs-hello-$TEST_ID
cleanup() {
log "Cleaning up..."
fission env delete --name nodejs || true
fission fn delete --name $fn || true
clean_resource_by_id $TEST_ID
}
if [ -z "${TEST_NOCLEANUP:-}" ]; then
@@ -16,17 +22,13 @@ else
log "TEST_NOCLEANUP is set; not cleaning up test artifacts afterwards."
fi
fn=nodejs-hello-$(date +%N)
# Create a hello world function in nodejs, test it with an http trigger
log "Poolmgr ExecutorType: Pre-test cleanup"
fission env delete --name nodejs || true
log "Creating nodejs env"
fission env create --name nodejs --image fission/node-env --mincpu 20 --maxcpu 100 --minmemory 128 --maxmemory 256
fission env create --name $env --image $NODE_RUNTIME_IMAGE --mincpu 20 --maxcpu 100 --minmemory 128 --maxmemory 256
log "Creating function"
fission fn create --name $fn --env nodejs --code $ROOT/examples/nodejs/hello.js --executortype poolmgr
fission fn create --name $fn --env $env --code $ROOT/examples/nodejs/hello.js --executortype poolmgr
log "Creating route"
fission route create --function $fn --url /$fn --method GET
@@ -40,7 +42,4 @@ response=$(curl http://$FISSION_ROUTER/$fn)
log "Checking for valid response"
echo $response | grep -i hello
# crappy cleanup, improve this later
kubectl get httptrigger -o name | tail -1 | cut -f2 -d'/' | xargs kubectl delete httptrigger
log "Poolmgr ExecutorType: All done."