Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Not A Problem
-
1.14.0
-
None
-
None
Description
I ran into the following issue when executing Fabric8FlinkKubeClientTest in a test suite from a different flink module that has com.squareup.okhttp3:okhttp set as a dependency (more specifically in my case flink-runtime's ZooKeeperStateHandleStoreTest) from within Intellij:
Exception in thread "MockWebServer" java.lang.NoSuchFieldError: H2_PRIOR_KNOWLEDGE at okhttp3.mockwebserver.MockWebServer$3.processConnection(MockWebServer.java:499) at okhttp3.mockwebserver.MockWebServer$3.execute(MockWebServer.java:443) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
Interestingly, the test didn't fail when executing it from command line:
mvn -pl flink-runtime,flink-kubernetes test -Dtest=Fabric8FlinkKubeClientTest,ZooKeeperStateHandleStoreTest -Dfast
Fabric8FlinkKubeClientTest also doesn't fail if running multiple tests of flink-kubernetes.
The issue is caused by the MockWebServer implementation. I found a hint on StackOverflow indicating that io.fabric8:kubernetes-server-mock uses com.squareup.okhttp3:mockwebserver internally which leads to the version clash and the error shown above.
I checked the other dependencies and realized that we use com.squareup.okhttp3:okhttp in multiple modules and that Intellij adds all of these dependencies versions to the classpath. My conclusion was that there might be a version conflict accessing the wrong dependency version when loading the dependencies for the test execution that results in the error shown above.
I verified my finding by updating the version for all {{com.squareup.okhttp3:okhttp dependencies to 1.12.6 which is used in flink-kubernetes and reloaded the Maven dependencies within Intellij. This made the above mentioned test suite containing Fabric8FlinkKubeClientTest in a test suite from a different flink module that has com.squareup.okhttp3:okhttp and ZooKeeperStateHandleStoreTest succeed.