osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Created] (FLINK-11201) flink-test-utils dependency issue


eugen yushin created FLINK-11201:
------------------------------------

             Summary: flink-test-utils dependency issue
                 Key: FLINK-11201
                 URL: https://issues.apache.org/jira/browse/FLINK-11201
             Project: Flink
          Issue Type: Bug
          Components: Tests
    Affects Versions: 1.7.0
            Reporter: eugen yushin


Starting with Flink 1.7, there's lack of `runtime.testutils.MiniClusterResource` class in `flink-test-utils` distribution.

Steps to reproduce (Scala code)

build.sbt
{code}
name := "flink-17-test-issue"

organization := "x.y.z"
scalaVersion := "2.11.12"
val flinkVersion = "1.7.0"

libraryDependencies ++= Seq(
  "org.apache.flink" %% "flink-streaming-scala" % flinkVersion % Provided,
  "org.scalatest" %% "scalatest" % "3.0.5" % Test,
  "org.apache.flink" %% "flink-test-utils" % flinkVersion % Test
//  ,"org.apache.flink" %% "flink-runtime" % flinkVersion % Test classifier Artifact.TestsClassifier
)
{code}

test class:
{code}
class SimpleTest extends AbstractTestBase with FlatSpecLike {
  implicit val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment
  env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)
  env.setParallelism(1)
  env.setRestartStrategy(RestartStrategies.noRestart())

  "SimpleTest" should "work" in {
    val inputDs = env.fromElements(1,2,3)

    inputDs.print()

    env.execute()
  }
}
{code}

Results in:
{code}
A needed class was not found. This could be due to an error in your runpath. Missing class: org/apache/flink/runtime/testutils/MiniClusterResource
java.lang.NoClassDefFoundError: org/apache/flink/runtime/testutils/MiniClusterResource
...
Caused by: java.lang.ClassNotFoundException: org.apache.flink.runtime.testutils.MiniClusterResource
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 31 more
{code}

This can be fixed by flink-runtime distribution with test classifier.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)