-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Modernize Oracle Container Logic #4402
Modernize Oracle Container Logic #4402
Conversation
Please merge this change - this is the only way to use Oracle 11 with Testcontainers, using "gvenzl/oracle-xe". |
@rnorth let me know if you think this would be a good first PR towards getting the Oracle container on par with the others. |
@KyleAure - in a later PR, we could add "withSID" and "withServiceName". For now, your code works - I tried it out with Testcontainers 1.16.0. |
@sualeh I am not sure we need As for Oracle has engineered these images to really only allow customization of pluggable databases. Therefore, This does contradict some of the suggestions I had on this PR: #4382 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @KyleAure,
thanks for reiterating on this PR. With regards to the changes potentially coming through #4382, I would see the scope of this PR as brining all the capabilities of the gvenzl
image to the class.
This means:
- Support for using another pluggable database
- Leveraging the faster
LogMessageWaitStrategy
for known log message
In addition, it would be great if we have tests for all main permutations of the container:
- no databaseName set, user/pw default
- databaseName set, user/pw default
- databaseName set, user/pw set
- no databaseName set, user/pw set
While you are right that the image does not support customizing serviceName or SID, custom user images might. So we can think about adding setters in a future PR (although we have no easy way to test them).
Since we currently assume strict compatibility with the gvenzl
image, please add the following assertion, similarly to how it is done for e.g. the PostgreSQLContainer
:
dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME);
@sualeh Which aspect of this PR do you require for making the module working with Oracle 11 and the gvenzl
image?
modules/oracle-xe/src/main/java/org/testcontainers/containers/OracleContainer.java
Outdated
Show resolved
Hide resolved
modules/oracle-xe/src/main/java/org/testcontainers/containers/OracleContainer.java
Outdated
Show resolved
Hide resolved
modules/oracle-xe/src/test/java/org/testcontainers/junit/oracle/SimpleOracleTest.java
Show resolved
Hide resolved
modules/oracle-xe/src/test/java/org/testcontainers/junit/oracle/SimpleOracleTest.java
Outdated
Show resolved
Hide resolved
@kiview - these lines take care of Oracle 11 and above. |
6bb651d
to
d12bde1
Compare
@kiview I have updated my PR based on the feedback you provided. Thank you. |
@KyleAure Thanks, I will have another look. @sualeh I don't understand this. Even without this change, the current test uses |
modules/oracle-xe/src/main/java/org/testcontainers/containers/OracleContainer.java
Outdated
Show resolved
Hide resolved
modules/oracle-xe/src/main/java/org/testcontainers/containers/OracleContainer.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the PR looks great, thanks a lot for the quick rework!
Just having small minor comments and questions, after that, it's good to go from my side.
@rnorth can you have an additional look?
modules/oracle-xe/src/main/java/org/testcontainers/containers/OracleContainer.java
Outdated
Show resolved
Hide resolved
@kiview - if you use the Oracle Testcontainer with a different tag (11) with SID, it works. dbContainer =
new OracleContainer(DockerImageName.parse("gvenzl/oracle-xe").withTag("11")).usingSid(); Basically, this PR will support both Oracle 18 and Oracle 11. That is why I am looking forward to getting it merged in. |
@sualeh Is correct that the |
@KyleAure - the philosophy of Testcontainers seems to be (as far as I can tell) to create JDBC containers in such as way that the image can switched out. For this reason, I would not build in startup logic to check if the Docker image is "11". On the other hand, @rnorth @kiview - what do you think about creating a sort of "base" JDBC container for each type of database system, where the image can be switched out, and then a concrete JDBC container as well, where the image cannot be switched out? The concrete JDBC container can be used with all the default settings by a casual Testcontainers user, lowering the barrier to entry. Taking Oracle as an example, there would be 3 JDBC containers - a "base" one looking like what we have now, an Oracle 11 one with gvenzl/oracle-xe and SID baked in, and an Oracle 18 one with gvenzl/oracle-xe baked in too, with a service name. Thoughts? |
Testcontainers container implementation generally have a lot of assumptions about the underlying image and sometimes integrate against some slightly weak indicators or aspects, that might change in future versions or in custom images (the log message that is used now for waiting is one example for this). Therefore, we added the Let's try to not do too much auto-config for aspects users can easily specify if they know about the aspects of the underlying image (e.g. using SID in this case). This only created more weak integration points that might break and need to be maintained. PR LGTM, thanks a @KyleAure and also thanks @sualeh for your feedback and explanations. |
Now that we are using a standard Oracle image.
The Oracle Container logic needs to change to support the oracle database config options on
gvenzl/oracle-xe
The following options are now configurable and no longer static:
The following options are still static but need to be accounted for:
XE
Additional method paths:
Finally:
Expanding on the work done under #4382