tree: c3c9818ac4f483194c0b67170c0ff7ef60c47ead [path history] [tgz]
  1. build-without-code.yaml.tmpl
  2. build.yaml.tmpl
  3. knative-data-init-run.json
  4. knative-data-init.json
  5. knative-data-run.json
  6. openwhisk-data-init.json
  7. openwhisk-data-run.json
  8. payload-knative-init-run.http
  9. payload-knative-init.http
  10. payload-knative-run.http
  11. payload-openwhisk-init.http
  12. payload-openwhisk-run.http
  13. README.md
  14. service.yaml.tmpl
tests/src/test/knative/helloworldwithparams/README.md

Hello World with Params Test for OpenWhisk NodeJS Runtime using Knative

Running the test using the “Curl” command

Depending on the value you set in buildtemplate.yaml for the OW_RUNTIME_PLATFORM parameter, you will need to invoke different endpoints to execute the test.

Running with OW_RUNTIME_PLATFORM set to “knative”

Invoke / endpoint on the Service

curl -H "Host: nodejs-helloworld-with-params.default.example.com" -d '{"value": {"name": "Joe", "place": "TX"}}' -H "Content-Type: application/json" http://localhost/

Initialize the runtime

You have an option to initialize the runtime with the function and other configuration data if its not initialized (i.e. built using build-without-code.yaml.tmpl)

curl -H "Host: nodejs-helloworld-with-params.default.example.com" -d "@knative-data-init.json" -H "Content-Type: application/json" http://localhost/

{"OK":true}

Run the function

Execute the function.

curl -H "Host: nodejs-helloworld-with-params.default.example.com" -d "@knative-data-run.json" -H "Content-Type: application/json" -X POST http://localhost/

{"payload":"Hello Jill from OK!"};

Running with OW_RUNTIME_PLATFORM set to “openwhisk”

Initialize the runtime

Initialize the runtime with the function and other configuration data using the /init endpoint.

curl -H "Host: nodejs-helloworld-with-params.default.example.com" -d "@openwhisk-data-init.json" -H "Content-Type: application/json" http://localhost/init

{"OK":true}

Run the function

Execute the function using the /run endpoint.

curl -H "Host: nodejs-helloworld-with-params.default.example.com" -d "@openwhisk-data-run.json" -H "Content-Type: application/json" -X POST http://localhost/run

{"payload":"Hello Joe from TX!"};