Skip to content

Commit 7aca443

Browse files
committed
build nodejs-test.zip from source before running tests
1 parent 5ca1d86 commit 7aca443

File tree

7 files changed

+101
-10
lines changed

7 files changed

+101
-10
lines changed

.gitignore

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@ ansible/roles/nginx/files/openwhisk-client*
6161
ansible/roles/nginx/files/*.csr
6262
ansible/roles/nginx/files/*cert.pem
6363

64-
# .zip files must be explicited whitelisted
64+
# Generated by tests:buildArtifacts
65+
.built
6566
*.zip
66-
!tests/dat/actions/blackbox.zip
67-
!tests/dat/actions/helloSwift.zip
68-
!tests/dat/actions/nodejs-test.zip
69-
!tests/dat/actions/python.zip
70-
!tests/dat/actions/python2_virtualenv.zip
71-
!tests/dat/actions/python3_virtualenv.zip
72-
!tests/dat/actions/python_virtualenv_dir.zip
73-
!tests/dat/actions/python_virtualenv_name.zip
74-
!tests/dat/actions/zippedaction.zip

tests/build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,14 @@ dependencies {
4242
tasks.withType(ScalaCompile) {
4343
scalaCompileOptions.additionalParameters = gradle.scala.compileFlags
4444
}
45+
46+
task buildArtifacts(type:Exec) {
47+
workingDir 'tests/dat/actions'
48+
commandLine './build.sh'
49+
}
50+
51+
tasks.withType(Test) {
52+
dependsOn buildArtifacts
53+
}
54+
55+
testClasses.dependsOn(buildArtifacts)

tests/dat/actions/build.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
set -e
20+
21+
if [ -f ".built" ]; then
22+
echo "Test zip artifacts already built, skipping"
23+
exit 0
24+
fi
25+
26+
(cd nodejs-test && zip ../nodejs-test.zip -r .)
27+
28+
touch .built

tests/dat/actions/nodejs-test.zip

-1.16 KB
Binary file not shown.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
function main(args) {
19+
let x = require('abcxyz')
20+
return { "message": x() };
21+
}
22+
23+
module.exports = {
24+
main: main,
25+
niam: main
26+
}

tests/dat/actions/nodejs-test/node_modules/abcxyz/index.js

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "nodejs-zip",
3+
"version": "1.0.0",
4+
"description": "Zip to test NodeJS runtime against",
5+
"main": "main.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"openwhisk": "^2.0.0"
13+
}
14+
}

0 commit comments

Comments
 (0)