This is an automated email from the ASF dual-hosted git repository. pdesai pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-devtools.git
The following commit(s) were added to refs/heads/master by this push: new e7b5245 Seed Java runtime for knative test files and cleanup (#256) e7b5245 is described below commit e7b524586e59ff4d63768a0aaaf8a63c5c3bd50a Author: Matt Rutkowski <mrutk...@us.ibm.com> AuthorDate: Tue May 7 15:44:54 2019 -0500 Seed Java runtime for knative test files and cleanup (#256) * Get Java runtime running under knative * remove IDE files from git * Update tests for java8 dockerfile * Update tests for java8 dockerfile * Update tests for java8 dockerfile --- .gitignore | 8 +- knative-build/runtimes/java/buildtemplate.yaml | 2 +- knative-build/runtimes/java/tests/build.gradle | 44 +++ .../java/tests/knative/helloworld/Hello.java | 28 ++ .../java/tests/knative/helloworld/README.md | 74 ++++ .../helloworld/build-without-code.yaml.tmpl | 19 + .../java/tests/knative/helloworld/build.yaml.tmpl | 27 ++ .../java/tests/knative/helloworld/hello.jar | Bin 0 -> 966 bytes .../java/tests/knative/helloworld/hello.jar.base64 | 1 + .../knative/helloworld/knative-data-init-run.json | 18 + .../knative/helloworld/knative-data-init.json | 8 + .../tests/knative/helloworld/knative-data-run.json | 12 + .../knative/helloworld/openwhisk-data-init.json | 8 + .../knative/helloworld/openwhisk-data-run.json | 11 + .../helloworld/payload-knative-init-run.http | 25 ++ .../knative/helloworld/payload-knative-init.http | 13 + .../knative/helloworld/payload-knative-run.http | 17 + .../knative/helloworld/payload-openwhisk-init.http | 13 + .../knative/helloworld/payload-openwhisk-run.http | 15 + .../tests/knative/helloworld/service.yaml.tmpl | 12 + .../tests/knative/helloworldwithparams/README.md | 74 ++++ .../build-without-code.yaml.tmpl | 19 + .../knative/helloworldwithparams/build.yaml.tmpl | 27 ++ .../knative-data-init-run.json | 20 + .../helloworldwithparams/knative-data-init.json | 8 + .../helloworldwithparams/knative-data-run.json | 14 + .../helloworldwithparams/openwhisk-data-init.json | 8 + .../helloworldwithparams/openwhisk-data-run.json | 12 + .../payload-knative-init-run.http} | 13 +- .../payload-knative-init.http} | 8 +- .../helloworldwithparams/payload-knative-run.http | 19 + .../payload-openwhisk-init.http} | 6 +- .../payload-openwhisk-run.http | 17 + .../knative/helloworldwithparams/service.yaml.tmpl | 12 + .../knative/helloworldwithparamsfromenv/README.md | 74 ++++ .../build-without-code.yaml.tmpl | 19 + .../helloworldwithparamsfromenv/build.yaml.tmpl | 23 ++ .../knative-data-init-run.json | 20 + .../knative-data-init.json | 9 + .../knative-data-run.json | 15 + .../openwhisk-data-init.json | 8 + .../openwhisk-data-run.json | 12 + .../payload-knative-init-run.http} | 13 +- .../payload-openwhisk-init.http} | 6 +- .../payload-openwhisk-run.http | 16 + .../helloworldwithparamsfromenv/service.yaml.tmpl | 17 + .../java/tests/src/test/resources/application.conf | 8 + .../JavaActionContainerTests.scala | 417 +++++++++++++++++++++ ...-agnostic-bad-run-http-method-unsupported.http} | 4 +- ...=> payload-agnostic-bad-run-invalid-route.http} | 2 + ... => payload-kn-bad-http-body-data-missing.http} | 0 ...dy.http => payload-kn-bad-http-body-empty.http} | 0 ...ty.http => payload-kn-bad-init-code-empty.http} | 4 +- ... payload-kn-bad-init-json-payload-invalid.http} | 4 +- ...n-bad-initrun-activation-action-name-empy.http} | 0 ...ad-initrun-activation-action-name-missing.http} | 0 ...ty.http => payload-ow-bad-init-code-empty.http} | 2 +- ....http => payload-ow-bad-init-code-missing.http} | 2 +- 58 files changed, 1256 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 99782a2..309bf07 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,11 @@ # IDE +.gradle .idea -*.iml .project +.pydevproject .settings .vscode +*.iml *.code-workspace **/.sts4-cache @@ -31,6 +33,10 @@ service.yaml node_modules/ package-lock.json +# Java +*.class +out/ + # Swift Packages/ diff --git a/knative-build/runtimes/java/buildtemplate.yaml b/knative-build/runtimes/java/buildtemplate.yaml index d083310..0af4194 100644 --- a/knative-build/runtimes/java/buildtemplate.yaml +++ b/knative-build/runtimes/java/buildtemplate.yaml @@ -3,7 +3,7 @@ apiVersion: build.knative.dev/v1alpha1 kind: BuildTemplate metadata: - name: openwhisk-nodejs-runtime + name: openwhisk-java-runtime spec: parameters: - name: TARGET_IMAGE_NAME diff --git a/knative-build/runtimes/java/tests/build.gradle b/knative-build/runtimes/java/tests/build.gradle new file mode 100644 index 0000000..1ae5a4b --- /dev/null +++ b/knative-build/runtimes/java/tests/build.gradle @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: 'scala' +apply plugin: 'eclipse' +compileTestScala.options.encoding = 'UTF-8' + +repositories { + mavenCentral() + mavenLocal() +} + +tasks.withType(Test) { + testLogging { + events "passed", "skipped", "failed" + showStandardStreams = true + exceptionFormat = 'full' + } + outputs.upToDateWhen { false } // force tests to run every time +} + +dependencies { + compile "org.scala-lang:scala-library:${gradle.scala.version}" + compile "org.apache.openwhisk:openwhisk-tests:${gradle.openwhisk.version}:tests" + compile "org.apache.openwhisk:openwhisk-tests:${gradle.openwhisk.version}:test-sources" +} + +tasks.withType(ScalaCompile) { + scalaCompileOptions.additionalParameters = gradle.scala.compileFlags +} diff --git a/knative-build/runtimes/java/tests/knative/helloworld/Hello.java b/knative-build/runtimes/java/tests/knative/helloworld/Hello.java new file mode 100644 index 0000000..6d86859 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/Hello.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import com.google.gson.JsonObject; +public class Hello { + public static JsonObject main(JsonObject args) { + String name = "stranger"; + if (args.has("name")) + name = args.getAsJsonPrimitive("name").getAsString(); + JsonObject response = new JsonObject(); + response.addProperty("greeting", "Hello " + name + "!"); + return response; + } +} diff --git a/knative-build/runtimes/java/tests/knative/helloworld/README.md b/knative-build/runtimes/java/tests/knative/helloworld/README.md new file mode 100644 index 0000000..812edf6 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/README.md @@ -0,0 +1,74 @@ +<!-- +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--> + +# Hello World Test for OpenWhisk Java Runtime using Knative + +## Running the test using the "Curl" command + +Depending on the value you set in [buildtemplate.yaml](../../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: java-helloworld.default.example.com" -X POST 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](build-without-code.yaml.tmpl)) + +``` +curl -H "Host: java-helloworld.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: java-helloworld.default.example.com" -d "@knative-data-run.json" -H "Content-Type: application/json" -X POST http://localhost/ + +{"payload":"Hello World!"}; +``` + +### 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: java-helloworld.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: java-helloworld.default.example.com" -d "@openwhisk-data-run.json" -H "Content-Type: application/json" -X POST http://localhost/run + +{"payload":"Hello World!"} +``` diff --git a/knative-build/runtimes/java/tests/knative/helloworld/build-without-code.yaml.tmpl b/knative-build/runtimes/java/tests/knative/helloworld/build-without-code.yaml.tmpl new file mode 100644 index 0000000..475d142 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/build-without-code.yaml.tmpl @@ -0,0 +1,19 @@ +apiVersion: build.knative.dev/v1alpha1 +kind: Build +metadata: + name: java-8-helloworld +spec: + serviceAccountName: openwhisk-runtime-builder + source: + git: + url: "https://github.com/apache/incubator-openwhisk-devtools.git" + revision: "master" + template: + name: openwhisk-java-runtime + arguments: + - name: TARGET_IMAGE_NAME + value: "docker.io/${DOCKER_USERNAME}/java-8-helloworld" + - name: DOCKERFILE + value: "./knative-build/runtimes/java/core/java8/Dockerfile" + - name: OW_RUNTIME_DEBUG + value: "true" diff --git a/knative-build/runtimes/java/tests/knative/helloworld/build.yaml.tmpl b/knative-build/runtimes/java/tests/knative/helloworld/build.yaml.tmpl new file mode 100644 index 0000000..9e3a933 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/build.yaml.tmpl @@ -0,0 +1,27 @@ +apiVersion: build.knative.dev/v1alpha1 +kind: Build +metadata: + name: java-8-helloworld +spec: + serviceAccountName: openwhisk-runtime-builder + source: + git: + url: "https://github.com/apache/incubator-openwhisk-devtools.git" + revision: "master" + template: + name: openwhisk-java-runtime + arguments: + - name: TARGET_IMAGE_NAME + value: "docker.io/${DOCKER_USERNAME}/java-8-helloworld" + - name: DOCKERFILE + value: "./knative-build/runtimes/java/core/java8/Dockerfile" + - name: OW_RUNTIME_DEBUG + value: "true" + - name: OW_ACTION_NAME + value: "java-helloworld" + - name: OW_ACTION_MAIN + value: "Hello" + - name: OW_ACTION_BINARY + value: "true" + - name: OW_ACTION_CODE + value: "UEsDBBQACAgIABljwUoAAAAAAAAAAAAAAAAJAAQATUVUQS1JTkYv/soAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgICAAZY8FKAAAAAAAAAAAAAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLElN0XWqBAlY6BnEmxkoaPgXJSbnpCo45xcV5BcllgCVa/Jy8XIBAFBLBwhiwEEKQwAAAEQAAABQSwMEFAAICAgACmPBSgAAAAAAAAAAAAAAAAsAAABIZWxsby5jbGFzc31T227TQBA9k5tdx6HBtCkUUhpuTdK0Bkq5NFUlioQQSqFSUCV428Qr4+JL5DgVfAp/AS+pRCU+gG9CiFmLgFTSWvLM7J6Zc2Zn7R+/vn0H8ABtAxaqOpZ0XDegYVmZmoEbuKnhlloweFvDHQOGCleUr+toKN9U+KqG [...] diff --git a/knative-build/runtimes/java/tests/knative/helloworld/hello.jar b/knative-build/runtimes/java/tests/knative/helloworld/hello.jar new file mode 100644 index 0000000..b05753f Binary files /dev/null and b/knative-build/runtimes/java/tests/knative/helloworld/hello.jar differ diff --git a/knative-build/runtimes/java/tests/knative/helloworld/hello.jar.base64 b/knative-build/runtimes/java/tests/knative/helloworld/hello.jar.base64 new file mode 100644 index 0000000..186a4ad --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/hello.jar.base64 @@ -0,0 +1 @@ +UEsDBBQACAgIABljwUoAAAAAAAAAAAAAAAAJAAQATUVUQS1JTkYv/soAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgICAAZY8FKAAAAAAAAAAAAAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLElN0XWqBAlY6BnEmxkoaPgXJSbnpCo45xcV5BcllgCVa/Jy8XIBAFBLBwhiwEEKQwAAAEQAAABQSwMEFAAICAgACmPBSgAAAAAAAAAAAAAAAAsAAABIZWxsby5jbGFzc31T227TQBA9k5tdx6HBtCkUUhpuTdK0Bkq5NFUlioQQSqFSUCV428Qr4+JL5DgVfAp/AS+pRCU+gG9CiFmLgFTSWvLM7J6Zc2Zn7R+/vn0H8ABtAxaqOpZ0XDegYVmZmoEbuKnhlloweFvDHQOGCleUr+toKN9U+KqGloY1QmHbC71kh5Ct [...] diff --git a/knative-build/runtimes/java/tests/knative/helloworld/knative-data-init-run.json b/knative-build/runtimes/java/tests/knative/helloworld/knative-data-init-run.json new file mode 100644 index 0000000..1e5aa38 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/knative-data-init-run.json @@ -0,0 +1,18 @@ +{ + "init": { + "name": "java-helloworld", + "main": "Hello", + "binary": true, + "code" : "UEsDBBQACAgIABljwUoAAAAAAAAAAAAAAAAJAAQATUVUQS1JTkYv/soAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgICAAZY8FKAAAAAAAAAAAAAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLElN0XWqBAlY6BnEmxkoaPgXJSbnpCo45xcV5BcllgCVa/Jy8XIBAFBLBwhiwEEKQwAAAEQAAABQSwMEFAAICAgACmPBSgAAAAAAAAAAAAAAAAsAAABIZWxsby5jbGFzc31T227TQBA9k5tdx6HBtCkUUhpuTdK0Bkq5NFUlioQQSqFSUCV428Qr4+JL5DgVfAp/AS+pRCU+gG9CiFmLgFTSWvLM7J6Zc2Zn7R+/vn0H8ABtAxaqOpZ0XDegYVmZmoEbuKnhlloweFvDHQOGCleUr+toKN9U+KqGlo [...] + }, + "activation": { + "namespace": "default", + "action_name": "java-helloworld", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" + }, + "value": { + } +} diff --git a/knative-build/runtimes/java/tests/knative/helloworld/knative-data-init.json b/knative-build/runtimes/java/tests/knative/helloworld/knative-data-init.json new file mode 100644 index 0000000..1b4d3f4 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/knative-data-init.json @@ -0,0 +1,8 @@ +{ + "init": { + "name": "java-helloworld", + "main": "Hello", + "binary": true, + "code" : "UEsDBBQACAgIABljwUoAAAAAAAAAAAAAAAAJAAQATUVUQS1JTkYv/soAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgICAAZY8FKAAAAAAAAAAAAAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLElN0XWqBAlY6BnEmxkoaPgXJSbnpCo45xcV5BcllgCVa/Jy8XIBAFBLBwhiwEEKQwAAAEQAAABQSwMEFAAICAgACmPBSgAAAAAAAAAAAAAAAAsAAABIZWxsby5jbGFzc31T227TQBA9k5tdx6HBtCkUUhpuTdK0Bkq5NFUlioQQSqFSUCV428Qr4+JL5DgVfAp/AS+pRCU+gG9CiFmLgFTSWvLM7J6Zc2Zn7R+/vn0H8ABtAxaqOpZ0XDegYVmZmoEbuKnhlloweFvDHQOGCleUr+toKN9U+KqGlo [...] + } +} diff --git a/knative-build/runtimes/java/tests/knative/helloworld/knative-data-run.json b/knative-build/runtimes/java/tests/knative/helloworld/knative-data-run.json new file mode 100644 index 0000000..42ae1d2 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/knative-data-run.json @@ -0,0 +1,12 @@ +{ + "activation": { + "namespace": "default", + "action_name": "java-helloworld", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" + }, + "value": { + } +} diff --git a/knative-build/runtimes/java/tests/knative/helloworld/openwhisk-data-init.json b/knative-build/runtimes/java/tests/knative/helloworld/openwhisk-data-init.json new file mode 100644 index 0000000..4417cd4 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/openwhisk-data-init.json @@ -0,0 +1,8 @@ +{ + "value": { + "name" : "java-helloworld", + "main" : "Hello", + "binary": true, + "code" : "UEsDBBQACAgIABljwUoAAAAAAAAAAAAAAAAJAAQATUVUQS1JTkYv/soAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgICAAZY8FKAAAAAAAAAAAAAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLElN0XWqBAlY6BnEmxkoaPgXJSbnpCo45xcV5BcllgCVa/Jy8XIBAFBLBwhiwEEKQwAAAEQAAABQSwMEFAAICAgACmPBSgAAAAAAAAAAAAAAAAsAAABIZWxsby5jbGFzc31T227TQBA9k5tdx6HBtCkUUhpuTdK0Bkq5NFUlioQQSqFSUCV428Qr4+JL5DgVfAp/AS+pRCU+gG9CiFmLgFTSWvLM7J6Zc2Zn7R+/vn0H8ABtAxaqOpZ0XDegYVmZmoEbuKnhlloweFvDHQOGCleUr+toKN9U+K [...] + } +} diff --git a/knative-build/runtimes/java/tests/knative/helloworld/openwhisk-data-run.json b/knative-build/runtimes/java/tests/knative/helloworld/openwhisk-data-run.json new file mode 100644 index 0000000..e026ec8 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/openwhisk-data-run.json @@ -0,0 +1,11 @@ +{ + "value": { + + }, + "namespace": "default", + "action_name": "java-helloworld", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" +} diff --git a/knative-build/runtimes/java/tests/knative/helloworld/payload-knative-init-run.http b/knative-build/runtimes/java/tests/knative/helloworld/payload-knative-init-run.http new file mode 100644 index 0000000..0e333ac --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/payload-knative-init-run.http @@ -0,0 +1,25 @@ +POST http://localhost:8080/ HTTP/1.1 +content-type: application/json + +{ + "init": { + "name": "java-helloworld", + "main": "Hello", + "binary": true, + "code" : "UEsDBBQACAgIABljwUoAAAAAAAAAAAAAAAAJAAQATUVUQS1JTkYv/soAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgICAAZY8FKAAAAAAAAAAAAAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLElN0XWqBAlY6BnEmxkoaPgXJSbnpCo45xcV5BcllgCVa/Jy8XIBAFBLBwhiwEEKQwAAAEQAAABQSwMEFAAICAgACmPBSgAAAAAAAAAAAAAAAAsAAABIZWxsby5jbGFzc31T227TQBA9k5tdx6HBtCkUUhpuTdK0Bkq5NFUlioQQSqFSUCV428Qr4+JL5DgVfAp/AS+pRCU+gG9CiFmLgFTSWvLM7J6Zc2Zn7R+/vn0H8ABtAxaqOpZ0XDegYVmZmoEbuKnhlloweFvDHQOGCleUr+toKN9U+KqGlo [...] + }, + "activation": { + "namespace": "default", + "action_name": "java-helloworld", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" + }, + "value": { + "name": "Joe", + "place": "TX" + } +} + +### diff --git a/knative-build/runtimes/java/tests/knative/helloworld/payload-knative-init.http b/knative-build/runtimes/java/tests/knative/helloworld/payload-knative-init.http new file mode 100644 index 0000000..c30856a --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/payload-knative-init.http @@ -0,0 +1,13 @@ +POST http://localhost:8080/ HTTP/1.1 +content-type: application/json + +{ + "init": { + "name": "java-helloworld", + "main": "Hello", + "binary": true, + "code" : "UEsDBBQACAgIABljwUoAAAAAAAAAAAAAAAAJAAQATUVUQS1JTkYv/soAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgICAAZY8FKAAAAAAAAAAAAAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLElN0XWqBAlY6BnEmxkoaPgXJSbnpCo45xcV5BcllgCVa/Jy8XIBAFBLBwhiwEEKQwAAAEQAAABQSwMEFAAICAgACmPBSgAAAAAAAAAAAAAAAAsAAABIZWxsby5jbGFzc31T227TQBA9k5tdx6HBtCkUUhpuTdK0Bkq5NFUlioQQSqFSUCV428Qr4+JL5DgVfAp/AS+pRCU+gG9CiFmLgFTSWvLM7J6Zc2Zn7R+/vn0H8ABtAxaqOpZ0XDegYVmZmoEbuKnhlloweFvDHQOGCleUr+toKN9U+KqGlo [...] + } +} + +### diff --git a/knative-build/runtimes/java/tests/knative/helloworld/payload-knative-run.http b/knative-build/runtimes/java/tests/knative/helloworld/payload-knative-run.http new file mode 100644 index 0000000..fe2b4df --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/payload-knative-run.http @@ -0,0 +1,17 @@ +POST http://localhost:8080/ HTTP/1.1 +content-type: application/json + +{ + "activation": { + "namespace": "default", + "action_name": "java-helloworld", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" + }, + "value": { + } +} + +### diff --git a/knative-build/runtimes/java/tests/knative/helloworld/payload-openwhisk-init.http b/knative-build/runtimes/java/tests/knative/helloworld/payload-openwhisk-init.http new file mode 100644 index 0000000..59bf732 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/payload-openwhisk-init.http @@ -0,0 +1,13 @@ +POST http://localhost:8080/init HTTP/1.1 +content-type: application/json + +{ + "value": { + "name" : "java-helloworld", + "main" : "Hello", + "binary": true, + "code" : "UEsDBBQACAgIABljwUoAAAAAAAAAAAAAAAAJAAQATUVUQS1JTkYv/soAAAMAUEsHCAAAAAACAAAAAAAAAFBLAwQUAAgICAAZY8FKAAAAAAAAAAAAAAAAFAAAAE1FVEEtSU5GL01BTklGRVNULk1G803My0xLLS7RDUstKs7Mz7NSMNQz4OVyLkpNLElN0XWqBAlY6BnEmxkoaPgXJSbnpCo45xcV5BcllgCVa/Jy8XIBAFBLBwhiwEEKQwAAAEQAAABQSwMEFAAICAgACmPBSgAAAAAAAAAAAAAAAAsAAABIZWxsby5jbGFzc31T227TQBA9k5tdx6HBtCkUUhpuTdK0Bkq5NFUlioQQSqFSUCV428Qr4+JL5DgVfAp/AS+pRCU+gG9CiFmLgFTSWvLM7J6Zc2Zn7R+/vn0H8ABtAxaqOpZ0XDegYVmZmoEbuKnhlloweFvDHQOGCleUr+toKN9U+KqGlo [...] + } +} + +### diff --git a/knative-build/runtimes/java/tests/knative/helloworld/payload-openwhisk-run.http b/knative-build/runtimes/java/tests/knative/helloworld/payload-openwhisk-run.http new file mode 100644 index 0000000..d1569e6 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/payload-openwhisk-run.http @@ -0,0 +1,15 @@ +POST http://localhost:8080/run HTTP/1.1 +content-type: application/json + +{ + "value": { + }, + "namespace": "default", + "action_name": "java-helloworld", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" +} + +### diff --git a/knative-build/runtimes/java/tests/knative/helloworld/service.yaml.tmpl b/knative-build/runtimes/java/tests/knative/helloworld/service.yaml.tmpl new file mode 100644 index 0000000..74c7808 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworld/service.yaml.tmpl @@ -0,0 +1,12 @@ +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: java-helloworld + namespace: default +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: docker.io/${DOCKER_USERNAME}/java-8-helloworld diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparams/README.md b/knative-build/runtimes/java/tests/knative/helloworldwithparams/README.md new file mode 100644 index 0000000..e5e5550 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/README.md @@ -0,0 +1,74 @@ +<!-- +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--> + +# Hello World with Params Test for OpenWhisk Java Runtime using Knative + +## Running the test using the "Curl" command + +Depending on the value you set in [buildtemplate.yaml](../../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: java-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](build-without-code.yaml.tmpl)) + +``` +curl -H "Host: java-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: java-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: java-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: java-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!"}; +``` diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparams/build-without-code.yaml.tmpl b/knative-build/runtimes/java/tests/knative/helloworldwithparams/build-without-code.yaml.tmpl new file mode 100644 index 0000000..dbde022 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/build-without-code.yaml.tmpl @@ -0,0 +1,19 @@ +apiVersion: build.knative.dev/v1alpha1 +kind: Build +metadata: + name: java-8-helloworld-with-params +spec: + serviceAccountName: openwhisk-runtime-builder + source: + git: + url: "https://github.com/apache/incubator-openwhisk-devtools.git" + revision: "master" + template: + name: openwhisk-java-runtime + arguments: + - name: TARGET_IMAGE_NAME + value: "docker.io/${DOCKER_USERNAME}/java-8-helloworld-with-params" + - name: DOCKERFILE + value: "./knative-build/runtimes/java/core/java8/Dockerfile" + - name: OW_RUNTIME_DEBUG + value: "true" diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparams/build.yaml.tmpl b/knative-build/runtimes/java/tests/knative/helloworldwithparams/build.yaml.tmpl new file mode 100644 index 0000000..19fbc66 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/build.yaml.tmpl @@ -0,0 +1,27 @@ +apiVersion: build.knative.dev/v1alpha1 +kind: Build +metadata: + name: java-8-helloworld-with-params +spec: + serviceAccountName: openwhisk-runtime-builder + source: + git: + url: "https://github.com/apache/incubator-openwhisk-devtools.git" + revision: "master" + template: + name: openwhisk-java-runtime + arguments: + - name: TARGET_IMAGE_NAME + value: "docker.io/${DOCKER_USERNAME}/java-8-helloworld-with-params" + - name: DOCKERFILE + value: "./knative-build/runtimes/java/core/java8/Dockerfile" + - name: OW_RUNTIME_DEBUG + value: "true" + - name: OW_ACTION_NAME + value: "java-helloworld-with-params" + - name: OW_ACTION_MAIN + value: "Hello" + - name: OW_ACTION_BINARY + value: "true" + - name: OW_ACTION_CODE + value: "" diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparams/knative-data-init-run.json b/knative-build/runtimes/java/tests/knative/helloworldwithparams/knative-data-init-run.json new file mode 100644 index 0000000..2406da1 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/knative-data-init-run.json @@ -0,0 +1,20 @@ +{ + "init": { + "name" : "java-helloworld-with-params", + "main" : "Hello", + "binary": true, + "code" : "" + }, + "activation": { + "namespace": "default", + "action_name": "java-helloworld-with-params", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" + }, + "value": { + "name" : "Joe", + "place" : "TX" + } +} diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparams/knative-data-init.json b/knative-build/runtimes/java/tests/knative/helloworldwithparams/knative-data-init.json new file mode 100644 index 0000000..5448727 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/knative-data-init.json @@ -0,0 +1,8 @@ +{ + "init": { + "name" : "java-helloworld-with-params", + "main" : "Hello", + "binary": true, + "code" : "" + } +} diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparams/knative-data-run.json b/knative-build/runtimes/java/tests/knative/helloworldwithparams/knative-data-run.json new file mode 100644 index 0000000..290d5f7 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/knative-data-run.json @@ -0,0 +1,14 @@ +{ + "activation": { + "namespace": "default", + "action_name": "java-helloworld-with-params", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" + }, + "value": { + "name" : "Jill", + "place" : "OK" + } +} diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparams/openwhisk-data-init.json b/knative-build/runtimes/java/tests/knative/helloworldwithparams/openwhisk-data-init.json new file mode 100644 index 0000000..5c624cc --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/openwhisk-data-init.json @@ -0,0 +1,8 @@ +{ + "value": { + "name" : "java-helloworld-with-params", + "main" : "Hello", + "binary": true, + "code" : "" + } +} diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparams/openwhisk-data-run.json b/knative-build/runtimes/java/tests/knative/helloworldwithparams/openwhisk-data-run.json new file mode 100644 index 0000000..4aa6646 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/openwhisk-data-run.json @@ -0,0 +1,12 @@ +{ + "value": { + "name" : "Joe", + "place" : "TX" + }, + "namespace": "default", + "action_name": "java-helloworld-with-params", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" +} diff --git a/knative-build/runtimes/javascript/tests/error/payload-knative-activation-action-name-missing.http b/knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-knative-init-run.http similarity index 52% copy from knative-build/runtimes/javascript/tests/error/payload-knative-activation-action-name-missing.http copy to knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-knative-init-run.http index 8b47670..7f7fffd 100644 --- a/knative-build/runtimes/javascript/tests/error/payload-knative-activation-action-name-missing.http +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-knative-init-run.http @@ -3,21 +3,22 @@ content-type: application/json { "init": { - "name": "nodejs-helloworld-from-init", - "main": "main", - "binary": false, - "code": "function main() {return {payload: 'Hello World! (' + process.env[\"__OW_ACTION_NAME\"] + ')'};}" + "name" : "java-helloworld-with-params", + "main" : "Hello", + "binary": true, + "code" : "" }, "activation": { "namespace": "default", + "action_name": "java-helloworld-with-params", "api_host": "", "api_key": "", "activation_id": "", "deadline": "4102498800000" }, "value": { - "name": "Joe", - "place": "TX" + "name" : "Joe", + "place" : "TX" } } diff --git a/knative-build/runtimes/javascript/tests/error/payload-bad-knative-init-code-empty.http b/knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-knative-init.http similarity index 50% copy from knative-build/runtimes/javascript/tests/error/payload-bad-knative-init-code-empty.http copy to knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-knative-init.http index 4c172f3..f1a9d56 100644 --- a/knative-build/runtimes/javascript/tests/error/payload-bad-knative-init-code-empty.http +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-knative-init.http @@ -2,10 +2,10 @@ POST http://localhost:8080/ HTTP/1.1 content-type: application/json { - "value": { - "name" : "nodejs-helloworld", - "main" : "main", - "binary": false, + "init": { + "name" : "java-helloworld-with-params", + "main" : "Hello", + "binary": true, "code" : "" } } diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-knative-run.http b/knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-knative-run.http new file mode 100644 index 0000000..085165a --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-knative-run.http @@ -0,0 +1,19 @@ +POST http://localhost:8080/ HTTP/1.1 +content-type: application/json + +{ + "activation": { + "namespace": "default", + "action_name": "java-helloworld-with-params", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" + }, + "value": { + "name" : "Jill", + "place" : "OK" + } +} + +### diff --git a/knative-build/runtimes/javascript/tests/error/payload-bad-openwhisk-init-code-empty.http b/knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-openwhisk-init.http similarity index 56% copy from knative-build/runtimes/javascript/tests/error/payload-bad-openwhisk-init-code-empty.http copy to knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-openwhisk-init.http index d121a8b..8885a5b 100644 --- a/knative-build/runtimes/javascript/tests/error/payload-bad-openwhisk-init-code-empty.http +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-openwhisk-init.http @@ -3,9 +3,9 @@ content-type: application/json { "value": { - "name" : "nodejs-helloworld-with-params", - "main" : "main", - "binary": false, + "name" : "java-helloworld-with-params", + "main" : "Hello", + "binary": true, "code" : "" } } diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-openwhisk-run.http b/knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-openwhisk-run.http new file mode 100644 index 0000000..906498d --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/payload-openwhisk-run.http @@ -0,0 +1,17 @@ +POST http://localhost:8080/run HTTP/1.1 +content-type: application/json + +{ + "value": { + "name" : "Joe", + "place" : "TX" + }, + "namespace": "default", + "action_name": "java-helloworld-with-params", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" +} + +### diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparams/service.yaml.tmpl b/knative-build/runtimes/java/tests/knative/helloworldwithparams/service.yaml.tmpl new file mode 100644 index 0000000..5c7adc2 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparams/service.yaml.tmpl @@ -0,0 +1,12 @@ +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: java-helloworld-with-params + namespace: default +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: docker.io/${DOCKER_USERNAME}/java-8-helloworld-with-params diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/README.md b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/README.md new file mode 100644 index 0000000..7273d0f --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/README.md @@ -0,0 +1,74 @@ +<!-- +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--> + +# Hello World with Params from Env. Test for OpenWhisk Java Runtime using Knative + +## Running the test using the "Curl" command + +Depending on the value you set in [buildtemplate.yaml](../../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: java-helloworld-with-params-from-env.default.example.com" -X POST 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](build-without-code.yaml.tmpl)) + +``` +curl -H "Host: java-helloworld-with-params-from-env.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: java-helloworld-with-params-from-env.default.example.com" -d "@knative-data-run.json" -H "Content-Type: application/json" -X POST http://localhost/ + +{"payload":"Hello Jess 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: java-helloworld-with-params-from-env.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: java-helloworld-with-params-from-env.default.example.com" -d "@openwhisk-data-run.json" -H "Content-Type: application/json" -X POST http://localhost/run + +{"payload":"Hello Jess from OK!"}; +``` diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/build-without-code.yaml.tmpl b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/build-without-code.yaml.tmpl new file mode 100644 index 0000000..fc5f7b7 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/build-without-code.yaml.tmpl @@ -0,0 +1,19 @@ +apiVersion: build.knative.dev/v1alpha1 +kind: Build +metadata: + name: java-8-helloworld-with-params-from-env +spec: + serviceAccountName: openwhisk-runtime-builder + source: + git: + url: "https://github.com/apache/incubator-openwhisk-devtools.git" + revision: "master" + template: + name: openwhisk-java-runtime + arguments: + - name: TARGET_IMAGE_NAME + value: "docker.io/${DOCKER_USERNAME}/java-8-helloworld-with-params-from-env" + - name: DOCKERFILE + value: "./knative-build/runtimes/java/core/java8/Dockerfile" + - name: OW_RUNTIME_DEBUG + value: "true" diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/build.yaml.tmpl b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/build.yaml.tmpl new file mode 100644 index 0000000..bb1ce72 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/build.yaml.tmpl @@ -0,0 +1,23 @@ +apiVersion: build.knative.dev/v1alpha1 +kind: Build +metadata: + name: java-8-helloworld-with-params-from-env +spec: + serviceAccountName: openwhisk-runtime-builder + source: + git: + url: "https://github.com/apache/incubator-openwhisk-devtools.git" + revision: "master" + template: + name: openwhisk-java-runtime + arguments: + - name: TARGET_IMAGE_NAME + value: "docker.io/${DOCKER_USERNAME}/java-8-helloworld-with-params-from-env" + - name: DOCKERFILE + value: "./knative-build/runtimes/java/core/java8/Dockerfile" + - name: OW_RUNTIME_DEBUG + value: "true" + - name: OW_ACTION_NAME + value: "java-helloworld-with-params-from-env" + - name: OW_ACTION_CODE + value: "" diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/knative-data-init-run.json b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/knative-data-init-run.json new file mode 100644 index 0000000..cb1d507 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/knative-data-init-run.json @@ -0,0 +1,20 @@ +{ + "init": { + "name" : "java-helloworld-with-params-from-env", + "main" : "Hello", + "binary": true, + "code" : "" + }, + "activation": { + "namespace": "default", + "action_name": "java-helloworld-with-params-from-env", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" + }, + "value": { + "name" : "Jess", + "place" : "OK" + } +} diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/knative-data-init.json b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/knative-data-init.json new file mode 100644 index 0000000..04c705d --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/knative-data-init.json @@ -0,0 +1,9 @@ +{ + "init": { + "name" : "java-helloworld-with-params-from-env", + "main" : "Hello", + "binary": true, + "code" : "" + } +} + diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/knative-data-run.json b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/knative-data-run.json new file mode 100644 index 0000000..c09773f --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/knative-data-run.json @@ -0,0 +1,15 @@ +{ + "activation": { + "namespace": "default", + "action_name": "java-helloworld-with-params-from-env", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" + }, + "value": { + "name" : "Jess", + "place" : "OK" + } +} + diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/openwhisk-data-init.json b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/openwhisk-data-init.json new file mode 100644 index 0000000..23d0ae0 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/openwhisk-data-init.json @@ -0,0 +1,8 @@ +{ + "value": { + "name" : "java-helloworld-with-params-from-env", + "main" : "Hello", + "binary": true, + "code" : "" + } +} diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/openwhisk-data-run.json b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/openwhisk-data-run.json new file mode 100644 index 0000000..0277dc9 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/openwhisk-data-run.json @@ -0,0 +1,12 @@ +{ + "value": { + "name" : "Jess", + "place" : "OK" + }, + "namespace": "default", + "action_name": "java-helloworld-with-params-from-env", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" +} diff --git a/knative-build/runtimes/javascript/tests/error/payload-knative-activation-action-name-missing.http b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/payload-knative-init-run.http similarity index 52% copy from knative-build/runtimes/javascript/tests/error/payload-knative-activation-action-name-missing.http copy to knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/payload-knative-init-run.http index 8b47670..21581ef 100644 --- a/knative-build/runtimes/javascript/tests/error/payload-knative-activation-action-name-missing.http +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/payload-knative-init-run.http @@ -3,21 +3,22 @@ content-type: application/json { "init": { - "name": "nodejs-helloworld-from-init", - "main": "main", - "binary": false, - "code": "function main() {return {payload: 'Hello World! (' + process.env[\"__OW_ACTION_NAME\"] + ')'};}" + "name" : "java-helloworld-with-params-from-env", + "main" : "Hello", + "binary": true, + "code" : "" }, "activation": { "namespace": "default", + "action_name": "java-helloworld-with-params-from-env", "api_host": "", "api_key": "", "activation_id": "", "deadline": "4102498800000" }, "value": { - "name": "Joe", - "place": "TX" + "name" : "Jess", + "place" : "OK" } } diff --git a/knative-build/runtimes/javascript/tests/error/payload-bad-openwhisk-init-code-empty.http b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/payload-openwhisk-init.http similarity index 54% copy from knative-build/runtimes/javascript/tests/error/payload-bad-openwhisk-init-code-empty.http copy to knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/payload-openwhisk-init.http index d121a8b..ea33f3b 100644 --- a/knative-build/runtimes/javascript/tests/error/payload-bad-openwhisk-init-code-empty.http +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/payload-openwhisk-init.http @@ -3,9 +3,9 @@ content-type: application/json { "value": { - "name" : "nodejs-helloworld-with-params", - "main" : "main", - "binary": false, + "name" : "java-helloworld-with-params-from-env", + "main" : "Hello", + "binary": true, "code" : "" } } diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/payload-openwhisk-run.http b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/payload-openwhisk-run.http new file mode 100644 index 0000000..42da372 --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/payload-openwhisk-run.http @@ -0,0 +1,16 @@ +POST http://localhost:8080/run HTTP/1.1 +content-type: application/json + +{ + "value": { + "name" : "Jess", + "place" : "OK" + }, + "namespace": "default", + "action_name": "java-helloworld-with-params-from-env", + "api_host": "", + "api_key": "", + "activation_id": "", + "deadline": "4102498800000" +} +### diff --git a/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/service.yaml.tmpl b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/service.yaml.tmpl new file mode 100644 index 0000000..36e3cfb --- /dev/null +++ b/knative-build/runtimes/java/tests/knative/helloworldwithparamsfromenv/service.yaml.tmpl @@ -0,0 +1,17 @@ +apiVersion: serving.knative.dev/v1alpha1 +kind: Service +metadata: + name: java-helloworld-with-params-from-env + namespace: default +spec: + runLatest: + configuration: + revisionTemplate: + spec: + container: + image: docker.io/${DOCKER_USERNAME}/java-8-helloworld-with-params-from-env + env: + - name: NAME + value: Bob + - name: PLACE + value: Italy diff --git a/knative-build/runtimes/java/tests/src/test/resources/application.conf b/knative-build/runtimes/java/tests/src/test/resources/application.conf new file mode 100644 index 0000000..759f063 --- /dev/null +++ b/knative-build/runtimes/java/tests/src/test/resources/application.conf @@ -0,0 +1,8 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements; and to You under the Apache License, Version 2.0. + +whisk.spi { + SimpleSpi = whisk.spi.SimpleSpiImpl + MissingSpi = whisk.spi.MissingImpl + MissingModule = missing.module +} diff --git a/knative-build/runtimes/java/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala b/knative-build/runtimes/java/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala new file mode 100644 index 0000000..a990f33 --- /dev/null +++ b/knative-build/runtimes/java/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala @@ -0,0 +1,417 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package actionContainers + +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner +import common.WskActorSystem +import spray.json.DefaultJsonProtocol._ +import spray.json._ +import actionContainers.ResourceHelpers.JarBuilder +import actionContainers.ActionContainer.withContainer + +@RunWith(classOf[JUnitRunner]) +class JavaActionContainerTests extends BasicActionRunnerTests with WskActorSystem { + + // Helpers specific to java actions + override def withActionContainer(env: Map[String, String] = Map.empty)( + code: ActionContainer => Unit): (String, String) = withContainer("java8action", env)(code) + + behavior of "Java action" + + override val testNoSourceOrExec = { + TestConfig("") + } + + override val testNotReturningJson = { + // skip this test since and add own below (see Nuller) + TestConfig("", skipTest = true) + } + + override val testEnv = { + TestConfig( + JarBuilder.mkBase64Jar( + Seq("example", "HelloWhisk.java") -> + """ + | package example; + | + | import com.google.gson.JsonObject; + | + | public class HelloWhisk { + | public static JsonObject main(JsonObject args) { + | JsonObject response = new JsonObject(); + | response.addProperty("api_host", System.getenv("__OW_API_HOST")); + | response.addProperty("api_key", System.getenv("__OW_API_KEY")); + | response.addProperty("namespace", System.getenv("__OW_NAMESPACE")); + | response.addProperty("action_name", System.getenv("__OW_ACTION_NAME")); + | response.addProperty("activation_id", System.getenv("__OW_ACTIVATION_ID")); + | response.addProperty("deadline", System.getenv("__OW_DEADLINE")); + | return response; + | } + | } + """.stripMargin.trim), + main = "example.HelloWhisk") + } + + override val testEcho = { + TestConfig( + JarBuilder.mkBase64Jar( + Seq("example", "HelloWhisk.java") -> + """ + | package example; + | + | import com.google.gson.JsonObject; + | + | public class HelloWhisk { + | public static JsonObject main(JsonObject args) { + | System.out.println("hello stdout"); + | System.err.println("hello stderr"); + | return args; + | } + | } + """.stripMargin.trim), + "example.HelloWhisk") + } + + override val testUnicode = { + TestConfig( + JarBuilder.mkBase64Jar( + Seq("example", "HelloWhisk.java") -> + """ + | package example; + | + | import com.google.gson.JsonObject; + | + | public class HelloWhisk { + | public static JsonObject main(JsonObject args) { + | String delimiter = args.getAsJsonPrimitive("delimiter").getAsString(); + | JsonObject response = new JsonObject(); + | String str = delimiter + " ☃ " + delimiter; + | System.out.println(str); + | response.addProperty("winter", str); + | return response; + | } + | } + """.stripMargin), + "example.HelloWhisk") + } + + def echo(main: String = "main") = { + JarBuilder.mkBase64Jar( + Seq("example", "HelloWhisk.java") -> + s""" + | package example; + | + | import com.google.gson.JsonObject; + | + | public class HelloWhisk { + | public static JsonObject $main(JsonObject args) { + | return args; + | } + | } + """.stripMargin.trim) + } + + override val testInitCannotBeCalledMoreThanOnce = { + TestConfig(echo(), "example.HelloWhisk") + } + + override val testEntryPointOtherThanMain = { + TestConfig(echo("naim"), "example.HelloWhisk#naim") + } + + override val testLargeInput = { + TestConfig(echo(), "example.HelloWhisk") + } + + Seq("", "x", "!", "#", "#main", "#bogus").foreach { m => + it should s"report an error if explicit 'main' is not found ($m)" in { + val (out, err) = withActionContainer() { c => + val (initCode, out) = c.init(initPayload(echo("hello"), s"example.HelloWhisk$m")) + initCode shouldBe 502 + + out shouldBe { + val error = m match { + case c if c == "x" || c == "!" => s"java.lang.ClassNotFoundException: example.HelloWhisk$c" + case "#bogus" => "java.lang.NoSuchMethodException: example.HelloWhisk.bogus(com.google.gson.JsonObject)" + case _ => "java.lang.NoSuchMethodException: example.HelloWhisk.main(com.google.gson.JsonObject)" + } + Some(JsObject("error" -> s"An error has occurred (see logs for details): $error".toJson)) + } + } + + checkStreams(out, err, { + case (o, e) => + o shouldBe empty + e should not be empty + }) + } + } + + it should "fail to initialize with bad code" in { + val (out, err) = withActionContainer() { c => + // This is valid zip file containing a single file, but not a valid + // jar file. + val brokenJar = ("UEsDBAoAAAAAAPxYbkhT4iFbCgAAAAoAAAANABwAbm90YWNsYXNzZmlsZVV" + + "UCQADzNPmVszT5lZ1eAsAAQT1AQAABAAAAABzYXVjaXNzb24KUEsBAh4DCg" + + "AAAAAA/FhuSFPiIVsKAAAACgAAAA0AGAAAAAAAAQAAAKSBAAAAAG5vdGFjb" + + "GFzc2ZpbGVVVAUAA8zT5lZ1eAsAAQT1AQAABAAAAABQSwUGAAAAAAEAAQBT" + + "AAAAUQAAAAAA") + + val (initCode, _) = c.init(initPayload(brokenJar, "example.Broken")) + initCode should not be (200) + } + + // Somewhere, the logs should contain an exception. + checkStreams(out, err, { + case (o, e) => + (o + e).toLowerCase should include("exception") + }) + } + + it should "return some error on action error" in { + val (out, err) = withActionContainer() { c => + val jar = JarBuilder.mkBase64Jar( + Seq("example", "HelloWhisk.java") -> + """ + | package example; + | + | import com.google.gson.JsonObject; + | + | public class HelloWhisk { + | public static JsonObject main(JsonObject args) throws Exception { + | throw new Exception("noooooooo"); + | } + | } + """.stripMargin.trim) + + val (initCode, _) = c.init(initPayload(jar, "example.HelloWhisk")) + initCode should be(200) + + val (runCode, runRes) = c.run(runPayload(JsObject.empty)) + runCode should not be (200) + + runRes shouldBe defined + runRes.get.fields.get("error") shouldBe defined + } + + checkStreams(out, err, { + case (o, e) => + (o + e).toLowerCase should include("exception") + }) + } + + it should "support application errors" in { + val (out, err) = withActionContainer() { c => + val jar = JarBuilder.mkBase64Jar( + Seq("example", "Error.java") -> + """ + | package example; + | + | import com.google.gson.JsonObject; + | + | public class Error { + | public static JsonObject main(JsonObject args) throws Exception { + | JsonObject error = new JsonObject(); + | error.addProperty("error", "This action is unhappy."); + | return error; + | } + | } + """.stripMargin.trim) + + val (initCode, _) = c.init(initPayload(jar, "example.Error")) + initCode should be(200) + + val (runCode, runRes) = c.run(runPayload(JsObject.empty)) + runCode should be(200) // action writer returning an error is OK + + runRes shouldBe defined + runRes.get.fields.get("error") shouldBe defined + } + + checkStreams(out, err, { + case (o, e) => + o shouldBe empty + e shouldBe empty + }) + } + + it should "support main in default package" in { + val (out, err) = withActionContainer() { c => + val jar = JarBuilder.mkBase64Jar( + Seq("", "HelloWhisk.java") -> + """ + | import com.google.gson.JsonObject; + | + | public class HelloWhisk { + | public static JsonObject main(JsonObject args) throws Exception { + | return args; + | } + | } + """.stripMargin.trim) + + val (initCode, _) = c.init(initPayload(jar, "HelloWhisk")) + initCode should be(200) + + val args = JsObject("a" -> "A".toJson) + val (runCode, runRes) = c.run(runPayload(args)) + runCode should be(200) + runRes shouldBe Some(args) + } + + checkStreams(out, err, { + case (o, e) => + o shouldBe empty + e shouldBe empty + }) + } + + it should "survive System.exit" in { + val (out, err) = withActionContainer() { c => + val jar = JarBuilder.mkBase64Jar( + Seq("example", "Quitter.java") -> + """ + | package example; + | + | import com.google.gson.*; + | + | public class Quitter { + | public static JsonObject main(JsonObject main) { + | System.exit(1); + | return new JsonObject(); + | } + | } + """.stripMargin.trim) + + val (initCode, _) = c.init(initPayload(jar, "example.Quitter")) + initCode should be(200) + + val (runCode, runRes) = c.run(runPayload(JsObject.empty)) + runCode should not be (200) + + runRes shouldBe defined + runRes.get.fields.get("error") shouldBe defined + } + + checkStreams(out, err, { + case (o, e) => + (o + e).toLowerCase should include("system.exit") + }) + } + + it should "enforce that the user returns an object" in { + val (out, err) = withActionContainer() { c => + val jar = JarBuilder.mkBase64Jar( + Seq("example", "Nuller.java") -> + """ + | package example; + | + | import com.google.gson.*; + | + | public class Nuller { + | public static JsonObject main(JsonObject args) { + | return null; + | } + | } + """.stripMargin.trim) + + val (initCode, _) = c.init(initPayload(jar, "example.Nuller")) + initCode should be(200) + + val (runCode, runRes) = c.run(runPayload(JsObject.empty)) + runCode should not be (200) + + runRes shouldBe defined + runRes.get.fields.get("error") shouldBe defined + } + + checkStreams(out, err, { + case (o, e) => + (o + e).toLowerCase should include("the action returned null") + }) + } + + val dynamicLoadingJar = JarBuilder.mkBase64Jar( + Seq( + Seq("example", "EntryPoint.java") -> + """ + | package example; + | + | import com.google.gson.*; + | import java.lang.reflect.*; + | + | public class EntryPoint { + | private final static String CLASS_NAME = "example.DynamicClass"; + | public static JsonObject main(JsonObject args) throws Exception { + | String cl = args.getAsJsonPrimitive("classLoader").getAsString(); + | + | Class d = null; + | if("local".equals(cl)) { + | d = Class.forName(CLASS_NAME); + | } else if("thread".equals(cl)) { + | d = Thread.currentThread().getContextClassLoader().loadClass(CLASS_NAME); + | } + | + | Object o = d.newInstance(); + | Method m = o.getClass().getMethod("getMessage"); + | String msg = (String)m.invoke(o); + | + | JsonObject response = new JsonObject(); + | response.addProperty("message", msg); + | return response; + | } + | } + """.stripMargin.trim, + Seq("example", "DynamicClass.java") -> + """ + | package example; + | + | public class DynamicClass { + | public String getMessage() { + | return "dynamic!"; + | } + | } + """.stripMargin.trim)) + + def classLoaderTest(param: String) = { + val (out, err) = withActionContainer() { c => + val (initCode, _) = c.init(initPayload(dynamicLoadingJar, "example.EntryPoint")) + initCode should be(200) + + val (runCode, runRes) = c.run(runPayload(JsObject("classLoader" -> JsString(param)))) + runCode should be(200) + + runRes shouldBe defined + runRes.get.fields.get("message") shouldBe Some(JsString("dynamic!")) + } + + checkStreams(out, err, { + case (o, e) => + o shouldBe empty + e shouldBe empty + }) + } + + it should "support loading classes from the current classloader" in { + classLoaderTest("local") + } + + it should "support loading classes from the Thread classloader" in { + classLoaderTest("thread") + } +} diff --git a/knative-build/runtimes/javascript/tests/error/payload-run-get-bad-endpoint.http b/knative-build/runtimes/javascript/tests/error/payload-agnostic-bad-run-http-method-unsupported.http similarity index 69% rename from knative-build/runtimes/javascript/tests/error/payload-run-get-bad-endpoint.http rename to knative-build/runtimes/javascript/tests/error/payload-agnostic-bad-run-http-method-unsupported.http index 701d277..e31ea44 100644 --- a/knative-build/runtimes/javascript/tests/error/payload-run-get-bad-endpoint.http +++ b/knative-build/runtimes/javascript/tests/error/payload-agnostic-bad-run-http-method-unsupported.http @@ -2,8 +2,10 @@ GET http://localhost:8080/ HTTP/1.1 content-type: application/json { + "value": { "name" : "Bad", - "place" : "GET" + "place" : "POST" + } } ### \ No newline at end of file diff --git a/knative-build/runtimes/javascript/tests/error/payload-run-post-bad-endpoint.http b/knative-build/runtimes/javascript/tests/error/payload-agnostic-bad-run-invalid-route.http similarity index 85% rename from knative-build/runtimes/javascript/tests/error/payload-run-post-bad-endpoint.http rename to knative-build/runtimes/javascript/tests/error/payload-agnostic-bad-run-invalid-route.http index 0350866..839ea31 100644 --- a/knative-build/runtimes/javascript/tests/error/payload-run-post-bad-endpoint.http +++ b/knative-build/runtimes/javascript/tests/error/payload-agnostic-bad-run-invalid-route.http @@ -2,8 +2,10 @@ POST http://localhost:8080/bad HTTP/1.1 content-type: application/json { + "value": { "name" : "Bad", "place" : "POST" + } } ### \ No newline at end of file diff --git a/knative-build/runtimes/javascript/tests/error/payload-init-run-empty-data.http b/knative-build/runtimes/javascript/tests/error/payload-kn-bad-http-body-data-missing.http similarity index 100% rename from knative-build/runtimes/javascript/tests/error/payload-init-run-empty-data.http rename to knative-build/runtimes/javascript/tests/error/payload-kn-bad-http-body-data-missing.http diff --git a/knative-build/runtimes/javascript/tests/error/payload-no-body.http b/knative-build/runtimes/javascript/tests/error/payload-kn-bad-http-body-empty.http similarity index 100% rename from knative-build/runtimes/javascript/tests/error/payload-no-body.http rename to knative-build/runtimes/javascript/tests/error/payload-kn-bad-http-body-empty.http diff --git a/knative-build/runtimes/javascript/tests/error/payload-bad-knative-init-code-empty.http b/knative-build/runtimes/javascript/tests/error/payload-kn-bad-init-code-empty.http similarity index 74% rename from knative-build/runtimes/javascript/tests/error/payload-bad-knative-init-code-empty.http rename to knative-build/runtimes/javascript/tests/error/payload-kn-bad-init-code-empty.http index 4c172f3..4772e07 100644 --- a/knative-build/runtimes/javascript/tests/error/payload-bad-knative-init-code-empty.http +++ b/knative-build/runtimes/javascript/tests/error/payload-kn-bad-init-code-empty.http @@ -2,8 +2,8 @@ POST http://localhost:8080/ HTTP/1.1 content-type: application/json { - "value": { - "name" : "nodejs-helloworld", + "init": { + "name" : "bad-init-code-empty", "main" : "main", "binary": false, "code" : "" diff --git a/knative-build/runtimes/javascript/tests/error/payload-init-bad-json-payload.http b/knative-build/runtimes/javascript/tests/error/payload-kn-bad-init-json-payload-invalid.http similarity index 75% rename from knative-build/runtimes/javascript/tests/error/payload-init-bad-json-payload.http rename to knative-build/runtimes/javascript/tests/error/payload-kn-bad-init-json-payload-invalid.http index 06e9d28..0246d3f 100644 --- a/knative-build/runtimes/javascript/tests/error/payload-init-bad-json-payload.http +++ b/knative-build/runtimes/javascript/tests/error/payload-kn-bad-init-json-payload-invalid.http @@ -2,8 +2,8 @@ GET http://localhost:8080/ HTTP/1.1 content-type: application/json { - "value": { - "name" : "nodejs-helloworld", + "init": { + "name" : "bad-init-json-payload-syntax-error", "main" : "main", "binary": false, "code" : "function main() {return {payload: 'Hello World!'};}", diff --git a/knative-build/runtimes/javascript/tests/error/payload-knative-activation-action-name-empy.http b/knative-build/runtimes/javascript/tests/error/payload-kn-bad-initrun-activation-action-name-empy.http similarity index 100% rename from knative-build/runtimes/javascript/tests/error/payload-knative-activation-action-name-empy.http rename to knative-build/runtimes/javascript/tests/error/payload-kn-bad-initrun-activation-action-name-empy.http diff --git a/knative-build/runtimes/javascript/tests/error/payload-knative-activation-action-name-missing.http b/knative-build/runtimes/javascript/tests/error/payload-kn-bad-initrun-activation-action-name-missing.http similarity index 100% rename from knative-build/runtimes/javascript/tests/error/payload-knative-activation-action-name-missing.http rename to knative-build/runtimes/javascript/tests/error/payload-kn-bad-initrun-activation-action-name-missing.http diff --git a/knative-build/runtimes/javascript/tests/error/payload-bad-openwhisk-init-code-empty.http b/knative-build/runtimes/javascript/tests/error/payload-ow-bad-init-code-empty.http similarity index 77% rename from knative-build/runtimes/javascript/tests/error/payload-bad-openwhisk-init-code-empty.http rename to knative-build/runtimes/javascript/tests/error/payload-ow-bad-init-code-empty.http index d121a8b..6229444 100644 --- a/knative-build/runtimes/javascript/tests/error/payload-bad-openwhisk-init-code-empty.http +++ b/knative-build/runtimes/javascript/tests/error/payload-ow-bad-init-code-empty.http @@ -3,7 +3,7 @@ content-type: application/json { "value": { - "name" : "nodejs-helloworld-with-params", + "name" : "bad-init-code-empty", "main" : "main", "binary": false, "code" : "" diff --git a/knative-build/runtimes/javascript/tests/error/payload-bad-openwhisk-init-code-missing.http b/knative-build/runtimes/javascript/tests/error/payload-ow-bad-init-code-missing.http similarity index 75% rename from knative-build/runtimes/javascript/tests/error/payload-bad-openwhisk-init-code-missing.http rename to knative-build/runtimes/javascript/tests/error/payload-ow-bad-init-code-missing.http index 040c1d1..b75c867 100644 --- a/knative-build/runtimes/javascript/tests/error/payload-bad-openwhisk-init-code-missing.http +++ b/knative-build/runtimes/javascript/tests/error/payload-ow-bad-init-code-missing.http @@ -3,7 +3,7 @@ content-type: application/json { "value": { - "name" : "nodejs-helloworld", + "name" : "bad-init-no-code-key-missing", "main" : "main", "binary": false }