dasniko/testcontainers-keycloak

Realm import: file is not handled

jmizv opened this issue · 2 comments

jmizv commented

Describe the bug

In my test extension I have:

public KeycloakExtension(String importFile) {
    _importFile = importFile;
    _keycloakContainer = new KeycloakContainer("quay.io/keycloak/keycloak:19.0.1");
    if (_importFile != null) {
      _keycloakContainer.withRealmImportFile(_importFile);
    }
    _keycloakContainer.withCreateContainerCmdModifier(
        cmd -> cmd.withName(KEYCLOAK_TEST_CONTAINER_NAME_SUFFIX + FriendlyId.createFriendlyId()));
  }

And when I give the correct file, I can also see in the terminal for that container that the file is correctly copied:

sh-4.4$ ls opt/keycloak/data/import/
realm.json

But looking into the admin of that keycloak docker container, the realm is completely missing.

Is this a known problem?

Version

2.3.0

Expected behavior

The realm in the realm.json in the directory /opt/keycloak/data/import is successfully imported to the Keycloak.

Actual behavior

The expected realm from the JSON file is missing.

How to Reproduce?

No response

Relevant log output

No response

Anything else?

No response

Realm import is working in general.
Are you able to import the realm file into a running Keycloak instance of same version?
What does the log output of the testcontainer tell you?
Can you share the realm json to reproduce the behavior?

jmizv commented

I thought so that it should work in general. Haven't seen any exceptions and now I've switched to another approach and create my entities via admin client.

So I'd close this issue.