You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bahir.apache.org by lr...@apache.org on 2018/12/15 21:39:38 UTC
[3/3] bahir git commit: [MINOR] Ignore flaky PubNub integration test
[MINOR] Ignore flaky PubNub integration test
Closes #77
Project: http://git-wip-us.apache.org/repos/asf/bahir/repo
Commit: http://git-wip-us.apache.org/repos/asf/bahir/commit/63878bf2
Tree: http://git-wip-us.apache.org/repos/asf/bahir/tree/63878bf2
Diff: http://git-wip-us.apache.org/repos/asf/bahir/diff/63878bf2
Branch: refs/heads/master
Commit: 63878bf2a5857eb064d8c1e0346b91b611006519
Parents: a73ab48
Author: Lukasz Antoniak <lu...@gmail.com>
Authored: Wed Dec 12 09:17:38 2018 -0800
Committer: Luciano Resende <lr...@apache.org>
Committed: Sat Dec 15 18:39:19 2018 -0300
----------------------------------------------------------------------
streaming-pubnub/README.md | 7 ++++++-
.../spark/streaming/pubnub/PubNubStreamSuite.scala | 12 +++++++-----
2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/bahir/blob/63878bf2/streaming-pubnub/README.md
----------------------------------------------------------------------
diff --git a/streaming-pubnub/README.md b/streaming-pubnub/README.md
index 3b4e9d3..e8097ee 100644
--- a/streaming-pubnub/README.md
+++ b/streaming-pubnub/README.md
@@ -74,4 +74,9 @@ For complete code examples, please review _examples_ directory.
## Unit Test
-Unit tests take advantage of publicly available _demo_ subscription and and publish key, which has limited request rate.
\ No newline at end of file
+Unit tests take advantage of publicly available _demo_ subscription and publish key, which have limited request rate.
+Anyone playing with PubNub _demo_ credentials may interrupt the tests, therefore execution of integration tests
+has to be explicitly enabled by setting environment variable _ENABLE_PUBNUB_TESTS_ to _1_.
+
+ cd streaming-pubnub
+ ENABLE_PUBNUB_TESTS=1 mvn clean test
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/bahir/blob/63878bf2/streaming-pubnub/src/test/scala/org/apache/spark/streaming/pubnub/PubNubStreamSuite.scala
----------------------------------------------------------------------
diff --git a/streaming-pubnub/src/test/scala/org/apache/spark/streaming/pubnub/PubNubStreamSuite.scala b/streaming-pubnub/src/test/scala/org/apache/spark/streaming/pubnub/PubNubStreamSuite.scala
index aa461db..91011fb 100644
--- a/streaming-pubnub/src/test/scala/org/apache/spark/streaming/pubnub/PubNubStreamSuite.scala
+++ b/streaming-pubnub/src/test/scala/org/apache/spark/streaming/pubnub/PubNubStreamSuite.scala
@@ -28,12 +28,12 @@ import org.scalatest.concurrent.Eventually
import org.scalatest.time
import org.scalatest.time.Span
-import org.apache.spark.SparkFunSuite
+import org.apache.spark.ConditionalSparkFunSuite
import org.apache.spark.storage.StorageLevel
import org.apache.spark.streaming.Seconds
import org.apache.spark.streaming.StreamingContext
-class PubNubStreamSuite extends SparkFunSuite with Eventually with BeforeAndAfter {
+class PubNubStreamSuite extends ConditionalSparkFunSuite with Eventually with BeforeAndAfter {
val subscribeKey = "demo"
val publishKey = "demo"
val channel = "test"
@@ -42,6 +42,8 @@ class PubNubStreamSuite extends SparkFunSuite with Eventually with BeforeAndAfte
var configuration: PNConfiguration = _
var client: PubNub = _
+ def shouldRunTest(): Boolean = sys.env.get("ENABLE_PUBNUB_TESTS").contains("1")
+
override def beforeAll(): Unit = {
configuration = new PNConfiguration()
configuration.setSubscribeKey(subscribeKey)
@@ -63,7 +65,7 @@ class PubNubStreamSuite extends SparkFunSuite with Eventually with BeforeAndAfte
}
}
- test("Stream receives messages") {
+ testIf("Stream receives messages", shouldRunTest) {
val nbOfMsg = 5
var publishedMessages: List[JsonObject] = List()
@volatile var receivedMessages: Set[SparkPubNubMessage] = Set()
@@ -99,7 +101,7 @@ class PubNubStreamSuite extends SparkFunSuite with Eventually with BeforeAndAfte
}
}
- test("Message filtering") {
+ testIf("Message filtering", shouldRunTest) {
val config = new PNConfiguration()
config.setSubscribeKey(subscribeKey)
config.setPublishKey(publishKey)
@@ -132,7 +134,7 @@ class PubNubStreamSuite extends SparkFunSuite with Eventually with BeforeAndAfte
}
}
- test("Test time token") {
+ testIf("Test time token", shouldRunTest) {
val config = new PNConfiguration()
config.setSubscribeKey(subscribeKey)
config.setPublishKey(publishKey)