You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2017/09/07 15:10:30 UTC
[incubator-openwhisk] branch master updated: Remove redundant test
suite. Also remove some spurious log messages. (#2693)
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 25f290d Remove redundant test suite. Also remove some spurious log messages. (#2693)
25f290d is described below
commit 25f290d953fe2a26573545f18f38a8fcdda6ea5f
Author: rodric rabbah <ro...@gmail.com>
AuthorDate: Thu Sep 7 11:10:28 2017 -0400
Remove redundant test suite. Also remove some spurious log messages. (#2693)
---
.../test/scala/system/basic/WskConsoleTests.scala | 1 -
.../test/scala/system/basic/WskSequenceTests.scala | 14 ++---
.../actions/test/ActivationFinisherTests.scala | 2 +-
.../core/controller/test/AuthenticateTests.scala | 33 +++++-----
.../core/controller/test/AuthenticateV2Tests.scala | 73 ----------------------
.../controller/test/ControllerTestCommon.scala | 2 +-
6 files changed, 25 insertions(+), 100 deletions(-)
diff --git a/tests/src/test/scala/system/basic/WskConsoleTests.scala b/tests/src/test/scala/system/basic/WskConsoleTests.scala
index fea2cec..bd41469 100644
--- a/tests/src/test/scala/system/basic/WskConsoleTests.scala
+++ b/tests/src/test/scala/system/basic/WskConsoleTests.scala
@@ -66,7 +66,6 @@ class WskConsoleTests extends TestHelpers with WskTestHelpers {
val run = wsk.action.invoke(fullActionName, Map("payload" -> payload.toJson))
withActivation(wsk.activation, run, totalWait = duration.get) { activation =>
val console = wsk.activation.console(10 seconds, since = duration)
- println(console.stdout)
console.stdout should include(payload)
}
}
diff --git a/tests/src/test/scala/system/basic/WskSequenceTests.scala b/tests/src/test/scala/system/basic/WskSequenceTests.scala
index 5746d99..81c699d 100644
--- a/tests/src/test/scala/system/basic/WskSequenceTests.scala
+++ b/tests/src/test/scala/system/basic/WskSequenceTests.scala
@@ -72,7 +72,6 @@ class WskSequenceTests extends TestHelpers with ScalatestRouteTest with WskTestH
}
}
- println(s"Sequence $actions")
assetHelper.withCleaner(wsk.action, name) {
val sequence = actions.mkString(",")
(action, _) =>
@@ -93,7 +92,6 @@ class WskSequenceTests extends TestHelpers with ScalatestRouteTest with WskTestH
// update action sequence and run it with normal payload
val newSequence = Seq("split", "sort").mkString(",")
- println(s"Update sequence to $newSequence")
wsk.action.create(
name,
Some(newSequence),
@@ -108,7 +106,6 @@ class WskSequenceTests extends TestHelpers with ScalatestRouteTest with WskTestH
result.fields.get("lines") shouldBe Some(args.sortWith(_.compareTo(_) < 0).toArray.toJson)
}
- println("Run sequence with error in payload")
// run sequence with error in the payload
// sequence should run with no problems, error should be ignored in this test case
// result of sequence should be identical to previous invocation above
@@ -197,7 +194,7 @@ class WskSequenceTests extends TestHelpers with ScalatestRouteTest with WskTestH
val args = Array("what time is it?", now)
val argsJson = args.mkString("\n").toJson
val run = wsk.action.invoke(sName, Map("payload" -> argsJson))
- println(s"RUN: ${run.stdout}")
+
withActivation(wsk.activation, run, totalWait = 2 * allowedActionDuration) { activation =>
checkSequenceLogsAndAnnotations(activation, 3) // 3 activations in this sequence
val result = activation.response.result.get
@@ -530,10 +527,11 @@ class WskSequenceTests extends TestHelpers with ScalatestRouteTest with WskTestH
val componentId = activation.logs.get(atomicActionIdx)
val getComponentActivation = wsk.activation.get(Some(componentId))
withActivation(wsk.activation, getComponentActivation, totalWait = allowedActionDuration) { componentActivation =>
- println(componentActivation)
- componentActivation.logs shouldBe defined
- val logs = componentActivation.logs.get.mkString(" ")
- regex.findFirstIn(logs) shouldBe defined
+ withClue(componentActivation) {
+ componentActivation.logs shouldBe defined
+ val logs = componentActivation.logs.get.mkString(" ")
+ regex.findFirstIn(logs) shouldBe defined
+ }
}
}
}
diff --git a/tests/src/test/scala/whisk/core/controller/actions/test/ActivationFinisherTests.scala b/tests/src/test/scala/whisk/core/controller/actions/test/ActivationFinisherTests.scala
index daf7bb4..25f48ae 100644
--- a/tests/src/test/scala/whisk/core/controller/actions/test/ActivationFinisherTests.scala
+++ b/tests/src/test/scala/whisk/core/controller/actions/test/ActivationFinisherTests.scala
@@ -76,7 +76,7 @@ class ActivationFinisherTests
}
behavior of "activation finisher"
- override lazy val printstream = Console.out
+
val slowPoll = 200.milliseconds
val fastPoll = Seq()
diff --git a/tests/src/test/scala/whisk/core/controller/test/AuthenticateTests.scala b/tests/src/test/scala/whisk/core/controller/test/AuthenticateTests.scala
index 121b566..3c4628b 100644
--- a/tests/src/test/scala/whisk/core/controller/test/AuthenticateTests.scala
+++ b/tests/src/test/scala/whisk/core/controller/test/AuthenticateTests.scala
@@ -56,22 +56,23 @@ class AuthenticateTests extends ControllerTestCommon with Authenticate {
// Try to login with each specific namespace
namespaces.foreach { ns =>
- println(s"Trying to login to $ns")
- waitOnView(authStore, ns.authkey, 1) // wait for the view to be updated
- val pass = BasicHttpCredentials(ns.authkey.uuid.asString, ns.authkey.key.asString)
- val user = Await.result(validateCredentials(Some(pass)), dbOpTimeout)
- user.get shouldBe Identity(subject, ns.name, ns.authkey, Privilege.ALL)
-
- // first lookup should have been from datastore
- stream.toString should include(s"serving from datastore: ${CacheKey(ns.authkey)}")
- stream.reset()
-
- // repeat query, now should be served from cache
- val cachedUser = Await.result(validateCredentials(Some(pass))(transid()), dbOpTimeout)
- cachedUser.get shouldBe Identity(subject, ns.name, ns.authkey, Privilege.ALL)
-
- stream.toString should include(s"serving from cache: ${CacheKey(ns.authkey)}")
- stream.reset()
+ withClue(s"Trying to login to $ns") {
+ waitOnView(authStore, ns.authkey, 1) // wait for the view to be updated
+ val pass = BasicHttpCredentials(ns.authkey.uuid.asString, ns.authkey.key.asString)
+ val user = Await.result(validateCredentials(Some(pass)), dbOpTimeout)
+ user.get shouldBe Identity(subject, ns.name, ns.authkey, Privilege.ALL)
+
+ // first lookup should have been from datastore
+ stream.toString should include(s"serving from datastore: ${CacheKey(ns.authkey)}")
+ stream.reset()
+
+ // repeat query, now should be served from cache
+ val cachedUser = Await.result(validateCredentials(Some(pass))(transid()), dbOpTimeout)
+ cachedUser.get shouldBe Identity(subject, ns.name, ns.authkey, Privilege.ALL)
+
+ stream.toString should include(s"serving from cache: ${CacheKey(ns.authkey)}")
+ stream.reset()
+ }
}
// check that invalid keys are rejected
diff --git a/tests/src/test/scala/whisk/core/controller/test/AuthenticateV2Tests.scala b/tests/src/test/scala/whisk/core/controller/test/AuthenticateV2Tests.scala
deleted file mode 100644
index 9533483..0000000
--- a/tests/src/test/scala/whisk/core/controller/test/AuthenticateV2Tests.scala
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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 whisk.core.controller.test
-
-import scala.concurrent.Await
-
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-
-import akka.http.scaladsl.model.headers.BasicHttpCredentials
-
-import whisk.core.controller.Authenticate
-import whisk.core.entity.AuthKey
-import whisk.core.entity.Subject
-import whisk.core.entity.WhiskAuth
-import whisk.core.entity.WhiskNamespace
-import whisk.core.entitlement.Privilege
-import whisk.core.entity.Identity
-
-/**
- * Tests authentication handler which guards API.
- *
- * Unit tests of the controller service as a standalone component.
- * These tests exercise a fresh instance of the service object in memory -- these
- * tests do NOT communication with a whisk deployment.
- *
- *
- * @Idioglossia
- * "using Specification DSL to write unit tests, as in should, must, not, be"
- * "using Specs2RouteTest DSL to chain HTTP requests for unit testing, as in ~>"
- */
-@RunWith(classOf[JUnitRunner])
-class AuthenticateV2Tests extends ControllerTestCommon with Authenticate {
-
- // Creates a new unique name each time its called
- def aname = MakeName.next("authenticatev2_tests")
-
- behavior of "Authenticate V2"
-
- it should "authorize a known user using the new database schema in different namespaces" in {
- implicit val tid = transid()
- val subject = Subject()
-
- val namespaces = Set(WhiskNamespace(aname, AuthKey()), WhiskNamespace(aname, AuthKey()))
-
- val entry = WhiskAuth(subject, namespaces)
-
- put(authStore, entry)
-
- // Try to login with each specific namespace
- namespaces.foreach { ns =>
- println(s"Trying to login to $ns")
- val pass = BasicHttpCredentials(ns.authkey.uuid.asString, ns.authkey.key.asString)
- val user = Await.result(validateCredentials(Some(pass)), dbOpTimeout)
- user.get shouldBe Identity(subject, ns.name, ns.authkey, Privilege.ALL)
- }
- }
-}
diff --git a/tests/src/test/scala/whisk/core/controller/test/ControllerTestCommon.scala b/tests/src/test/scala/whisk/core/controller/test/ControllerTestCommon.scala
index c196af3..8c2f6d3 100644
--- a/tests/src/test/scala/whisk/core/controller/test/ControllerTestCommon.scala
+++ b/tests/src/test/scala/whisk/core/controller/test/ControllerTestCommon.scala
@@ -192,7 +192,7 @@ class DegenerateLoadBalancerService(config: WhiskConfig)(implicit ec: ExecutionC
case (timeout, activation) =>
Future {
blocking {
- println("waiting.....")
+ println(s"load balancer active ack stub: waiting for $timeout...")
Thread.sleep(timeout.toMillis)
println(".... done waiting")
}
--
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].