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

Add metadata for testcontainers:1.19.8 #533

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kehrlann
Copy link

What does this PR do?

Adds support for Testcontainers 1.19.8 and up, used by the current Spring Boot 3.3.x line. Reuses #132 + #301 and upgrades the version.

Closes #492.

Code sections where the PR accesses files, network, docker or some external service

Tests are not enabled, same as current tests for Testcontainers 1.17.6 because it pulls a docker image with critical CVEs.

Checklist before merging

@Kehrlann Kehrlann requested a review from a team as a code owner September 16, 2024 13:35
@Kehrlann Kehrlann requested a review from melix September 16, 2024 13:35
@alina-yur
Copy link
Member

thank you, @Kehrlann!❤️

@@ -0,0 +1,4219 @@
[
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty huge reflect-config.json. Are you sure that all of these entries are necessary? For example there are lots of entries like this:

{
        "name": "java.util.LinkedHashMap",
        "queryAllDeclaredMethods": true,
        "condition": {
            "typeReachable": "org.testcontainers.dockerclient.DockerClientProviderStrategy"
        },
        "queryAllDeclaredConstructors": true
    },
    {
        "name": "java.util.LinkedHashMap",
        "condition": {
            "typeReachable": "org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy"
        }
    },
    {
        "name": "java.util.LinkedHashMap",
        "condition": {
            "typeReachable": "org.testcontainers.dockerclient.TestcontainersHostPropertyClientProviderStrategy"
        }
    },
    {
        "name": "java.util.LinkedHashMap",
        "queryAllDeclaredMethods": true,
        "condition": {
            "typeReachable": "org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper"
        },
        "queryAllDeclaredConstructors": true
    },

or something like

  {
        "name": "java.net.UnixDomainSocketAddress",
        "condition": {
            "typeReachable": "org.testcontainers.dockerclient.DockerClientProviderStrategy"
        },
        "methods": [
            {
                "name": "of",
                "parameterTypes": [
                    "java.lang.String"
                ]
            }
        ]
    },

do we really need to include all of this stuff? Please take a quick look whether there are entries that can be excluded or not? If you find such entries, please update your user-code-filter.json to exclude them

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I do not know the specifics of the type entries, when we compare what's currently in the repository for testcontainers (1.17.6), and diff with the new config, we get 8 new types and 1 type removed. Existing classes get many, many more conditions though, explaining the number of entries going from 358 to 452. So while the file is big, it's not adding many types to the resulting image. Details below.


Here are the 8 new types:

com.github.dockerjava.api.model.LoadResponseItem
com.github.dockerjava.api.model.RuntimeInfo
java.util.concurrent.ForkJoinTask
java.util.concurrent.atomic.AtomicMarkableReference
org.testcontainers.shaded.com.github.dockerjava.core.DockerContextMetaFile
org.testcontainers.shaded.com.github.dockerjava.core.DockerContextMetaFile$Endpoints
org.testcontainers.shaded.com.github.dockerjava.core.DockerContextMetaFile$Endpoints$Docker
sun.security.provider.SHA2$SHA256

And the 1 type removed, [Lorg.testcontainers.shaded.com.google.common.collect.ImmutableMapEntry; .

We do have many more conditions per type, though. For example, com.github.dockerjava.api.model.AuthConfig went from 1.17.6 :

{
  "condition": {
    "typeReachable": "org.testcontainers.DockerClientFactory"
  },
  "name": "com.github.dockerjava.api.model.AuthConfig",
  "allDeclaredFields": true,
  "allDeclaredConstructors": true
}

to 1.19.7:

{
  "condition": {
    "typeReachable": "org.testcontainers.DockerClientFactory"
  },
  "name": "com.github.dockerjava.api.model.AuthConfig",
  "allDeclaredFields": true,
  "allDeclaredConstructors": true
}
{
  "name": "com.github.dockerjava.api.model.AuthConfig",
  "condition": {
    "typeReachable": "org.testcontainers.containers.GenericContainer"
  }
}
{
  "name": "com.github.dockerjava.api.model.AuthConfig",
  "condition": {
    "typeReachable": "org.testcontainers.containers.GenericContainer$$Lambda$478/0x000000e80123bd50"
  }
}
{
  "name": "com.github.dockerjava.api.model.AuthConfig",
  "queryAllDeclaredMethods": true,
  "condition": {
    "typeReachable": "org.testcontainers.dockerclient.DockerClientProviderStrategy"
  },
  "queryAllDeclaredConstructors": true
}
{
  "name": "com.github.dockerjava.api.model.AuthConfig",
  "condition": {
    "typeReachable": "org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy"
  }
}
{
  "name": "com.github.dockerjava.api.model.AuthConfig",
  "condition": {
    "typeReachable": "org.testcontainers.dockerclient.TestcontainersHostPropertyClientProviderStrategy"
  }
}
{
  "name": "com.github.dockerjava.api.model.AuthConfig",
  "condition": {
    "typeReachable": "org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper"
  },
  "allDeclaredFields": true,
  "methods": [
    {
      "name": "getAuth",
      "parameterTypes": []
    },
    {
      "name": "getEmail",
      "parameterTypes": []
    },
    {
      "name": "getIdentitytoken",
      "parameterTypes": []
    },
    {
      "name": "getPassword",
      "parameterTypes": []
    },
    {
      "name": "getRegistryAddress",
      "parameterTypes": []
    },
    {
      "name": "getRegistrytoken",
      "parameterTypes": []
    },
    {
      "name": "getStackOrchestrator",
      "parameterTypes": []
    },
    {
      "name": "getUsername",
      "parameterTypes": []
    }
  ]
}
{
  "name": "com.github.dockerjava.api.model.AuthConfig",
  "condition": {
    "typeReachable": "org.testcontainers.shaded.com.github.dockerjava.core.DefaultDockerClientConfig$Builder"
  }
}
{
  "name": "com.github.dockerjava.api.model.AuthConfig",
  "condition": {
    "typeReachable": "org.testcontainers.shaded.com.github.dockerjava.core.DockerConfigFile"
  },
  "allDeclaredFields": true,
  "methods": [
    {
      "name": "<init>",
      "parameterTypes": []
    }
  ]
}
{
  "name": "com.github.dockerjava.api.model.AuthConfig",
  "condition": {
    "typeReachable": "org.testcontainers.shaded.com.github.dockerjava.core.command.CreateContainerCmdImpl"
  }
}
{
  "name": "com.github.dockerjava.api.model.AuthConfig",
  "condition": {
    "typeReachable": "org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrDockerCmdExec"
  }
}
{
  "name": "com.github.dockerjava.api.model.AuthConfig",
  "condition": {
    "typeReachable": "org.testcontainers.shaded.com.github.dockerjava.core.exec.CreateContainerCmdExec"
  }

I don't see myself combing through all the new configs manually - and I'm not familiar with Testcontainers internals to begin with.

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

Successfully merging this pull request may close these issues.

com.github.dockerjava.api.model.RuntimeInfo
3 participants