Skip to content

Commit

Permalink
initial (#412)
Browse files Browse the repository at this point in the history
Co-authored-by: Mike Osmian <mikeosmian@Mikes-MacBook-Pro-2.local>
  • Loading branch information
osmian and Mike Osmian authored Apr 5, 2023
1 parent 6421072 commit a521bf0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
test:
./run-tests.sh

start-keycloak:
start-keycloak: stop-keycloak
docker-compose up -d

stop-keycloak:
docker-compose down
docker-compose up -d
54 changes: 54 additions & 0 deletions client_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,57 @@ func BenchmarkLoginParallel(b *testing.B) {
}
})
}

func BenchmarkGetGroups(b *testing.B) {
cfg := GetConfig(b)
client := gocloak.NewClient(cfg.HostName)
token := GetAdminToken(b, client)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, err := client.GetGroups(
context.Background(),
token.AccessToken,
cfg.GoCloak.Realm,
gocloak.GetGroupsParams{},
)
assert.NoError(b, err)
}
}

func BenchmarkGetGroupsFull(b *testing.B) {
cfg := GetConfig(b)
client := gocloak.NewClient(cfg.HostName)
token := GetAdminToken(b, client)
params := gocloak.GetGroupsParams{
Full: gocloak.BoolP(true),
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, err := client.GetGroups(
context.Background(),
token.AccessToken,
cfg.GoCloak.Realm,
params,
)
assert.NoError(b, err)
}
}

func BenchmarkGetGroupsBrief(b *testing.B) {
cfg := GetConfig(b)
client := gocloak.NewClient(cfg.HostName)
params := gocloak.GetGroupsParams{
BriefRepresentation: gocloak.BoolP(true),
}
token := GetAdminToken(b, client)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, err := client.GetGroups(
context.Background(),
token.AccessToken,
cfg.GoCloak.Realm,
params,
)
assert.NoError(b, err)
}
}

0 comments on commit a521bf0

Please sign in to comment.