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

feat(Oracle): Add support for WithDatabase(string) for Oracle 18 and onwards #1321

Merged

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Dec 20, 2024

What does this PR do?

This pull request selects the correct database default name depending on the Docker image version and enable setting a custom database name for Oracle 18 and onwards.

Why is it important?

This enables using the new Oracle Docker images (e.g. gvenzl/oracle-free) which doesn't work with the current implementation because of the hardcoded XEPDB1 default database.

Note

The gvenzl/oracle-free image is the first one with arm64 support which is especially interesting for macOS users.

Related issues

How to test this PR

The OracleContainerTest class has been augmented to test many variations of the Oracle Docker images.

  • gvenzl/oracle-xe:11
  • gvenzl/oracle-xe:18
  • gvenzl/oracle-xe:21
  • gvenzl/oracle-free:23

Copy link

netlify bot commented Dec 20, 2024

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit 9af66e2
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-dotnet/deploys/67b20f5482261b0008e80a37
😎 Deploy Preview https://deploy-preview-1321--testcontainers-dotnet.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.

@0xced 0xced force-pushed the feature/oracle-all-versions branch from 0ade2f4 to 84f5181 Compare December 20, 2024 17:23
@0xced
Copy link
Contributor Author

0xced commented Dec 20, 2024

11 Oracle containers from 4 images and the GitHub runner fails with No space left on device 😖

@HofmeisterAn
Copy link
Collaborator

11 Oracle containers from 4 images and the GitHub runner fails with No space left on device 😖

It looks like we are right at the edge. Although I expected ~20GB to be enough, I thought the root filesystem had something like ~30GB left. Maybe we can save some MBs by restoring the NuGet cache on the temp disk, but that likely won't be enough too.

gvenzl/oracle-xe:11-slim-faststart 1.64GB
gvenzl/oracle-xe:18-slim-faststart 4.44GB
gvenzl/oracle-xe:21-slim-faststart 4.66GB
gvenzl/oracle-xe:21.3.0-slim-faststart 4.66GB
gvenzl/oracle-free:23-slim-faststart 4.62GB

What do you think about removing 18 and 21 (as we are most likely testing the same configurations)? Maybe that is enough already.

@0xced 0xced force-pushed the feature/oracle-all-versions branch from 84f5181 to 71b1ffa Compare February 14, 2025 14:33
Use the correct database default name depending on the Docker image version and enable setting a custom database name for Oracle 18 and onwards.

Fixes testcontainers#1233
@0xced 0xced force-pushed the feature/oracle-all-versions branch 2 times, most recently from 00487a4 to 53ad636 Compare February 14, 2025 16:01
In order to avoid "No space left on device" error on GitHub actions
@0xced 0xced force-pushed the feature/oracle-all-versions branch 2 times, most recently from 2db8e62 to 588f89b Compare February 14, 2025 16:16
@0xced
Copy link
Contributor Author

0xced commented Feb 14, 2025

I tried something else that seems to work pretty well: splitting the Oracle tests into multiple projects so that we don't have the disk space issue.

Let's hope this can land into version 4.3.0. Mac users will be happy to be able to use the gvenzl/oracle-free:23 images!

I also just realised that the *-slim images are actually slim but that the *-slim-faststart images are not slim at all, what a misleading name!

image size
gvenzl/oracle-free:23-slim 1.41 GB
gvenzl/oracle-free:23 2.19 GB
gvenzl/oracle-free:23-slim-faststart 4.37 GB
gvenzl/oracle-free:23-faststart 5.34 GB

So if you prefer to keep all the Oracle tests in the same project we might try the *-slim images instead of the *-slim-faststart images and we'll save quite some GBs!

@HofmeisterAn
Copy link
Collaborator

Cool idea utilizing the compiler constants 😎 I will try to review it tomorrow.

@jwedel
Copy link

jwedel commented Feb 14, 2025

I also just realised that the *-slim images are actually slim but that the *-slim-faststart images are not slim at all, what a misleading name!

image size
gvenzl/oracle-free:23-slim 1.41 GB
gvenzl/oracle-free:23 2.19 GB
gvenzl/oracle-free:23-slim-faststart 4.37 GB
gvenzl/oracle-free:23-faststart 5.34 GB
So if you prefer to keep all the Oracle tests in the same project we might try the *-slim images instead of the *-slim-faststart images and we'll save quite some GBs!

The faststart images have performed the installation process already which probably will involves some unpacking, hence the bigger image.

However, they start significantly faster which is key in integration tests.

Would this non fast start only be used in your own tests or also as default in the shipped lib?

if the latter, I would suggest to keep the slim fast start.

@HofmeisterAn
Copy link
Collaborator

I also just realised that the *-slim images are actually slim but that the *-slim-faststart images are not slim at all, what a misleading name!
image size
gvenzl/oracle-free:23-slim 1.41 GB
gvenzl/oracle-free:23 2.19 GB
gvenzl/oracle-free:23-slim-faststart 4.37 GB
gvenzl/oracle-free:23-faststart 5.34 GB
So if you prefer to keep all the Oracle tests in the same project we might try the *-slim images instead of the *-slim-faststart images and we'll save quite some GBs!

The faststart images have performed the installation process already which probably will involves some unpacking, hence the bigger image.

However, they start significantly faster which is key in integration tests.

Would this non fast start only be used in your own tests or also as default in the shipped lib?

if the latter, I would suggest to keep the slim fast start.

The default image tag is 21.3.0-slim-faststart. I believe @0xced suggested the *-slim tags in case we want to keep all Oracle tests within the same project and run them on a single runner. Anyway, we still use *-slim-faststart and recommend that developers override the default image and pin their preferred version.

HofmeisterAn
HofmeisterAn previously approved these changes Feb 15, 2025
Copy link
Collaborator

@HofmeisterAn HofmeisterAn left a comment

Choose a reason for hiding this comment

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

Thank you for the PR again. It looks good. I just have two minor questions. Let me know what you think and if we need to address them.

@HofmeisterAn HofmeisterAn changed the title Improve Oracle support feat(Oracle): Add support for WithDatabase(string) on Oracle 18 and later. Feb 15, 2025
@HofmeisterAn HofmeisterAn added the enhancement New feature or request label Feb 15, 2025
@HofmeisterAn HofmeisterAn changed the title feat(Oracle): Add support for WithDatabase(string) on Oracle 18 and later. feat(Oracle): Add support for WithDatabase(string) for Oracle 18 and onwards. Feb 15, 2025
Older images that don't support a custom database will simply ignore it.
This reverts commit e17bd73.

Container would fail to start with this error.
> ORA-65012: Pluggable database FREEPDB1 already exists.
Copy link
Collaborator

@HofmeisterAn HofmeisterAn left a comment

Choose a reason for hiding this comment

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

Thanks ✌️.

@HofmeisterAn HofmeisterAn merged commit 4c24aab into testcontainers:develop Feb 17, 2025
65 checks passed
@0xced 0xced deleted the feature/oracle-all-versions branch February 17, 2025 08:40
@HofmeisterAn HofmeisterAn changed the title feat(Oracle): Add support for WithDatabase(string) for Oracle 18 and onwards. feat(Oracle): Add support for WithDatabase(string) for Oracle 18 and onwards Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: Allow Oracle container builder to set the database name
3 participants