Skip to content

Commit

Permalink
roachtest: fix grant revoke ops for dbuser with numbers
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nameisbhaskar committed Nov 6, 2024
1 parent 77d7d8d commit b109767
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 b109767

Please sign in to comment.