EmbeddedInfinispanSplitBrainTest fails with "IllegalState Session not bound to a realm"

Closes #31828

Signed-off-by: Ryan Emerson <remerson@redhat.com>
This commit is contained in:
Ryan Emerson 2024-08-01 12:14:47 +01:00 committed by Alexander Schwartz
parent 9cf650b52b
commit 176ac3404a

View file

@ -45,6 +45,7 @@ public class EmbeddedInfinispanSplitBrainTest extends KeycloakModelTest {
@Override @Override
public void createEnvironment(KeycloakSession s) { public void createEnvironment(KeycloakSession s) {
RealmModel realm = createRealm(s, "test"); RealmModel realm = createRealm(s, "test");
s.getContext().setRealm(realm);
realm.setDefaultRole(s.roles().addRealmRole(realm, Constants.DEFAULT_ROLES_ROLE_PREFIX + "-" + realm.getName())); realm.setDefaultRole(s.roles().addRealmRole(realm, Constants.DEFAULT_ROLES_ROLE_PREFIX + "-" + realm.getName()));
this.realmId = realm.getId(); this.realmId = realm.getId();
s.users().addUser(realm, "user1").setEmail("user1@localhost"); s.users().addUser(realm, "user1").setEmail("user1@localhost");