Skip to content

Commit

Permalink
sql: fix TestAuthenticationAndHBARules for special_cases data-driven …
Browse files Browse the repository at this point in the history
…test

informs #131532
informs #131110
informs #130253
informs #127745
Epic: CRDB-41958

`TestAuthenticationAndHBARules` fails for special_cases data driven test. We
suspect it might be due to client for `special_cases` test accessing the test
server from a previous test `secure_non_tls` which sets `accept_sql_without_tls`
to true. This results in the following error `ERROR: pq: SSL is not enabled on
the server` while the client was expecting an SSL connection with the server. We
fix this in the PR.

Release note: None
  • Loading branch information
souravcrl committed Sep 30, 2024
1 parent 74520af commit 75cb1a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/sql/pgwire/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func TestAuthenticationAndHBARules(t *testing.T) {
skip.UnderRace(t, "takes >1min under race")

testutils.RunTrueAndFalse(t, "insecure", func(t *testing.T, insecure bool) {
defer leaktest.AfterTest(t)()
hbaRunTest(t, insecure)
})
}
Expand Down Expand Up @@ -272,6 +273,9 @@ func hbaRunTest(t *testing.T, insecure bool) {
case "accept_sql_without_tls":
testServer.SetAcceptSQLWithoutTLS(true)

case "reject_sql_without_tls":
testServer.SetAcceptSQLWithoutTLS(false)

case "set_hba":
_, err := conn.ExecContext(context.Background(),
`SET CLUSTER SETTING server.host_based_authentication.configuration = $1`, td.Input)
Expand Down
4 changes: 4 additions & 0 deletions pkg/sql/pgwire/testdata/auth/secure_non_tls
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ local all all password
connect password=abc user=testuser sslmode=disable
----
ERROR: authentication rejected by configuration (SQLSTATE 28000)

# Revert enable non-TLS secure connections.
reject_sql_without_tls
----

0 comments on commit 75cb1a9

Please sign in to comment.