Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test suite fails to pull testcontainers images #167

Closed
dbnicholson opened this issue Mar 12, 2021 · 5 comments · Fixed by #168
Closed

Test suite fails to pull testcontainers images #167

dbnicholson opened this issue Mar 12, 2021 · 5 comments · Fixed by #168
Labels

Comments

@dbnicholson
Copy link

Version report

hashicorp-vault-plugin master (005818d)

  • What Operating System are you using (both controller, and any agents involved in the problem)?

Linux with OpenJDK 11.

Reproduction steps

mvn test

Results

Expected result:

Tests succeed.

Actual result:

[ERROR] com.datapipe.jenkins.vault.it.buildwrapper.SSLTest  Time elapsed: 0.917 s  <<< ERROR!
java.lang.ExceptionInInitializerError
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1042)
	at java.base/jdk.internal.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
	at java.base/jdk.internal.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:186)
	at java.base/java.lang.reflect.Field.acquireFieldAccessor(Field.java:1105)
	at java.base/java.lang.reflect.Field.getFieldAccessor(Field.java:1086)
	at java.base/java.lang.reflect.Field.get(Field.java:418)
	at org.junit.runners.model.FrameworkField.get(FrameworkField.java:88)
	at org.junit.runners.model.TestClass.collectAnnotatedFieldValues(TestClass.java:249)
	at org.junit.runners.ParentRunner.classRules(ParentRunner.java:280)
	at org.junit.runners.ParentRunner.withClassRules(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.classBlock(ParentRunner.java:217)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:412)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:377)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:138)
	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:465)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:451)
Caused by: com.github.dockerjava.api.exception.NotFoundException: {"message":"No such image: quay.io/testcontainers/ryuk:0.2.3"}

	at com.github.dockerjava.okhttp.OkHttpInvocationBuilder.execute(OkHttpInvocationBuilder.java:287)
	at com.github.dockerjava.okhttp.OkHttpInvocationBuilder.execute(OkHttpInvocationBuilder.java:271)
	at com.github.dockerjava.okhttp.OkHttpInvocationBuilder.post(OkHttpInvocationBuilder.java:129)
	at com.github.dockerjava.core.exec.CreateContainerCmdExec.execute(CreateContainerCmdExec.java:33)
	at com.github.dockerjava.core.exec.CreateContainerCmdExec.execute(CreateContainerCmdExec.java:13)
	at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
	at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
	at com.github.dockerjava.core.command.CreateContainerCmdImpl.exec(CreateContainerCmdImpl.java:595)
	at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:91)
	at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:155)
	at org.testcontainers.DockerClientFactory.getActiveApiVersion(DockerClientFactory.java:323)
	at org.testcontainers.utility.TestEnvironment.dockerApiAtLeast(TestEnvironment.java:16)
	at com.datapipe.jenkins.vault.util.VaultTestUtil.hasDockerDaemon(VaultTestUtil.java:40)
	at com.datapipe.jenkins.vault.util.VaultContainer.createVaultContainer(VaultContainer.java:41)
	at com.datapipe.jenkins.vault.it.buildwrapper.SSLTest.<clinit>(SSLTest.java:42)
	... 21 more

You can also see this in the checks for #166.

@dbnicholson
Copy link
Author

Upstream issue is testcontainers/testcontainers-java#3574 and is fixed in testcontainers 1.15.1. I tried trivially updating to 1.15.1 in pom.xml, but that failed the enforcer because the version of jackson differs from the one specified in the casc test harness:

Failed while enforcing RequireUpperBoundDeps. The error(s) are [
Require upper bound dependencies error for com.fasterxml.jackson.core:jackson-annotations:2.10.2 paths to dependency are:
+-com.datapipe.jenkins.plugins:hashicorp-vault-plugin:3.7.1-SNAPSHOT
  +-io.jenkins.configuration-as-code:test-harness:1.36
    +-com.fasterxml.jackson.core:jackson-databind:2.10.2
      +-com.fasterxml.jackson.core:jackson-annotations:2.10.2
and
+-com.datapipe.jenkins.plugins:hashicorp-vault-plugin:3.7.1-SNAPSHOT
  +-org.testcontainers:vault:1.15.1
    +-org.testcontainers:testcontainers:1.15.1
      +-com.github.docker-java:docker-java-api:3.2.7
        +-com.fasterxml.jackson.core:jackson-annotations:2.10.3
]

I think in order to get those in sync you'd have to bump the bom version to something that brings in a newer casc.

I then tried to add an exclusion on jackson-annotations from testcontainers like so:

diff --git a/pom.xml b/pom.xml
index bf0a1bf..ac4f3f7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -148,9 +148,13 @@
     <dependency>
       <groupId>org.testcontainers</groupId>
       <artifactId>vault</artifactId>
-      <version>1.14.0</version>
+      <version>1.15.1</version>
       <scope>test</scope>
       <exclusions>
+        <exclusion>
+          <groupId>com.fasterxml.jackson.core</groupId>
+          <artifactId>jackson-annotations</artifactId>
+        </exclusion>
         <exclusion>
           <groupId>org.apache.commons</groupId>
           <artifactId>commons-compress</artifactId>

But weirdly I then hit an NPE in the maven compiler plugin. I might be doing that wrong - I'm really a maven novice.

@jetersen
Copy link
Member

Plugins still need to be built with Java 8 SDK

@dbnicholson
Copy link
Author

OK. Does that mean I actually need java 8 or doesn't the plugins pom say to target 8?

@jetersen
Copy link
Member

I have had no success compiling with java 11 at least.

Also this hints at the issue jenkinsci/plugin-pom#133

@jetersen
Copy link
Member

jetersen commented Mar 12, 2021

Right, I forgot that this plugin has no issue compiling with Java 11 SDK 👏
We even have GitHub action checking that 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants