customization of volumes and advanced docker option is not allowed
when it comes to using testcontainers-modules for different modulus foeinstance postgres module, it's practically impossible to carry out a real integration test for postgres data persistency, because each integration test uses a different database instance, thus all data stored in it is drop when the database is stopped making it tedious to check data persistency, but however using volumes and advanded docker option allow us to:
-
Mounts a volume at /var/lib/module/data, which is where module stores its data.
-
That means data written to the DB is stored in the mounted directory (/tmp/module_data_test), not lost with the container lifecycle.
Hi @Donemmanuelo 👋
Perhaps I misunderstood something, but some quick answers:
-
Testcontainers support volumes configuration via
with_mount- you can override this as you wish -
What do you mean by "advanced docker option"?
ImageExtallows to customize quite a lot of options- JFYI: you don't need to depend on the core crate, it's re-exported
Hello @DDtKey
The advanced docker option i was talking about was the bind mount: Persistent data, sharing config files, cache
reuse, though never stated in your documentation, named volumes: Useful if you want Docker to manage
volume lifecycle and the Network modes : Sometimes needed for simulating host network behavior or
debugging, which are not supported, in the exception of bind mount supported by the use of with_mount().
Could you point me to particular docker feature you're missing? (so we will be able to track each of them separately if any)
- "bind mount" is supported as mentioned above
- "named volumes" are supported as part if
with_mount: seevolume_mount - "the Network modes": currently we support only specifying of the network name via
with_network. You can use.with_network("host")
In addition to that, we expose the pre-configured Docker client: docker_client_instance if you have some specific needs on top of the current functionality
__
Also, pay attention that testcontainers-modules is just a collection of pre-cooked images. The core crate is testcontainers (repo)
So if you have particular question/suggestion related to the core functionallity - it's better to create an issue there