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

docs: Use the testcontainers_test package for root tests to improve documentation #2202

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Minivera
Copy link
Contributor

@Minivera Minivera commented Feb 6, 2024

What does this PR do?

As discussed in #2180, the imported examples from tests for the docs from lack the package prefix before the imports, which leads to the example not being directly copy/paste-able. To solve the issue it was suggested to create a testcontainers_test package for the example tests and to convert everything.

I did my best to convert all the tests in a way that makes sense, and I extracted any test that would import very internal things that we should not export. Some of the tests had to be slightly rewritten (the lifecycle tests in particular), but they should stay pretty much the same.

Why is it important?

The docs don't always include all of the packages prefixes when using code examples from the tests, which makes it so users have to add them themselves, and know where each import comes from. This can cause confusion and some frustration.

Related issues

How to test this PR

Test by running all the root unit tests, they should all work as expected. The examples in the docs should all have the packages as prefixes now.

…mports

As discussed in testcontainers#2180, the imported examples from tests for the docs from lack the package prefix before the imports, which leads to the example not being directly copy/paste-able. To solve the issue it was suggested to create a `testcontainers_test` package for the example tests and to convert everything.

I did my best to convert all the tests in a way that makes sense, and I extracted any test that would import very internal things that we should not export. Some of the tests had to be slightly rewritten (the lifecycle tests in particular), but they should stay pretty much the same.

Test by running all the root unit tests, they should all work as expected. The examples in the docs should all have the packages as prefixes now.
Copy link

netlify bot commented Feb 6, 2024

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 16f384c
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/65df8bc679971500075ecaac
😎 Deploy Preview https://deploy-preview-2202--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Minivera Minivera marked this pull request as ready for review February 7, 2024 16:29
@Minivera Minivera requested a review from a team as a code owner February 7, 2024 16:30
@Minivera Minivera changed the title Introduce a testcontainers_test package to solve some of the docs imports docs: Use the testcontainers_test package for root tests to improve documentation Feb 14, 2024
@Minivera Minivera marked this pull request as draft February 16, 2024 18:04
Minivera added a commit to Minivera/testcontainers-go that referenced this pull request Feb 16, 2024
This work has been extracted from testcontainers#2202 and is related to testcontainers#2180. See the original PR for the full context and reasoning.
Minivera added a commit to Minivera/testcontainers-go that referenced this pull request Feb 22, 2024
This work has been extracted from testcontainers#2202 and is related to testcontainers#2180. See the original PR for the full context and reasoning.

This will help with the documentation, since all examples will now have the module prefixes.
Minivera added a commit to Minivera/testcontainers-go that referenced this pull request Feb 28, 2024
This work has been extracted from testcontainers#2202 and is related to testcontainers#2180. See the original PR for the full context and reasoning.

This will help with the documentation, since all examples will now have the module prefixes.
Minivera added a commit to Minivera/testcontainers-go that referenced this pull request Feb 28, 2024
This work has been extracted from testcontainers#2202 and is related to testcontainers#2180. See the original PR for the full context and reasoning.

This will help with the documentation, since all examples will now have the module prefixes.
mdelapenya pushed a commit that referenced this pull request Mar 1, 2024
* Move the file and mounts tests into a test package

This work has been extracted from #2202 and is related to #2180. See the original PR for the full context and reasoning.

This will help with the documentation, since all examples will now have the module prefixes.

* Rename the utils file
mdelapenya pushed a commit that referenced this pull request Mar 12, 2024
* Move the container and config tests into a test package

This work has been extracted from #2202 and is related to #2180. See the original PR for the full context and reasoning.

* Rename the utils file

* Remove some unused code
Minivera added a commit to Minivera/testcontainers-go that referenced this pull request Mar 18, 2024
This work has been extracted from testcontainers#2202 and is related to testcontainers#2180. See the original PR for the full context and reasoning. This PR in particular moves all the simpler tests in one go, or adds a comment to any remaining tests that would not make sense to move (or could not be moved without exposing a lot of variables).

This will help with the documentation, since all examples will now have the module prefixes.
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.

[Documentation]: The docs don't always prepend the package to types
1 participant