diff --git a/redis-bechmark-go.go b/redis-bechmark-go.go index cb04bbc..f6d1a9a 100644 --- a/redis-bechmark-go.go +++ b/redis-bechmark-go.go @@ -173,6 +173,7 @@ func main() { port := flag.Int("p", 12000, "Server port.") rps := flag.Int64("rps", 0, "Max rps. If 0 no limit is applied and the DB is stressed up to maximum.") rpsburst := flag.Int64("rps-burst", 0, "Max rps burst. If 0 the allowed burst will be the ammount of clients.") + username := flag.String("u", "", "Username for Redis Auth.") password := flag.String("a", "", "Password for Redis Auth.") jsonOutFile := flag.String("json-out-file", "", "Results file. If empty will not save.") seed := flag.Int64("random-seed", 12345, "random seed to be used.") @@ -264,6 +265,9 @@ func main() { if *password != "" { opts.AuthPass = *password } + if *username != "" { + opts.AuthUser = *username + } alwaysRESP2 := false if *resp == "2" { opts.Protocol = "2" @@ -325,6 +329,7 @@ func main() { } clientOptions := rueidis.ClientOption{ InitAddress: []string{connectionStr}, + Username: *username, Password: *password, AlwaysPipelining: false, AlwaysRESP2: alwaysRESP2, diff --git a/redis-bechmark-go_test.go b/redis-bechmark-go_test.go index 78d588a..a6a4c45 100644 --- a/redis-bechmark-go_test.go +++ b/redis-bechmark-go_test.go @@ -100,7 +100,9 @@ func TestGecko(t *testing.T) { args []string }{ {"simple run", 0, 1, 100, []string{"-p", "6379", "-c", "10", "-n", "100", "HSET", "hash:1", "field", "value"}}, + {"simple run username", 0, 1, 100, []string{"-p", "6379", "-u", "default", "-c", "10", "-n", "100", "HSET", "hash:1", "field", "value"}}, {"simple run rueidis", 0, 1, 100, []string{"-p", "6379", "-rueidis", "-c", "10", "-n", "100", "HSET", "hash:1", "field", "value"}}, + {"simple run rueidis username", 0, 1, 100, []string{"-p", "6379", "-rueidis", "-u", "default", "-c", "10", "-n", "100", "HSET", "hash:1", "field", "value"}}, {"run with multi-exec rueidis", 0, 1, 100, []string{"-p", "6379", "-rueidis", "-multi", "-c", "10", "-n", "100", "-rps", "100", "HSET", "hash:1", "field", "value"}}, {"run with rps", 0, 1, 100, []string{"-p", "6379", "-c", "10", "-n", "100", "-rps", "100", "HSET", "hash:1", "field", "value"}}, {"run with rps rueidis", 0, 1, 100, []string{"-p", "6379", "-rueidis", "-c", "10", "-n", "100", "-rps", "100", "HSET", "hash:1", "field", "value"}},