Integration test improvements (#447)
A few improvements to the integration test: * Search for test files recursively in the test dir * Output a test report at the end for a quick summary of what tests passed/failed/were skipped * Add support skipping test files; skip the logging test since it's broken (#446 is tracking this) * Switch to latest helm version * Cleanup namespace
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
|
||||
module.exports = async function(context) {
|
||||
console.log("log test log test log test")
|
||||
console.log("log test")
|
||||
return {
|
||||
status: 200,
|
||||
body: "Log, test!\n"
|
||||
body: "log test\n"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
#test:disabled
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT=$(dirname $0)/../..
|
||||
|
||||
fn=nodejs-logtest
|
||||
|
||||
fn=nodejs-logtest-$(date +%N)
|
||||
|
||||
function cleanup {
|
||||
echo "Cleanup route"
|
||||
var=$(fission route list | grep $fn | awk '{print $1;}')
|
||||
fission route delete --name $var
|
||||
fission function delete --name $fn
|
||||
}
|
||||
|
||||
# Create a hello world function in nodejs, test it with an http trigger
|
||||
@@ -27,32 +27,32 @@ fission fn create --name $fn --env nodejs --code log.js
|
||||
trap "fission fn delete --name $fn" EXIT
|
||||
|
||||
echo "Creating route"
|
||||
fission route create --function $fn --url /logtest --method GET
|
||||
fission route create --function $fn --url /$fn --method GET
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "Waiting for router to catch up"
|
||||
sleep 3
|
||||
|
||||
echo "Doing 4 HTTP GET on the function's route"
|
||||
curl http://$FISSION_ROUTER/logtest
|
||||
curl http://$FISSION_ROUTER/logtest
|
||||
curl http://$FISSION_ROUTER/logtest
|
||||
curl http://$FISSION_ROUTER/logtest
|
||||
|
||||
echo "Doing 4 HTTP GETs on the function's route"
|
||||
for i in 1 2 3 4
|
||||
do
|
||||
curl -s http://$FISSION_ROUTER/$fn
|
||||
done
|
||||
|
||||
echo "Grabbing logs, should have 4 calls in logs"
|
||||
|
||||
sleep 15
|
||||
|
||||
echo "woke up"
|
||||
logs=$(fission function logs --name $fn)
|
||||
num=$(echo "$logs" | grep 'log test' | wc -l)
|
||||
echo $num
|
||||
logs=$(fission function logs --name $fn --detail)
|
||||
echo "---function logs---"
|
||||
echo $logs
|
||||
echo "------"
|
||||
num=(cat "$logs" | grep 'log test' | wc -l)
|
||||
echo $num logs found
|
||||
|
||||
if [ $num -ne 4 ]
|
||||
then
|
||||
echo "Test Failed"
|
||||
trap cleanup EXIT
|
||||
echo "Test Failed: expected 4, found $num logs"
|
||||
fi
|
||||
cleanup
|
||||
|
||||
echo "All done."
|
||||
|
||||
Reference in New Issue
Block a user