From b10976710d89911e4a0c637222aa3bd4a68bfad1 Mon Sep 17 00:00:00 2001 From: Bhaskarjyoti Bora Date: Wed, 6 Nov 2024 15:01:25 +0530 Subject: [PATCH] roachtest: fix grant revoke ops for dbuser with numbers The DB username cannot start with a number. This PR has a simple fix to add a letter "a" in the randomly generated username to ensure that the first letter will not be a number. Epic: None Release note: None --- pkg/cmd/roachtest/operations/grant_revoke_all.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/roachtest/operations/grant_revoke_all.go b/pkg/cmd/roachtest/operations/grant_revoke_all.go index cc6d6d9648aa..050ad5ad972e 100644 --- a/pkg/cmd/roachtest/operations/grant_revoke_all.go +++ b/pkg/cmd/roachtest/operations/grant_revoke_all.go @@ -56,7 +56,8 @@ func runGrant( rng, _ := randutil.NewTestRand() dbName := pickRandomDB(ctx, o, conn, systemDBs) tableName := pickRandomTable(ctx, o, conn, dbName) - dbUser := randutil.RandString(rng, 10, randutil.PrintableKeyAlphabet) + // the dbUser cannot have a number in the beginning. So, adding an "a" to ensure that the first letter will not be a number + dbUser := fmt.Sprintf("a%s", randutil.RandString(rng, 9, randutil.PrintableKeyAlphabet)) o.Status(fmt.Sprintf("Creating user %s", dbUser)) _, err := conn.ExecContext(ctx, fmt.Sprintf("CREATE USER %s WITH PASSWORD '%s'", dbUser, dbUser))