Addressing review comments.
This commit is contained in:
@@ -10,28 +10,28 @@ fn=nodejs-hello-$(date +%s)
|
||||
# Update it and check it's output, the output should be
|
||||
# different from the previous one.
|
||||
|
||||
echo_log "Pre-test cleanup"
|
||||
log "Pre-test cleanup"
|
||||
fission env delete --name nodejs || true
|
||||
|
||||
echo_log "Creating nodejs env"
|
||||
log "Creating nodejs env"
|
||||
fission env create --name nodejs --image fission/node-env
|
||||
trap "fission env delete --name nodejs" EXIT
|
||||
|
||||
echo_log "Creating function"
|
||||
log "Creating function"
|
||||
echo 'module.exports = function(context, callback) { callback(200, "foo!\n"); }' > foo.js
|
||||
fission fn create --name $fn --env nodejs --code foo.js
|
||||
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 10
|
||||
|
||||
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/$fn)
|
||||
|
||||
echo_log "Checking for valid response"
|
||||
log "Checking for valid response"
|
||||
echo $response | grep -i foo
|
||||
|
||||
# Running a background process to keep access the
|
||||
@@ -40,18 +40,18 @@ echo $response | grep -i foo
|
||||
( watch -n1 curl http://$FISSION_ROUTER/$fn ) > /dev/null 2>&1 &
|
||||
pid=$!
|
||||
|
||||
echo_log "Updating function"
|
||||
log "Updating function"
|
||||
echo 'module.exports = function(context, callback) { callback(200, "bar!\n"); }' > bar.js
|
||||
fission fn update --name $fn --code bar.js
|
||||
trap "fission fn delete --name $fn" EXIT
|
||||
|
||||
echo_log "Waiting for router to update cache"
|
||||
log "Waiting for router to update cache"
|
||||
sleep 10
|
||||
|
||||
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/$fn)
|
||||
|
||||
echo_log "Checking for valid response again"
|
||||
log "Checking for valid response again"
|
||||
echo $response | grep -i bar
|
||||
|
||||
kill -15 $pid
|
||||
@@ -59,4 +59,4 @@ kill -15 $pid
|
||||
# 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