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

Declare a rule, when people are calling TestContainer build too early. #194

Open
rannes opened this issue Oct 28, 2024 · 0 comments
Open

Comments

@rannes
Copy link
Collaborator

rannes commented Oct 28, 2024

Why?

When called in wrong order, then:
Environment.SetEnvironmentVariable("TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX", "YOUR_INTERNAL_MIRROR"); does not work.

E.g. If you call

private readonly INetwork _network = new NetworkBuilder()
        .WithName("shared_test_network")
        .Build();

or

private PostgreSqlContainer _postgreSqlContainer  = new PostgreSqlBuilder()
        .WithNetwork(_network)
        .WithNetworkAliases("postgres")
        .Build()

before the Environment variable is set, then none of the images will get the variable.

What?

Most likely we need a critical analyzer rule here.

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

No branches or pull requests

1 participant