testcontainers / testcontainers-python

Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.
https://testcontainers-python.readthedocs.io/en/latest/
Apache License 2.0
1.51k stars 281 forks source link

fix(keycloak): add realm imports #565

Closed stefnnn closed 3 months ago

stefnnn commented 4 months ago

This PR adds an option to start a keycloak container with importing one or more realms. This mirrors a feature present in the java keycloak testcontainer.

alexanderankin commented 4 months ago

if you can make it backwards compatible (ie not break tests) then i dont see why we wouldnt merge

stefnnn commented 4 months ago

My bad! I have fixed a bug I introduced, that prevented to wait for the first user to be added. Additionally I made the cmd configurable, which I think make sense, depending on the use caes.

However, I cannot get the tests running locally, neither on this branch nor on main, so I have a hard time verify whether it works consitently now.

alexanderankin commented 3 months ago

so it seems straightforward enough, so lgtm!

also idk if you accounted for this but the command can be a list or a string. since backwards (or anything beyond basic) compatibility is really not a top concern for community modules, im going to merge this, but feel free to follow up before we do a release. not sure how soon that will be since im pretty backlogged and i dont think we have anything to release that is super critical (happy to be corrected about this).

stefnnn commented 3 months ago

Backward compatibility will not be an issue, as there was no way to set the docker command in the previous version - it was automatically overwritten to _DEFAULT_DEV_COMMAND by the start() function. So I guess it's good enough for now. Thanks a lot for the thourough review and time!