MXS-3417 Move mxs1662_pam_admin-test inside pam_authentication

The test failed because the linux user it used was not available
on buildbot. Now the test is part of the larger pam_authentication-
test, which sets up the users.
This commit is contained in:
Esa Korhonen 2021-03-23 18:02:53 +02:00
parent d914c01797
commit 7643dd1445
5 changed files with 16 additions and 22 deletions

View File

@ -802,13 +802,11 @@ add_test_executable(mxs2417_ignore_persisted_cnf.cpp mxs2417_ignore_persisted_cn
# MXS-2450: Crash on COM_CHANGE_USER with disable_sescmd_history=true
add_test_executable(mxs2450_change_user_crash.cpp mxs2450_change_user_crash mxs2450_change_user_crash LABELS REPL_BACKEND readwritesplit)
# MXS-1662: PAM admin authentication
add_test_executable(mxs1662_pam_admin.cpp mxs1662_pam_admin mxs1662_pam_admin LABELS REPL_BACKEND)
# MXS-2414: Block host after repeated authentication failures
add_test_executable(mxs2414_host_blocking.cpp mxs2414_host_blocking replication LABELS REPL_BACKEND)
# PAM authentication
# PAM authentication.
# Also tests MXS-1662: PAM admin authentication
add_test_executable(pam_authentication.cpp pam_authentication pam_authentication LABELS REPL_BACKEND)
# MXS-2350: On-demand connection creation

View File

@ -1,3 +0,0 @@
[maxscale]
threads=###threads###
admin_pam_readwrite_service=passwd

View File

@ -1,5 +1,6 @@
[maxscale]
threads=###threads###
admin_pam_readwrite_service=duckburg
log_info=1
[MySQL-Monitor]

View File

@ -1,15 +0,0 @@
/**
* MXS-1662: PAM authenticator for admin users
*/
#include <maxtest/testconnections.hh>
int main(int argc, char** argv)
{
TestConnections test(argc, argv);
// TODO: Store login information
test.check_maxctrl("-u vagrant -p vagrant show maxscale");
return test.global_result;
}

View File

@ -15,6 +15,7 @@
#include "mariadbmonitor/fail_switch_rejoin_common.cpp"
#include <iostream>
#include <string>
#include <maxtest/envv.hh>
using std::string;
using std::cout;
@ -82,6 +83,7 @@ int main(int argc, char** argv)
if (test.ok())
{
cout << "PAM-plugin installed and users created on all servers. Starting MaxScale.\n";
test.maxscales->restart(0);
}
else
{
@ -176,6 +178,17 @@ int main(int argc, char** argv)
test.maxscales->execute_maxadmin_command(0, "reload dbusers RWSplit-Router");
};
if (test.ok())
{
// First, test that MaxCtrl login with the pam user works.
string cmd = string_printf("-u %s -p %s show maxscale", pam_user, pam_pw);
test.check_maxctrl(cmd);
if (test.ok())
{
cout << "'maxctrl " << cmd << "' works.\n";
}
}
const char create_pam_user_fmt[] = "CREATE OR REPLACE USER '%s'@'%%' IDENTIFIED VIA pam USING '%s';";
if (test.ok())
{