From ea464dc52062d63069b244c0b3f8139d8f38c724 Mon Sep 17 00:00:00 2001 From: Daniel Colson Date: Tue, 4 Oct 2022 15:29:27 -0400 Subject: [PATCH] Add failing test for caching_sha2_password auth Reproduction for https://github.com/github/trilogy/issues/26 --- contrib/ruby/test/client_test.rb | 7 +++++++ docker-entrypoint-initdb.d/caching_sha2_password_user.sql | 3 +++ 2 files changed, 10 insertions(+) create mode 100644 docker-entrypoint-initdb.d/caching_sha2_password_user.sql diff --git a/contrib/ruby/test/client_test.rb b/contrib/ruby/test/client_test.rb index 7961e817..4a790c80 100644 --- a/contrib/ruby/test/client_test.rb +++ b/contrib/ruby/test/client_test.rb @@ -30,6 +30,13 @@ def test_trilogy_connect_with_native_password_auth_switch ensure_closed client end + def test_trilogy_connect_with_caching_sha2_password_auth_switch + client = new_tcp_client username: "caching_sha2", password: "password" + refute_nil client + ensure + ensure_closed client + end + def test_trilogy_connect_tcp_to_wrong_port e = assert_raises Trilogy::ConnectionError do new_tcp_client port: 13307 diff --git a/docker-entrypoint-initdb.d/caching_sha2_password_user.sql b/docker-entrypoint-initdb.d/caching_sha2_password_user.sql new file mode 100644 index 00000000..52df551f --- /dev/null +++ b/docker-entrypoint-initdb.d/caching_sha2_password_user.sql @@ -0,0 +1,3 @@ +CREATE USER 'caching_sha2'@'%'; +GRANT ALL PRIVILEGES ON test.* TO 'caching_sha2'@'%'; +ALTER USER 'caching_sha2'@'%' IDENTIFIED WITH caching_sha2_password BY 'password';