testcontainers / testcontainers/testcontainers-java

[Bug]: `ImageNameSubstitutor` cannot set compatibility

Open
#9,575 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type/bug
Dominant language
Java
Stars
8.7k
Forks
1.9k
Avg merge
2d 17h
Merged PRs (30d)
9

Description

A custom ImageNameSubstitutor cannot be used to mark an image as compatible substitute for another image automatically, because all implementation I found call the compatibility assertion on their constructor argument, not on the image property from the parent class that actually applies the substitution.

I want to dynamically resolve images from a Dockerfile in the root of my project to allow Dependabot/Renovate to automatically update the images for me, and thus keep my tests up-to-date. For this I wanted to use short aliases and to set compatibility dynamically. However, this isn't possible for the reasons explained.

I'm filing this as a bug, because I believe that this isn't the intended behavior. Feel free to change this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ImageNameSubstitutor class and inspect its implementations, then trace where the parent image property and compatibility assertion are used. Add a regression test covering a custom substitutor that marks an automatically resolved image as compatible, and confirm the test passes with the Dockerfile-based alias scenario described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.