From 076b57c50a8950708c520c573c66c32956248cbe Mon Sep 17 00:00:00 2001 From: Soam Vasani Date: Wed, 24 Aug 2016 11:56:49 -0700 Subject: [PATCH] A very rudimentary test script We should have real tests with mocha/chai etc. Until then, use this little bash script. --- src/function-run/nodejs/test/test.js | 4 ++++ src/function-run/nodejs/test/test.sh | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/function-run/nodejs/test/test.js create mode 100755 src/function-run/nodejs/test/test.sh diff --git a/src/function-run/nodejs/test/test.js b/src/function-run/nodejs/test/test.js new file mode 100644 index 00000000..d3e16c38 --- /dev/null +++ b/src/function-run/nodejs/test/test.js @@ -0,0 +1,4 @@ +exports = function (context, callback) { + console.log("Test function"); + callback(200, "Hello, world!"); +} diff --git a/src/function-run/nodejs/test/test.sh b/src/function-run/nodejs/test/test.sh new file mode 100755 index 00000000..8ab05116 --- /dev/null +++ b/src/function-run/nodejs/test/test.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# TODO placeholder until we have better tests :) + +set +x +set -e + +DIR=$(dirname $0) + +echo "-- Starting server" +node $DIR/../server.js --codepath $DIR/test.js --port 8888 & +sleep 2 + +echo "-- Specializing" +curl -f -X POST http://localhost:8888/specialize + +echo "-- Running user function" +curl -f http://localhost:8888 ; echo + +echo "-- Cleanup" +kill %1 +