This is an automated email from the ASF dual-hosted git repository. dgrove pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-nodejs.git
commit 7aca44335c567164a9108cf83c8c06b660f215a5 Author: David Grove <[email protected]> AuthorDate: Thu Feb 13 13:25:05 2020 -0500 build nodejs-test.zip from source before running tests --- .gitignore | 12 ++------- tests/build.gradle | 11 ++++++++ tests/dat/actions/build.sh | 28 +++++++++++++++++++ tests/dat/actions/nodejs-test.zip | Bin 1186 -> 0 bytes .../actions/nodejs-test/main.js} | 30 +++++---------------- .../nodejs-test/node_modules/abcxyz/index.js} | 28 ++----------------- tests/dat/actions/nodejs-test/package.json | 14 ++++++++++ 7 files changed, 63 insertions(+), 60 deletions(-) diff --git a/.gitignore b/.gitignore index 0bc5144..d5aef40 100644 --- a/.gitignore +++ b/.gitignore @@ -61,14 +61,6 @@ ansible/roles/nginx/files/openwhisk-client* ansible/roles/nginx/files/*.csr ansible/roles/nginx/files/*cert.pem -# .zip files must be explicited whitelisted +# Generated by tests:buildArtifacts +.built *.zip -!tests/dat/actions/blackbox.zip -!tests/dat/actions/helloSwift.zip -!tests/dat/actions/nodejs-test.zip -!tests/dat/actions/python.zip -!tests/dat/actions/python2_virtualenv.zip -!tests/dat/actions/python3_virtualenv.zip -!tests/dat/actions/python_virtualenv_dir.zip -!tests/dat/actions/python_virtualenv_name.zip -!tests/dat/actions/zippedaction.zip diff --git a/tests/build.gradle b/tests/build.gradle index 1ae5a4b..bdb648e 100644 --- a/tests/build.gradle +++ b/tests/build.gradle @@ -42,3 +42,14 @@ dependencies { tasks.withType(ScalaCompile) { scalaCompileOptions.additionalParameters = gradle.scala.compileFlags } + +task buildArtifacts(type:Exec) { + workingDir 'tests/dat/actions' + commandLine './build.sh' +} + +tasks.withType(Test) { + dependsOn buildArtifacts +} + +testClasses.dependsOn(buildArtifacts) diff --git a/tests/dat/actions/build.sh b/tests/dat/actions/build.sh new file mode 100755 index 0000000..0ee1a9c --- /dev/null +++ b/tests/dat/actions/build.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# +# 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. +# + +set -e + +if [ -f ".built" ]; then + echo "Test zip artifacts already built, skipping" + exit 0 +fi + +(cd nodejs-test && zip ../nodejs-test.zip -r .) + +touch .built diff --git a/tests/dat/actions/nodejs-test.zip b/tests/dat/actions/nodejs-test.zip deleted file mode 100644 index c7483e3..0000000 Binary files a/tests/dat/actions/nodejs-test.zip and /dev/null differ diff --git a/tests/build.gradle b/tests/dat/actions/nodejs-test/main.js similarity index 52% copy from tests/build.gradle copy to tests/dat/actions/nodejs-test/main.js index 1ae5a4b..453e9c8 100644 --- a/tests/build.gradle +++ b/tests/dat/actions/nodejs-test/main.js @@ -15,30 +15,12 @@ * 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" +function main(args) { + let x = require('abcxyz') + return { "message": x() }; } -tasks.withType(ScalaCompile) { - scalaCompileOptions.additionalParameters = gradle.scala.compileFlags +module.exports = { + main: main, + niam: main } diff --git a/tests/build.gradle b/tests/dat/actions/nodejs-test/node_modules/abcxyz/index.js similarity index 52% copy from tests/build.gradle copy to tests/dat/actions/nodejs-test/node_modules/abcxyz/index.js index 1ae5a4b..ca6dea7 100644 --- a/tests/build.gradle +++ b/tests/dat/actions/nodejs-test/node_modules/abcxyz/index.js @@ -15,30 +15,6 @@ * 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 +module.exports = function() { + return 'hello local library'; } diff --git a/tests/dat/actions/nodejs-test/package.json b/tests/dat/actions/nodejs-test/package.json new file mode 100644 index 0000000..2ee776e --- /dev/null +++ b/tests/dat/actions/nodejs-test/package.json @@ -0,0 +1,14 @@ +{ + "name": "nodejs-zip", + "version": "1.0.0", + "description": "Zip to test NodeJS runtime against", + "main": "main.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "openwhisk": "^2.0.0" + } +}
