This is an automated email from the ASF dual-hosted git repository. csantanapr pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push: new 682eb5b Split system tests (#4098) 682eb5b is described below commit 682eb5b62ee6ba8017ab54226c2ace3637f4f1ec Author: tysonnorris <tysonnor...@gmail.com> AuthorDate: Wed Nov 7 13:40:26 2018 -0800 Split system tests (#4098) --- .travis.yml | 4 ++ ansible/files/runtimes-nodeonly.json | 32 ++++++++++++ ansible/group_vars/all | 4 +- tests/build.gradle | 11 +++- .../test/scala/system/basic/WskActionTests.scala | 20 -------- .../scala/system/basic/WskMultiRuntimeTests.scala | 60 ++++++++++++++++++++++ .../{runSystemTests.sh => runMultiRuntimeTests.sh} | 2 +- tools/travis/runSystemTests.sh | 4 +- tools/travis/setupPrereq.sh | 3 +- tools/travis/setupSystem.sh | 3 +- 10 files changed, 116 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a0b8ab..e9d80b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,6 +74,10 @@ jobs: - ./tools/travis/checkAndUploadLogs.sh system name: "System Tests" - script: + - ./tools/travis/runMultiRuntimeTests.sh + - ./tools/travis/checkAndUploadLogs.sh multi-runtime + name: "Multi-Runtime Tests" + - script: - ./tests/performance/preparation/deploy.sh - TERM=dumb ./tests/performance/wrk_tests/latency.sh "https://172.17.0.1:10001" "$(cat ansible/files/auth.guest)" 2m - TERM=dumb ./tests/performance/wrk_tests/throughput.sh "https://172.17.0.1:10001" "$(cat ansible/files/auth.guest)" 4 2 2m diff --git a/ansible/files/runtimes-nodeonly.json b/ansible/files/runtimes-nodeonly.json new file mode 100644 index 0000000..f265337 --- /dev/null +++ b/ansible/files/runtimes-nodeonly.json @@ -0,0 +1,32 @@ +{ + "runtimes": { + "nodejs": [ + { + "kind": "nodejs:6", + "default": true, + "image": { + "prefix": "openwhisk", + "name": "nodejs6action", + "tag": "latest" + }, + "deprecated": false, + "attached": { + "attachmentName": "codefile", + "attachmentType": "text/plain" + }, + "stemCells": [{ + "count": 2, + "memory": "256 MB" + }] + } + ] + + }, + "blackboxes": [ + { + "prefix": "openwhisk", + "name": "dockerskeleton", + "tag": "latest" + } + ] +} diff --git a/ansible/group_vars/all b/ansible/group_vars/all index 7dfb293..86c231a 100755 --- a/ansible/group_vars/all +++ b/ansible/group_vars/all @@ -48,7 +48,9 @@ whisk: # runtimes_bypass_pull_for_local_images: optional, if true, allow images with a prefix that matches # {{ runtimes_local_image_prefix }} to skip docker pull in invoker even if the image is not part of the blackbox set # -runtimesManifest: "{{ runtimes_manifest | default(lookup('file', openwhisk_home ~ '/ansible/files/runtimes.json') | from_json) }}" + +manifestfile: "{{ manifest_file | default('/ansible/files/runtimes.json') }}" +runtimesManifest: "{{ runtimes_manifest | default(lookup('file', openwhisk_home ~ '{{ manifestfile }}') | from_json) }}" limits: invocationsPerMinute: "{{ limit_invocations_per_minute | default(60) }}" diff --git a/tests/build.gradle b/tests/build.gradle index ba89352..2c3a6f7 100644 --- a/tests/build.gradle +++ b/tests/build.gradle @@ -69,7 +69,6 @@ ext.testSets = [ "includes" : [ "apigw/healthtests/**", "ha/**", - "limits/**", "services/**", "system/basic/**", "system/rest/**", @@ -79,6 +78,16 @@ ext.testSets = [ "whisk/core/limits/**", "whisk/core/database/test/*CacheConcurrencyTests*", "whisk/core/controller/test/*ControllerApiTests*", + ], + "excludes": [ + "system/basic/WskMultiRuntimeTests*" + ] + ], + "REQUIRE_MULTI_RUNTIME" : [ + "includes" : [ + "system/basic/*MultiRuntimeTests*", + "system/basic/*UnicodeTests*", + "limits/**" ] ], "LEAN" : [ diff --git a/tests/src/test/scala/system/basic/WskActionTests.scala b/tests/src/test/scala/system/basic/WskActionTests.scala index bec66b7..693ebb9 100644 --- a/tests/src/test/scala/system/basic/WskActionTests.scala +++ b/tests/src/test/scala/system/basic/WskActionTests.scala @@ -231,26 +231,6 @@ class WskActionTests extends TestHelpers with WskTestHelpers with JsHelpers with } } - it should "update an action with different language and check preserving params" in withAssetCleaner(wskprops) { - (wp, assetHelper) => - val name = "updatedAction" - - assetHelper.withCleaner(wsk.action, name, false) { (action, _) => - wsk.action.create( - name, - Some(TestUtils.getTestActionFilename("hello.js")), - parameters = Map("name" -> testString.toJson)) //unused in the first function - } - - wsk.action.create(name, Some(TestUtils.getTestActionFilename("hello.py")), update = true) - - val run = wsk.action.invoke(name) - withActivation(wsk.activation, run) { activation => - activation.response.status shouldBe "success" - activation.logs.get.mkString(" ") should include(s"Hello $testString") - } - } - it should "fail to invoke an action with an empty file" in withAssetCleaner(wskprops) { (wp, assetHelper) => val name = "empty" assetHelper.withCleaner(wsk.action, name) { (action, _) => diff --git a/tests/src/test/scala/system/basic/WskMultiRuntimeTests.scala b/tests/src/test/scala/system/basic/WskMultiRuntimeTests.scala new file mode 100644 index 0000000..2301f65 --- /dev/null +++ b/tests/src/test/scala/system/basic/WskMultiRuntimeTests.scala @@ -0,0 +1,60 @@ +/* + * 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 system.basic +import common.JsHelpers +import common.TestHelpers +import common.TestUtils +import common.WskActorSystem +import common.WskOperations +import common.WskProps +import common.WskTestHelpers +import common.rest.WskRestOperations +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner +import spray.json._ +import spray.json.DefaultJsonProtocol._ + +@RunWith(classOf[JUnitRunner]) +class WskMultiRuntimeTests extends TestHelpers with WskTestHelpers with JsHelpers with WskActorSystem { + + implicit val wskprops = WskProps() + // wsk must have type WskOperations so that tests using CLI (class Wsk) + // instead of REST (WskRestOperations) still work. + val wsk: WskOperations = new WskRestOperations + val testString = "this is a test" + + it should "update an action with different language and check preserving params" in withAssetCleaner(wskprops) { + (wp, assetHelper) => + val name = "updatedAction" + + assetHelper.withCleaner(wsk.action, name, false) { (action, _) => + wsk.action.create( + name, + Some(TestUtils.getTestActionFilename("hello.js")), + parameters = Map("name" -> testString.toJson)) //unused in the first function + } + + wsk.action.create(name, Some(TestUtils.getTestActionFilename("hello.py")), update = true) + + val run = wsk.action.invoke(name) + withActivation(wsk.activation, run) { activation => + activation.response.status shouldBe "success" + activation.logs.get.mkString(" ") should include(s"Hello $testString") + } + } +} diff --git a/tools/travis/runSystemTests.sh b/tools/travis/runMultiRuntimeTests.sh similarity index 94% copy from tools/travis/runSystemTests.sh copy to tools/travis/runMultiRuntimeTests.sh index f9c9ad3..e2de0c5 100755 --- a/tools/travis/runSystemTests.sh +++ b/tools/travis/runMultiRuntimeTests.sh @@ -24,7 +24,7 @@ ROOTDIR="$SCRIPTDIR/../.." cd $ROOTDIR/tools/travis -export ORG_GRADLE_PROJECT_testSetName="REQUIRE_SYSTEM" +export ORG_GRADLE_PROJECT_testSetName="REQUIRE_MULTI_RUNTIME" export GRADLE_COVERAGE=true ./setupPrereq.sh diff --git a/tools/travis/runSystemTests.sh b/tools/travis/runSystemTests.sh index f9c9ad3..8325cad 100755 --- a/tools/travis/runSystemTests.sh +++ b/tools/travis/runSystemTests.sh @@ -27,10 +27,10 @@ cd $ROOTDIR/tools/travis export ORG_GRADLE_PROJECT_testSetName="REQUIRE_SYSTEM" export GRADLE_COVERAGE=true -./setupPrereq.sh +./setupPrereq.sh /ansible/files/runtimes-nodeonly.json ./distDocker.sh -./setupSystem.sh +./setupSystem.sh /ansible/files/runtimes-nodeonly.json ./runTests.sh diff --git a/tools/travis/setupPrereq.sh b/tools/travis/setupPrereq.sh index e53daec..f820c28 100755 --- a/tools/travis/setupPrereq.sh +++ b/tools/travis/setupPrereq.sh @@ -22,6 +22,7 @@ set -e SECONDS=0 SCRIPTDIR=$(cd $(dirname "$0") && pwd) ROOTDIR="$SCRIPTDIR/../.." +RUNTIMES_MANIFEST=${1:-"/ansible/files/runtimes.json"} cd $ROOTDIR/ansible @@ -31,5 +32,5 @@ $ANSIBLE_CMD couchdb.yml $ANSIBLE_CMD initdb.yml $ANSIBLE_CMD wipe.yml -$ANSIBLE_CMD properties.yml +$ANSIBLE_CMD properties.yml -e manifest_file="$RUNTIMES_MANIFEST" echo "Time taken for ${0##*/} is $SECONDS secs" diff --git a/tools/travis/setupSystem.sh b/tools/travis/setupSystem.sh index 55c78ec..0750ddd 100755 --- a/tools/travis/setupSystem.sh +++ b/tools/travis/setupSystem.sh @@ -22,10 +22,11 @@ set -e SECONDS=0 SCRIPTDIR=$(cd $(dirname "$0") && pwd) ROOTDIR="$SCRIPTDIR/../.." +RUNTIMES_MANIFEST=${1:-"/ansible/files/runtimes.json"} cd $ROOTDIR/ansible -$ANSIBLE_CMD openwhisk.yml +$ANSIBLE_CMD openwhisk.yml -e manifest_file="$RUNTIMES_MANIFEST" $ANSIBLE_CMD apigateway.yml $ANSIBLE_CMD routemgmt.yml