Test framework improvement (#1128)
This commit is contained in:
committed by
Ta-Ching Chen
parent
1e8dfa38da
commit
c3177f9ebd
@@ -1,23 +1,22 @@
|
||||
#!/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_old=python-$(date +%N)
|
||||
env_new=python-$(date +%N)
|
||||
fn=hellopy-$(date +%N)
|
||||
env_old=python-old-$TEST_ID
|
||||
env_new=python-new-$TEST_ID
|
||||
fn=hellopy-$TEST_ID
|
||||
|
||||
cleanup() {
|
||||
log "Cleaning up..."
|
||||
fission env delete --name $env_old || true
|
||||
fission fn delete --name $fn || true
|
||||
fission env delete --name $env_new || true
|
||||
clean_resource_by_id $TEST_ID
|
||||
}
|
||||
|
||||
cleanup
|
||||
if [ -z "${TEST_NOCLEANUP:-}" ]; then
|
||||
trap cleanup EXIT
|
||||
else
|
||||
@@ -25,7 +24,7 @@ else
|
||||
fi
|
||||
|
||||
log "Creating env $env_old"
|
||||
fission env create --name $env_old --image fission/python-env
|
||||
fission env create --name $env_old --image $PYTHON_RUNTIME_IMAGE
|
||||
|
||||
log "Creating function $fn"
|
||||
fission fn create --name $fn --env $env_old --code $ROOT/examples/python/hello.py --minscale 1 --maxscale 4 --executortype newdeploy --mincpu 20 --maxcpu 100 --minmemory 128 --maxmemory 256
|
||||
@@ -39,7 +38,7 @@ sleep 5
|
||||
timeout 60 bash -c "test_fn $fn 'world'"
|
||||
|
||||
log "Creating a new env $env_new"
|
||||
fission env create --name $env_new --image fission/python-env
|
||||
fission env create --name $env_new --image $PYTHON_RUNTIME_IMAGE
|
||||
|
||||
log "Updating function with a new environment"
|
||||
fission fn update --name $fn --env $env_new --code $ROOT/examples/python/hello.py --minscale 1 --maxscale 4 --executortype newdeploy --mincpu 20 --maxcpu 100 --minmemory 128 --maxmemory 256
|
||||
@@ -48,3 +47,5 @@ log "Waiting for update to catch up"
|
||||
sleep 5
|
||||
|
||||
timeout 60 bash -c "test_fn $fn 'world'"
|
||||
|
||||
log "Test PASSED"
|
||||
|
||||
Reference in New Issue
Block a user