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

Check for a label alongside of the server version #25

Merged
merged 5 commits into from
Feb 18, 2025
Merged

Conversation

realjenius
Copy link
Contributor

A proposal for how to tackle the server version transition via the Java example.

This would need to be repeated for:

@realjenius realjenius requested a review from a team as a code owner February 14, 2025 22:00
boolean isCloudServer = labels != null && Arrays.asList(labels).contains("docker/cloud");

if (!isCloudServer) {
assertThat(serverVersion)
.as("Docker Client is configured via the Testcontainers desktop app")
.satisfiesAnyOf(
dockerString -> assertThat(dockerString).contains("Testcontainers Desktop"),
dockerString -> assertThat(dockerString).contains("testcontainerscloud")
Copy link
Member

Choose a reason for hiding this comment

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

That shouldn't be possible anymore, right?

Copy link
Contributor Author

@realjenius realjenius Feb 14, 2025

Choose a reason for hiding this comment

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

Well, I was coding it to support a gradual rollout, since we probably want to update the examples before we ship the new change.

But yes, once rolled out, it should just be assert that the docker cloud label exists.

Copy link
Member

Choose a reason for hiding this comment

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

satisfiesAnyOf will hit Testcontainers Desktop all the time, as we didn't remove that part from TCD, so it makes no sense even for a gradual rollout.


boolean isCloudServer = labels != null && Arrays.asList(labels).contains("docker/cloud");

if (!isCloudServer) {
Copy link
Member

Choose a reason for hiding this comment

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

It's generally a bad practice to have ifs in tests. Perhaps, we can design it as multiple tests and just skip those not matching preconditions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was mostly an intermediate state situation while we are rolling the change out. But yes, I'm open to suggestions.

Copy link
Member

Choose a reason for hiding this comment

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

Even for the intermediate step, it can be confusing. Also, it shares a bad message about our ways of doing tests this way. I'd vote for having separate tests for TCD connection and another for TCC at the end. But I need to experiment a bit with a zone that has the label first

@AtomicJar AtomicJar deleted a comment from realjenius Feb 17, 2025
@lanwen lanwen force-pushed the DRC-30/check-label branch from 1506a83 to 6b90c21 Compare February 17, 2025 14:55
@lanwen lanwen changed the title DRC-30 - Check for a label instead of server version Check for a label instead of server version Feb 17, 2025
@lanwen lanwen changed the title Check for a label instead of server version Check for a label alongside of the server version Feb 17, 2025
@lanwen lanwen merged commit 8791749 into main Feb 18, 2025
3 checks passed
@lanwen lanwen deleted the DRC-30/check-label branch February 18, 2025 00:26
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.

2 participants