Addressing review comments.
This commit is contained in:
@@ -14,7 +14,7 @@ PYTHON_BUILDER_IMAGE=gcr.io/fission-ci/python-env-builder:test
|
||||
fn=python-srcbuild-$(date +%s)
|
||||
|
||||
waitBuild() {
|
||||
echo_log "Waiting for builder manager to finish the build"
|
||||
log "Waiting for builder manager to finish the build"
|
||||
|
||||
while true; do
|
||||
kubectl --namespace default get packages $1 -o jsonpath='{.status.buildstatus}'|grep succeeded
|
||||
@@ -26,11 +26,11 @@ waitBuild() {
|
||||
export -f waitBuild
|
||||
|
||||
checkFunctionResponse() {
|
||||
echo_log "Doing an HTTP GET on the function's route"
|
||||
log "Doing an HTTP GET on the function's route"
|
||||
response=$(curl http://$FISSION_ROUTER/$1)
|
||||
|
||||
echo_log "Checking for valid response"
|
||||
echo_log $response
|
||||
log "Checking for valid response"
|
||||
log $response
|
||||
echo $response | grep -i "$2"
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ waitEnvBuilder() {
|
||||
env=$1
|
||||
envRV=$(kubectl -n default get environments ${env} -o jsonpath='{.metadata.resourceVersion}')
|
||||
|
||||
echo_log "Waiting for env builder to catch up"
|
||||
log "Waiting for env builder to catch up"
|
||||
|
||||
while true; do
|
||||
kubectl -n fission-builder get pod -l envName=${env},envResourceVersion=${envRV} \
|
||||
@@ -50,46 +50,46 @@ waitEnvBuilder() {
|
||||
}
|
||||
export -f waitEnvBuilder
|
||||
|
||||
echo_log "Pre-test cleanup"
|
||||
log "Pre-test cleanup"
|
||||
fission env delete --name python || true
|
||||
|
||||
echo_log "Creating python env"
|
||||
log "Creating python env"
|
||||
fission env create --name python --image $PYTHON_RUNTIME_IMAGE --builder $PYTHON_BUILDER_IMAGE
|
||||
trap "fission env delete --name python" EXIT
|
||||
|
||||
timeout 180s bash -c "waitEnvBuilder python"
|
||||
|
||||
echo_log "Creating pacakage with source archive"
|
||||
log "Creating pacakage with source archive"
|
||||
zip -jr demo-src-pkg.zip $ROOT/examples/python/sourcepkg/
|
||||
pkgName=$(fission package create --src demo-src-pkg.zip --env python --buildcmd "./build.sh"| cut -f2 -d' '| tr -d \')
|
||||
|
||||
# wait for build to finish at most 60s
|
||||
timeout 60s bash -c "waitBuild $pkgName"
|
||||
|
||||
echo_log "Creating function " $fn
|
||||
log "Creating function " $fn
|
||||
fission fn create --name $fn --pkg $pkgName --entrypoint "user.main"
|
||||
trap "fission fn delete --name $fn" EXIT
|
||||
|
||||
echo_log "Creating route"
|
||||
log "Creating route"
|
||||
fission route create --function $fn --url /$fn --method GET
|
||||
|
||||
echo_log "Waiting for router to catch up"
|
||||
log "Waiting for router to catch up"
|
||||
sleep 3
|
||||
|
||||
checkFunctionResponse $fn 'a: 1 b: {c: 3, d: 4}'
|
||||
|
||||
echo_log "Creating package with deploy archive"
|
||||
log "Creating package with deploy archive"
|
||||
mkdir testDir
|
||||
touch testDir/__init__.py
|
||||
printf 'def main():\n return "Hello, world!"' > testDir/hello.py
|
||||
zip -jr demo-deploy-pkg.zip testDir/
|
||||
pkgName=$(fission package create --deploy demo-deploy-pkg.zip --env python| cut -f2 -d' '| tr -d \')
|
||||
|
||||
echo_log "Updating function " $fn
|
||||
log "Updating function " $fn
|
||||
fission fn update --name $fn --pkg $pkgName --entrypoint "hello.main"
|
||||
trap "fission fn delete --name $fn" EXIT
|
||||
|
||||
echo_log "Waiting for router to update cache"
|
||||
log "Waiting for router to update cache"
|
||||
sleep 3
|
||||
|
||||
checkFunctionResponse $fn 'Hello, world!'
|
||||
@@ -97,4 +97,4 @@ checkFunctionResponse $fn 'Hello, world!'
|
||||
# crappy cleanup, improve this later
|
||||
kubectl get httptrigger -o name | tail -1 | cut -f2 -d'/' | xargs kubectl delete httptrigger
|
||||
|
||||
echo_log "All done."
|
||||
log "All done."
|
||||
|
||||
Reference in New Issue
Block a user