Skip to content

Commit 5d7b54e

Browse files
authored
release prep: build .zip needed for test execution (#47)
1 parent efc5a9e commit 5d7b54e

File tree

7 files changed

+88
-11
lines changed

7 files changed

+88
-11
lines changed

.gitignore

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

63-
# .zip files must be explicited whitelisted
63+
# Generated by tests:buildArtifacts
64+
.built
6465
*.zip
65-
!tests/dat/actions/blackbox.zip
66-
!tests/dat/actions/helloSwift.zip
67-
!tests/dat/actions/python.zip
68-
!tests/dat/actions/python2_virtualenv.zip
69-
!tests/dat/actions/python3_virtualenv.zip
70-
!tests/dat/actions/python_virtualenv_dir.zip
71-
!tests/dat/actions/python_virtualenv_name.zip
72-
!tests/dat/actions/zippedaction.zip
73-
!tests/dat/without_dir_entries.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 'src/test/resources'
48+
commandLine './build.sh'
49+
}
50+
51+
tasks.withType(Test) {
52+
dependsOn buildArtifacts
53+
}
54+
55+
testClasses.dependsOn(buildArtifacts)

tests/dat/without_dir_entries.zip

-592 Bytes
Binary file not shown.

tests/src/test/resources/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 without_dir_entries && zip ../without_dir_entries.zip -r -D .)
27+
28+
touch .built
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
require 'rbconfig'
19+
# ruby 1.8.7 doesn't define RUBY_ENGINE
20+
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
21+
ruby_version = RbConfig::CONFIG["ruby_version"]
22+
path = File.expand_path('..', __FILE__)
23+
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/betterlorem-0.1.2/lib"
24+
$:.unshift "#{path}/"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
def main(params = {})
19+
name = params["name"] || "stranger"
20+
greeting = "Hello #{name}!"
21+
{ greeting: greeting }
22+
end

tests/src/test/scala/actionContainers/Ruby25ActionContainerTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ class Ruby25ActionContainerTests extends BasicActionRunnerTests with WskActorSys
333333
}
334334

335335
it should "support zip-encoded packages without directory entries" in {
336-
val path = FileSystems.getDefault().getPath("dat", "without_dir_entries.zip");
336+
val path = FileSystems.getDefault().getPath("src", "test", "resources", "without_dir_entries.zip");
337337
val code = ResourceHelpers.readAsBase64(path)
338338

339339
val (out, err) = withRuby25Container { c =>

0 commit comments

Comments
 (0)