Skip to content

Commit

Permalink
logictest: fix user cmd to respect nodeidx for cockroach-go testserver
Browse files Browse the repository at this point in the history
This patch fixes the client creation for logic tests that use the
cockroach-go testserver to use the specified nodeidx when connecting.

Release note: None
  • Loading branch information
andyyang890 committed Jan 31, 2023
1 parent f0b3c65 commit a0240e8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/sql/logictest/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -1160,8 +1160,9 @@ func (t *logicTest) setUser(user string, nodeIdx int) func() {
var cleanupFunc func()
pgUser = strings.TrimPrefix(user, "host-cluster-")
if t.cfg.UseCockroachGoTestserver {
pgURL = *t.testserverCluster.PGURL()
pgURL = *t.testserverCluster.PGURLForNode(nodeIdx)
pgURL.User = url.User(pgUser)
pgURL.Path = "test"
cleanupFunc = func() {}
} else {
addr = t.cluster.Server(nodeIdx).ServingSQLAddr()
Expand Down
19 changes: 19 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/testserver_upgrade_node
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ SELECT crdb_internal.node_executable_version()
----
22.2

user root nodeidx=2

query T
SELECT crdb_internal.node_executable_version()
----
22.2

query B
SELECT crdb_internal.node_executable_version() SIMILAR TO '1000022.2-%'
----
false

user root nodeidx=0

query B
SELECT crdb_internal.node_executable_version() SIMILAR TO '1000022.2-%'
----
true

upgrade 2

query B
Expand Down

0 comments on commit a0240e8

Please sign in to comment.