From d47ee1b4a35012862bf5540354e4a133f309a20f Mon Sep 17 00:00:00 2001 From: David Grove Date: Fri, 7 Feb 2020 18:12:00 -0500 Subject: [PATCH] release prep: build .zip needed for test execution --- .gitignore | 12 ++------ tests/build.gradle | 11 +++++++ tests/dat/without_dir_entries.zip | Bin 592 -> 0 bytes tests/src/test/resources/build.sh | 28 ++++++++++++++++++ .../bundle/bundler/setup.rb | 24 +++++++++++++++ .../resources/without_dir_entries/main.rb | 22 ++++++++++++++ .../Ruby25ActionContainerTests.scala | 2 +- 7 files changed, 88 insertions(+), 11 deletions(-) delete mode 100644 tests/dat/without_dir_entries.zip create mode 100755 tests/src/test/resources/build.sh create mode 100644 tests/src/test/resources/without_dir_entries/bundle/bundler/setup.rb create mode 100644 tests/src/test/resources/without_dir_entries/main.rb diff --git a/.gitignore b/.gitignore index 0c3444f..7e20ebd 100644 --- a/.gitignore +++ b/.gitignore @@ -60,14 +60,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/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 -!tests/dat/without_dir_entries.zip diff --git a/tests/build.gradle b/tests/build.gradle index 1ae5a4b..c1f63e0 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 'src/test/resources' + commandLine './build.sh' +} + +tasks.withType(Test) { + dependsOn buildArtifacts +} + +testClasses.dependsOn(buildArtifacts) diff --git a/tests/dat/without_dir_entries.zip b/tests/dat/without_dir_entries.zip deleted file mode 100644 index 224a5f9cbf61b9c0a2e85fd6cd24c0ef2cadc5e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 592 zcmWIWW@h1HU|`??Vnqh2{f>RtfGjgc1_p5;om85al9Q?rp^Eg2Q%gz<^oo*l`y8_m zIS91A|E=BTn<#qg<}Gh;hZZj-Mo-5V3#V+_ktQVm$jw|jbK;-xYO|d9Y|lOZeNWnb z`7sNohhNrh+NsIHeZce=d)kkt^Akctq8}b5P-?zA3Xd?G})Ze((FPk$t*crs^Udy~Xjj_ZP3oPjzgM%K9`fCeqT% z#^w>v{FF?S|Jx^Sjt>9^g$Ot(7{gx8euvmbq7`#1wgHQOLIdfUVL&xikZrFy<73;1(2?{vjea4ryNMX@M zFNJkMYn*(0n}P~G1C!#avL*@zgjNM+WqGE>Sp_VeD? RHjoY`Ae;oGSAcXf002ZN%p(8* diff --git a/tests/src/test/resources/build.sh b/tests/src/test/resources/build.sh new file mode 100755 index 0000000..b74ea07 --- /dev/null +++ b/tests/src/test/resources/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 without_dir_entries && zip ../without_dir_entries.zip -r -D .) + +touch .built diff --git a/tests/src/test/resources/without_dir_entries/bundle/bundler/setup.rb b/tests/src/test/resources/without_dir_entries/bundle/bundler/setup.rb new file mode 100644 index 0000000..202c2a2 --- /dev/null +++ b/tests/src/test/resources/without_dir_entries/bundle/bundler/setup.rb @@ -0,0 +1,24 @@ +# +# 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. +# + +require 'rbconfig' +# ruby 1.8.7 doesn't define RUBY_ENGINE +ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby' +ruby_version = RbConfig::CONFIG["ruby_version"] +path = File.expand_path('..', __FILE__) +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/betterlorem-0.1.2/lib" +$:.unshift "#{path}/" diff --git a/tests/src/test/resources/without_dir_entries/main.rb b/tests/src/test/resources/without_dir_entries/main.rb new file mode 100644 index 0000000..42f5276 --- /dev/null +++ b/tests/src/test/resources/without_dir_entries/main.rb @@ -0,0 +1,22 @@ +# +# 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. +# + +def main(params = {}) + name = params["name"] || "stranger" + greeting = "Hello #{name}!" + { greeting: greeting } +end diff --git a/tests/src/test/scala/actionContainers/Ruby25ActionContainerTests.scala b/tests/src/test/scala/actionContainers/Ruby25ActionContainerTests.scala index c93d5a4..4e5839b 100644 --- a/tests/src/test/scala/actionContainers/Ruby25ActionContainerTests.scala +++ b/tests/src/test/scala/actionContainers/Ruby25ActionContainerTests.scala @@ -333,7 +333,7 @@ class Ruby25ActionContainerTests extends BasicActionRunnerTests with WskActorSys } it should "support zip-encoded packages without directory entries" in { - val path = FileSystems.getDefault().getPath("dat", "without_dir_entries.zip"); + val path = FileSystems.getDefault().getPath("src", "test", "resources", "without_dir_entries.zip"); val code = ResourceHelpers.readAsBase64(path) val (out, err) = withRuby25Container { c =>