fix benchmark

This commit is contained in:
pascal
2026-01-09 16:09:42 +01:00
parent 2b00a429d7
commit a88dd8a692

View File

@@ -918,6 +918,7 @@ func TestAccountManager_DeleteAccount(t *testing.T) {
}
func BenchmarkTest_GetAccountWithclaims(b *testing.B) {
b.Setenv("NETBIRD_STORE_ENGINE", "postgres")
claims := auth.UserAuth{
Domain: "example.com",
UserId: "pvt-domain-user",
@@ -945,6 +946,18 @@ func BenchmarkTest_GetAccountWithclaims(b *testing.B) {
b.Fatal(err)
}
a, err := am.Store.GetAccount(context.Background(), id)
if err != nil {
b.Fatal(err)
}
a.Groups = genGroups()
err = am.Store.SaveAccount(context.Background(), a)
if err != nil {
b.Fatal(err)
}
users := genUsers("priv", 100)
acc, err := am.Store.GetAccount(context.Background(), id)
@@ -1005,6 +1018,41 @@ func BenchmarkTest_GetAccountWithclaims(b *testing.B) {
}
func genGroups() map[string]*types.Group {
return map[string]*types.Group{
"one": {
Name: "one",
},
"two": {
Name: "two",
},
"three": {
Name: "three",
},
"four": {
Name: "four",
},
"five": {
Name: "five",
},
"six": {
Name: "six",
},
"seven": {
Name: "seven",
},
"eight": {
Name: "eight",
},
"nine": {
Name: "nine",
},
"ten": {
Name: "ten",
},
}
}
func genUsers(p string, n int) map[string]*types.User {
users := map[string]*types.User{}
now := time.Now()