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
@@ -1,13 +1,15 @@
#!/bin/bash
set -euo pipefail
source $(dirname $0)/../../utils.sh
source $(dirname $0)/fnupdate_utils.sh
TEST_ID=$(generate_test_id)
echo "TEST_ID = $TEST_ID"
ROOT=$(dirname $0)/../../..
env=python-$(date +%N)
fn=hellopython-$(date +%N)
env=python-$TEST_ID
fn=hellopython-$TEST_ID
mincpu1=40
maxcpu1=140
@@ -21,11 +23,9 @@ maxmem2=768
cleanup() {
log "Cleaning up..."
fission env delete --name $env || true
fission fn delete --name $fn || true
clean_resource_by_id $TEST_ID
}
cleanup
if [ -z "${TEST_NOCLEANUP:-}" ]; then
trap cleanup EXIT
else
@@ -33,7 +33,7 @@ else
fi
log "Creating Python env $env"
fission env create --name $env --image fission/python-env --mincpu 20 --maxcpu 100 --minmemory 128 --maxmemory 256
fission env create --name $env --image $PYTHON_RUNTIME_IMAGE --mincpu 20 --maxcpu 100 --minmemory 128 --maxmemory 256
log "Creating function $fn"
fission fn create --name $fn --env $env --code $ROOT/examples/python/hello.py --minscale 1 --maxscale 4 --executortype newdeploy --mincpu $mincpu1 --maxcpu $maxcpu1 --minmemory $minmem1 --maxmemory $maxmem1
@@ -87,3 +87,4 @@ then
fi
timeout 60 bash -c "test_fn $fn 'world'"
log "Test PASSED"