This feature allows creation of fission objects in different namespaces, in addition to retaining the existing behavior of creating fission objects in default namespace if user doesnt provide one. It also removes cluster admin roles for fission-fetcher and fission-builder Service Accounts and grants them only those privileges that they need.
60 lines
2.1 KiB
Bash
Executable File
60 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
# 1. This test first creates a python function with a route
|
|
# 2. Makes a curl request to the route and verifies http.StatusOK is received.
|
|
# This step ensures the pod address is cached in router.
|
|
# 3. Then, finds the pod that has the function loaded and deletes the pod with grace period 0s.
|
|
# This step results in a stale entry in the router cache.
|
|
# 4. Finally, makes a curl request again and waits for response http.StatusOK.
|
|
# This ensures that router invalidated its cache, made a request to executor to get service for function and retried
|
|
# the request against this new address.
|
|
|
|
PYTHON_RUNTIME_IMAGE=gcr.io/fission-ci/python-env:test
|
|
fn=python-func-$(date +%s)
|
|
|
|
log "Pre-test cleanup"
|
|
fission env delete --name python || true
|
|
|
|
log "Creating python env"
|
|
fission env create --name python --image $PYTHON_RUNTIME_IMAGE
|
|
trap "fission env delete --name python" EXIT
|
|
|
|
log "Creating hello.py"
|
|
mkdir testDir-$fn
|
|
printf 'def main():\n return "Hello, world!"' > testDir-$fn/hello.py
|
|
trap "rm -rf testDir-$fn" EXIT
|
|
|
|
log "Creating function " $fn
|
|
fission fn create --name $fn --env python --code testDir-$fn/hello.py
|
|
trap "fission fn delete --name $fn" EXIT
|
|
|
|
log "rm testDir-$fn"
|
|
rm -rf testDir-$fn
|
|
|
|
log "Waiting for router to update cache"
|
|
sleep 3
|
|
|
|
log "Creating route"
|
|
fission route create --function $fn --url /$fn --method GET
|
|
|
|
http_status=`curl -sw "%{http_code}" http://$FISSION_ROUTER/$fn -o /dev/null`
|
|
log "http_status: $http_status"
|
|
if [ "$http_status" -ne "200" ]; then
|
|
log "Something went wrong, http status even before deleting function pod is $http_status"
|
|
exit 1
|
|
fi
|
|
|
|
log "getting function pod"
|
|
funcPod=`kubectl get pods -n $FUNCTION_NAMESPACE -L functionName | grep $fn| tr -s " "| cut -d" " -f1`
|
|
log "funcPod : $funcPod"
|
|
|
|
kubectl delete pod $funcPod -n $FUNCTION_NAMESPACE --grace-period=0
|
|
log "deleted function pod $funcPod"
|
|
|
|
http_status=`curl -sw "%{http_code}" http://$FISSION_ROUTER/$fn -o /dev/null`
|
|
log "http_status: $http_status"
|
|
if [ "$http_status" -ne "200" ]; then
|
|
log "Something went wrong, http status after deleting function pod is $http_status"
|
|
exit 1
|
|
fi |