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
+8 -6
View File
@@ -1,18 +1,19 @@
#!/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
cleanup() {
log "Cleaning up..."
fission env delete --name $env || true
fission fn delete --name $fn || true
clean_resource_by_id $TEST_ID
}
if [ -z "${TEST_NOCLEANUP:-}" ]; then
@@ -22,7 +23,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
@@ -50,3 +51,4 @@ log "Waiting for router to catch up"
sleep 5
timeout 60 bash -c "test_fn $fn 'world'"
log "Test PASSED"