Skip to content

Commit

Permalink
Fixing bugs
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Schwartz <[email protected]>
  • Loading branch information
ahus1 committed Oct 15, 2024
1 parent 1aee9c3 commit 7e7cf9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,16 @@ void testMetricsEndpointWithCacheMetricsHistograms() {

@Test
@Launch({ "start-dev", "--metrics-enabled=true", "--features=user-event-metrics", "--user-event-metrics-enabled=true" })
void testMetricsEndpointWithUserEventMetrics() {
given().port(8080)
.formParam("grant_type", "client_credentials")
void testMetricsEndpointWithUserEventMetrics(KeycloakDistribution distribution) {
distribution.setRequestPort(8080);
given().formParam("grant_type", "client_credentials")
.formParam("client_id", "unknown")
.formParam("client_secret", "unknown").
when().post("/realms/master/protocol/openid-connect/token")
.then()
.statusCode(401);

distribution.setRequestPort(9000);
when().get("/metrics").then()
.statusCode(200)
.body(containsString("keycloak_user_events_total{error=\"client_not_found\",event=\"client_login\",realm=\"master\"}"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private static List<EventListenerProvider> getEventListeners(KeycloakSession ses
.filter(providerFactory -> ((EventListenerProviderFactory) providerFactory).isEnabled(session))
.map(providerFactory -> {
realmListeners.remove(providerFactory.getId());
return (EventListenerProvider) providerFactory.create(session);
return session.getProvider(EventListenerProvider.class, providerFactory.getId());
})
.toList();
if (!realmListeners.isEmpty()) {
Expand Down

0 comments on commit 7e7cf9a

Please sign in to comment.