Fix tests

This commit is contained in:
Nikolay Degterinsky 2023-04-10 22:04:10 +00:00
parent def8611d2c
commit 908be1e324
4 changed files with 11 additions and 8 deletions

View File

@ -11,6 +11,7 @@
#include <Parsers/Access/ASTRowPolicyName.h>
#include <Parsers/Access/ASTAuthenticationData.h>
#include <Parsers/ASTLiteral.h>
#include <Parsers/ASTExpressionList.h>
#include <Parsers/ExpressionListParsers.h>
#include <Parsers/formatAST.h>
#include <Parsers/parseQuery.h>
@ -91,9 +92,11 @@ namespace
{
node->expect_common_names = true;
auto list = std::make_shared<ASTExpressionList>();
for (const auto & name : auth_data.getSSLCertificateCommonNames())
node->children.push_back(std::make_shared<ASTLiteral>(name));
list->children.push_back(std::make_shared<ASTLiteral>(name));
node->children.push_back(std::move(list));
break;
}

View File

@ -261,7 +261,7 @@ INSTANTIATE_TEST_SUITE_P(ParserCreateUserQuery, ParserTest,
::testing::ValuesIn(std::initializer_list<ParserTestCase>{
{
"CREATE USER user1 IDENTIFIED WITH sha256_password BY 'qwe123'",
"CREATE USER user1 IDENTIFIED WITH sha256_hash BY '[A-Za-z0-9]{64}' SALT '[A-Za-z0-9]{64}'"
"CREATE USER user1 IDENTIFIED WITH sha256_password BY 'qwe123'"
},
{
"CREATE USER user1 IDENTIFIED WITH sha256_hash BY '7A37B85C8918EAC19A9089C0FA5A2AB4DCE3F90528DCDEEC108B23DDF3607B99' SALT 'salt'",
@ -269,7 +269,7 @@ INSTANTIATE_TEST_SUITE_P(ParserCreateUserQuery, ParserTest,
},
{
"ALTER USER user1 IDENTIFIED WITH sha256_password BY 'qwe123'",
"ALTER USER user1 IDENTIFIED WITH sha256_hash BY '[A-Za-z0-9]{64}' SALT '[A-Za-z0-9]{64}'"
"ALTER USER user1 IDENTIFIED WITH sha256_password BY 'qwe123'"
},
{
"ALTER USER user1 IDENTIFIED WITH sha256_hash BY '7A37B85C8918EAC19A9089C0FA5A2AB4DCE3F90528DCDEEC108B23DDF3607B99' SALT 'salt'",

View File

@ -95,14 +95,14 @@ def test_create_alter_user():
check_logs(
must_contain=[
"CREATE USER u1 IDENTIFIED WITH sha256_password",
"ALTER USER u1 IDENTIFIED WITH sha256_password",
"CREATE USER u1 IDENTIFIED",
"ALTER USER u1 IDENTIFIED",
"CREATE USER u2 IDENTIFIED WITH plaintext_password",
],
must_not_contain=[
password,
"IDENTIFIED WITH sha256_password BY",
"IDENTIFIED WITH sha256_hash BY",
"IDENTIFIED BY",
"IDENTIFIED BY",
"IDENTIFIED WITH plaintext_password BY",
],
)

View File

@ -47,5 +47,5 @@ def test_complexity_rules(start_cluster):
def test_default_password_type(start_cluster):
node2.query("CREATE USER u1 IDENTIFIED BY 'pwd'")
required_type = "DOUBLE_SHA1_PASSWORD"
required_type = "double_sha1_password"
assert required_type in node2.query("SHOW CREATE USER u1")