Skip to content

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

@rannes

Description

@rannes

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions