Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
134391: roachtest: fix grant revoke ops for dbuser with numbers r=shailendra-patel a=nameisbhaskar

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

Co-authored-by: Bhaskarjyoti Bora <[email protected]>
  • Loading branch information
craig[bot] and nameisbhaskar committed Nov 6, 2024
2 parents 77d7d8d + b109767 commit f5fde85
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/cmd/roachtest/operations/grant_revoke_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit f5fde85

Please sign in to comment.