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

TestcontainersBuilder deprecation #750

Closed
r-work opened this issue Feb 1, 2023 · 4 comments
Closed

TestcontainersBuilder deprecation #750

r-work opened this issue Feb 1, 2023 · 4 comments
Assignees
Labels
question Have you tried our Slack workspace (https://testcontainers.slack.com)?

Comments

@r-work
Copy link

r-work commented Feb 1, 2023

Hi, maybe it's just me, but the deprecation seems a bit confusing, if I change the following:

private readonly TestcontainerDatabase _postgresqlContainer = new TestcontainersBuilder<PostgreSqlTestcontainer>()
.WithDatabase(new PostgreSqlTestcontainerConfiguration
{
    Database = "db",
    Username = "postgres",
    Password = "postgres",
})
.Build();

to:

private readonly TestcontainerDatabase _postgresqlContainer = new ContainerBuilder<PostgreSqlTestcontainer>()
.WithDatabase(new PostgreSqlTestcontainerConfiguration
{
    Database = "db",
    Username = "postgres",
    Password = "postgres",
})
.Build();

I'm still getting the "obsolete" warning, what do I need to do?
Thanks

@HofmeisterAn HofmeisterAn added the question Have you tried our Slack workspace (https://testcontainers.slack.com)? label Feb 1, 2023
@HofmeisterAn
Copy link
Collaborator

HofmeisterAn commented Feb 1, 2023

I am sorry for the inconvenience, by using the module builder you cannot get ride of the obsolete warning yet 😬. Since the generic and module builder sharing the same syntax, we can not distinguish between them and use the obsolete flag for one but not the other.

With the next release 2.5.0 every module will have its own builder, for PostgreSQL it will be PostgreSqlBuilder.

  • TestcontainersBuilder<TestcontainersContainer>() = generic builder → ContainerBuilder() (obsolete intended).
  • TestcontainersBuilder<PostgreSqlTestcontainer>() = module builder → PostgreSqlBuilder() (with 2.5.0).

If the warnings bothers you, I would recommend to disable it for now:

#pragma warning disable 618
private readonly TestcontainerDatabase _postgresqlContainer = new TestcontainersBuilder<PostgreSqlTestcontainer>()
#pragma warning restore 618

If you heavily rely on modules, it might make sense to wait until 2.5.0 is available. 2.4.0 Is a kind of intermediate release that contains necessary preparations.

Sorry again.

@r-work
Copy link
Author

r-work commented Feb 1, 2023

@HofmeisterAn thanks for the speedy reply.

No problem, was just wondering what I needed to do, I will leave it as it is, and change it once 2.5.0 is out.

And thanks for the library, really helpful.

@r-work r-work closed this as completed Feb 1, 2023
@HofmeisterAn
Copy link
Collaborator

I agree that the message is unfortunate after looking at it again. I will try to complete the migration ASAP.

@HofmeisterAn HofmeisterAn self-assigned this Feb 1, 2023
@HofmeisterAn HofmeisterAn pinned this issue Feb 1, 2023
@HofmeisterAn
Copy link
Collaborator

FYI: You will find the refactored modules here. We will publish them as NuGets soon as the other modules got replaced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Have you tried our Slack workspace (https://testcontainers.slack.com)?
Projects
None yet
Development

No branches or pull requests

2 participants