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

Added additional log based wait strategy #3

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

flxsrbr
Copy link

@flxsrbr flxsrbr commented Mar 25, 2024

Starting with Keycloak 24.0, initial imports of realm data from a json files seem to take longer. This can lead to tests starting before the imported realm is properly initialized and subsequent errors. The current ForHTTP strategy does not seem to ensure proper realm initialization. Therefore this PR proposes an additional wait strategy based on the final log line "Running the server" indicating the finalization of the startup process.

Starting with Keycloak 24.0, initial imports of realm data from a json files seem to take longer. This can lead to tests starting before the imported realm is properly initialized and subsequent errors. The current ForHTTP strategy does not seem to ensure proper realm initialization. Therefore this PR proposes an additional wait strategy based on the final log line "Running the server" indicating the finalization of the startup process.
@stillya
Copy link
Owner

stillya commented Mar 25, 2024

@flxsrbr, that's LGTM. Thanks for your contribution. I can make a guess that imports of Realm take a long time because we're mounting the directory instead of copying it into the container. However, I fixed this issue here, so in the nearest release, both fixes will be included.

@stillya stillya merged commit bd0c95d into stillya:master Mar 25, 2024
2 checks passed
@flxsrbr
Copy link
Author

flxsrbr commented Mar 25, 2024

@stillya Thanks for the merge. The switch to copying instead of mounting sounds good. Interestingly, the realm import itself was still very fast in my case, as I only imported a very small realm.json file. But after updating to the Keycloak v24.0 image I ran into errors indicating that the realm I imported was not properly initialized - although the Keycloak endpoint was ready and i could get the admin client from the master realm. But getting a client from the imported realm resulted in an nil response. If I added a short delay (5 seconds) though, the error did not occur. So I think there must be some change in the process, speed, and/or order of spinning up the keycloak api and the realm import process. Esentially, the api endpoint seems to be available before the realm import is completed. But I did not research this further and could not find anything in the Keycloak release notes for 24.0 about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants