Skip to content

Commit 82cf331

Browse files
author
Andrew Or
committed
[SPARK-8781] Fix variables in published pom.xml are not resolved
The issue is summarized in the JIRA and is caused by this commit: 984ad60. This patch reverts that commit and fixes the maven build in a different way. We limit the dependencies of `KinesisReceiverSuite` to avoid having to deal with the complexities in how maven deals with transitive test dependencies. Author: Andrew Or <[email protected]> Closes #7193 from andrewor14/fix-kinesis-pom and squashes the following commits: ca3d5d4 [Andrew Or] Limit kinesis test dependencies f24e09c [Andrew Or] Revert "[BUILD] Fix Maven build for Kinesis"
1 parent 34d448d commit 82cf331

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

extras/kinesis-asl/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@
4040
<artifactId>spark-streaming_${scala.binary.version}</artifactId>
4141
<version>${project.version}</version>
4242
</dependency>
43-
<dependency>
44-
<groupId>org.apache.spark</groupId>
45-
<artifactId>spark-core_${scala.binary.version}</artifactId>
46-
<version>${project.version}</version>
47-
<type>test-jar</type>
48-
<scope>test</scope>
49-
</dependency>
5043
<dependency>
5144
<groupId>org.apache.spark</groupId>
5245
<artifactId>spark-streaming_${scala.binary.version}</artifactId>

extras/kinesis-asl/src/test/scala/org/apache/spark/streaming/kinesis/KinesisReceiverSuite.scala

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,23 @@ import com.amazonaws.services.kinesis.clientlibrary.lib.worker.InitialPositionIn
2626
import com.amazonaws.services.kinesis.clientlibrary.types.ShutdownReason
2727
import com.amazonaws.services.kinesis.model.Record
2828
import org.mockito.Mockito._
29-
import org.scalatest.{BeforeAndAfter, Matchers}
29+
// scalastyle:off
30+
// To avoid introducing a dependency on Spark core tests, simply use scalatest's FunSuite
31+
// here instead of our own SparkFunSuite. Introducing the dependency has caused problems
32+
// in the past (SPARK-8781) that are complicated by bugs in the maven shade plugin (MSHADE-148).
33+
import org.scalatest.{BeforeAndAfter, FunSuite, Matchers}
3034
import org.scalatest.mock.MockitoSugar
3135

3236
import org.apache.spark.storage.StorageLevel
33-
import org.apache.spark.streaming.{Milliseconds, Seconds, StreamingContext, TestSuiteBase}
37+
import org.apache.spark.streaming.{Milliseconds, Seconds, StreamingContext}
3438
import org.apache.spark.util.{Clock, ManualClock, Utils}
3539

3640
/**
3741
* Suite of Kinesis streaming receiver tests focusing mostly on the KinesisRecordProcessor
3842
*/
39-
class KinesisReceiverSuite extends TestSuiteBase with Matchers with BeforeAndAfter
40-
with MockitoSugar {
43+
class KinesisReceiverSuite extends FunSuite with Matchers with BeforeAndAfter
44+
with MockitoSugar {
45+
// scalastyle:on
4146

4247
val app = "TestKinesisReceiver"
4348
val stream = "mySparkStream"
@@ -57,24 +62,23 @@ class KinesisReceiverSuite extends TestSuiteBase with Matchers with BeforeAndAft
5762
var checkpointStateMock: KinesisCheckpointState = _
5863
var currentClockMock: Clock = _
5964

60-
override def beforeFunction(): Unit = {
65+
before {
6166
receiverMock = mock[KinesisReceiver]
6267
checkpointerMock = mock[IRecordProcessorCheckpointer]
6368
checkpointClockMock = mock[ManualClock]
6469
checkpointStateMock = mock[KinesisCheckpointState]
6570
currentClockMock = mock[Clock]
6671
}
6772

68-
override def afterFunction(): Unit = {
69-
super.afterFunction()
73+
after {
7074
// Since this suite was originally written using EasyMock, add this to preserve the old
7175
// mocking semantics (see SPARK-5735 for more details)
7276
verifyNoMoreInteractions(receiverMock, checkpointerMock, checkpointClockMock,
7377
checkpointStateMock, currentClockMock)
7478
}
7579

7680
test("KinesisUtils API") {
77-
val ssc = new StreamingContext(master, framework, batchDuration)
81+
val ssc = new StreamingContext("local[2]", getClass.getSimpleName, Seconds(1))
7882
// Tests the API, does not actually test data receiving
7983
val kinesisStream1 = KinesisUtils.createStream(ssc, "mySparkStream",
8084
"https://kinesis.us-west-2.amazonaws.com", Seconds(2),

pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,8 +1440,6 @@
14401440
<version>2.3</version>
14411441
<configuration>
14421442
<shadedArtifactAttached>false</shadedArtifactAttached>
1443-
<!-- Work around MSHADE-148 -->
1444-
<createDependencyReducedPom>false</createDependencyReducedPom>
14451443
<artifactSet>
14461444
<includes>
14471445
<!-- At a minimum we must include this to force effective pom generation -->

0 commit comments

Comments
 (0)