mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-05 22:41:30 +02:00
fix benchmark
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user