-
Notifications
You must be signed in to change notification settings - Fork 31
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: add oracle image impl #140
Conversation
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.
Thank you for the contribution! 🚀
I've left couple of comments, please take a look
Note that the unit test needs
Oracle client
to run. I'm not sure how to handle this in the CI pipeline. Unfortunately my experience with GitHub Actions is very limited, so I'll need some tips.
I think oracle
crate is a good reference for that, we can add installation like this:
https://github.com/kubo/rust-oracle/blob/109acbcc643d0a5bc85a03f5c024e58cebd00ad5/.github/workflows/run-tests.yml#L49-L58 (add this to our test flow)
However, I'm a bit worried about dev experience for contributors 🤔
@@ -63,6 +63,9 @@ pub mod nats; | |||
#[cfg(feature = "neo4j")] | |||
#[cfg_attr(docsrs, doc(cfg(feature = "neo4j")))] | |||
pub mod neo4j; | |||
#[cfg(feature = "oracle")] | |||
#[cfg_attr(docsrs, doc(cfg(feature = "oracle")))] | |||
pub mod oracle; |
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.
Probably it makes sense to name the module as oracle_free
or something like that. In order to highlight that.
It's pretty common pattern as far as I can see, e.g:
- Testcontainers for Java: https://java.testcontainers.org/modules/databases/oraclefree/
- Testcontainers for Python: https://github.com/testcontainers/testcontainers-python/tree/main/modules/oracle-free
- and couple more not related to testcontainers at all
But the same time we can keep the feature as oracle
, because we may expose other images later (e.g XE) 🤔
src/oracle/mod.rs
Outdated
use super::*; | ||
use crate::testcontainers::runners::SyncRunner; | ||
|
||
// remember to provide Oracle client 11.2 or later (see https://crates.io/crates/oracle) |
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 it worth mentioning in contributing guide as an optional dependency (in case you need to run oracle tests).
testcontainers-rs-modules-community/CONTRIBUTING.md
Lines 25 to 29 in 071945d
### Setting up local development | |
- Ensure you have an [up-to-date Rust toolchain](https://rustup.rs/), with `clippy` and `rustfmt` components installed | |
- Install the [cargo-hack](https://github.com/taiki-e/cargo-hack) subcommand (recommended) | |
- Fork this repository |
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.
Even more, it should mentioned as optional for running oracle test, and if contributor doesn't use ARM
src/oracle/mod.rs
Outdated
/// Module to work with [`Oracle Database`] inside of tests. | ||
/// The default image is [`gvenzl/oracle-free:23-slim-faststart`] (unofficial). |
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 see mention about unsupported ARM:
Currently, there is no Oracle Database Free port for ARM chips, hence Oracle Database Free images cannot run on the new Apple M chips via Docker Desktop.
I think this is quite important limitation, so I'd prefer to add cfg
with not(any(target_arch="arm", target_arch="aarch64"))
for mod oracle_free
. Moreover, tests of modules itself won't work at all on ARM-64.
And of course, it's better to mention that as part of documentation.
Thank you for you comments. To sum up (the most important part is 4.):
BTW I've been looking for alternatives yesterday and today morning, but at the moment I see no mature native driver for Rust, which wouldn't need an external binary. Things are a little easier in Python/Java, there are thin drivers for them. However Python's testcontainers used |
Yeah, also thought of it. However, main point here is that we test exactly this image and can't be sure there won't be breaking changes in the future for others
I think that's reasonable. At least keep the feature as oracle and rename module to oracle_free. Or even create a submodule: If we will need to reuse the implementation for another image - that's possible to extend later and reuse the code (some kind of aliases). The only difference is image itself. But for now, we provide exactly free-db image as a ready and tested module.
That sounds about right to me. For contributors it doesn't make a lot of sense to test all modules, but only touched/added. We always validate all modules in CI anyway. So any side effect should be caught |
I find this valuable, no doubt. In such cases I prefer to find a solution instead of avoiding features at all. And I think granularity of features helps here a lot for contributors. |
Currently, there is no Oracle Database Free port for ARM chips, hence Oracle Database Free images cannot run on the new Apple M chips via Docker Desktop.
Hopefully I haven't forgotten about anything (please let me now if I have). I've added Unfortunately CI is still red (a timeout this time). I need to investigate, never had this issue. I've tested the CI before and it worked (https://github.com/DLakomy/testcontainers-rs-modules-community/actions/runs/9351698453). Nonetheless, it wasn't a full CI run, only the Oracle feature was tested. Maybe this is what makes a difference. EDIT: or maybe |
Thank you very much for all efforts! I see |
Something like this should do the trick (in let oracle = {
let image = Oracle::default();
// TODO find out how long is good enough
RunnableImage::from(image).with_startup_timeout(Duration::from_secs(90))
}; Tomorrow I'll try to measure the exact time it takes in CI. Maybe something lower than 90 seconds will do. |
We can also consider something like that: RunnableImage::from(image).pull_image().unwrap().start().unwrap() Just in case if it requires a lot of time to pull the image |
Hopefully it will be green this time. At least I've measured the time here: https://github.com/DLakomy/testcontainers-rs-modules-community/actions/runs/9369470735. The results are (seconds; three attempts; nightly vs stable ofc makes no difference, just another sample):
|
I guess some images are kinda flaky in CI right now because of timeout. Sometimes 1 minute is just not enough for pulling + startup. But usually it works perfectly fine I'll observe the behavior over time and likely adjust the timeouts for necessary images for CI. |
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.
Thank you!
Thank you. Note that it wasn't a timeout this time, in case of From the last run:
( |
Yes, I see |
## 🤖 New release * `testcontainers-modules`: 0.5.0 -> 0.5.1 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.5.1] - 2024-06-14 ### Documentation - Fix typo ([#141](#141)) ### Features - Add oracle image impl ([#140](#140)) - Add `clickhouse` image ([#142](#142)) <!-- generated by git-cliff --> </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/MarcoIeni/release-plz/). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Hopefully everything is ok, but if something could be better, I'll be happy to improve it.
Note that the unit test needs
Oracle client
to run. I'm not sure how to handle this in the CI pipeline. Unfortunately my experience with GitHub Actions is very limited, so I'll need some tips.