Skip to content

Commit

Permalink
[_655] Swap names of native and pam .irodsA generation test scripts.
Browse files Browse the repository at this point in the history
Also correct matching auth scheme names for PAM.  We now compare to
"pam"* so that iRODS 4.2 and 4.3 can both pass the tests.
  • Loading branch information
d-w-moore committed Nov 6, 2024
1 parent 4ab45c5 commit 183e6e6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bats
#
# Test creation of .irodsA for iRODS native authentication using the free function,
# irods.client_init.write_pam_credentials_to_secrets_file
# Test creation of .irodsA for iRODS pam_password authentication using the free function,
# irods.client_init.write_native_credentials_to_secrets_file

. "$BATS_TEST_DIRNAME"/test_support_functions
PYTHON=python3
Expand All @@ -10,26 +10,18 @@ PYTHON=python3
# Run as ubuntu user with sudo; python_irodsclient must be installed (in either ~/.local or a virtualenv)
#

ALICES_OLD_PAM_PASSWD="test123"
ALICES_NEW_PAM_PASSWD="new_pass"
@test create_irods_secrets_file {

setup()
{
setup_pam_login_for_alice "$ALICES_OLD_PAM_PASSWD"
}

teardown()
{
finalize_pam_login_for_alice
test_specific_cleanup
}

@test create_secrets_file {

# Old .irodsA is already created, so we delete it and alter the pam password.
sudo chpasswd <<<"alice:$ALICES_NEW_PAM_PASSWD"
rm -f ~/.irods/.irodsA
$PYTHON -c "import irods.client_init; irods.client_init.write_pam_credentials_to_secrets_file('$ALICES_NEW_PAM_PASSWD')"
rm -fr ~/.irods
mkdir ~/.irods
cat > ~/.irods/irods_environment.json <<-EOF
{ "irods_host":"$(hostname)",
"irods_port":1247,
"irods_user_name":"rods",
"irods_zone_name":"tempZone"
}
EOF
$PYTHON -c "import irods.client_init; irods.client_init.write_native_credentials_to_secrets_file('rods')"

# Define the core Python to be run, basically a minimal code block ensuring that we can authenticate to iRODS
# without an exception being raised.
Expand All @@ -42,6 +34,5 @@ print ('env_auth_scheme=%s' % ses.pool.account._original_authentication_scheme)
"
OUTPUT=$($PYTHON -c "$SCRIPT")
# Assert passing value
[ $OUTPUT = "env_auth_scheme=pam_password" ]

[[ $OUTPUT = "env_auth_scheme=native" ]]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bats
#
# Test creation of .irodsA for iRODS pam_password authentication using the free function,
# irods.client_init.write_native_credentials_to_secrets_file
# Test creation of .irodsA for iRODS native authentication using the free function,
# irods.client_init.write_pam_credentials_to_secrets_file

. "$BATS_TEST_DIRNAME"/test_support_functions
PYTHON=python3
Expand All @@ -10,18 +10,26 @@ PYTHON=python3
# Run as ubuntu user with sudo; python_irodsclient must be installed (in either ~/.local or a virtualenv)
#

@test create_irods_secrets_file {
ALICES_OLD_PAM_PASSWD="test123"
ALICES_NEW_PAM_PASSWD="new_pass"

rm -fr ~/.irods
mkdir ~/.irods
cat > ~/.irods/irods_environment.json <<-EOF
{ "irods_host":"$(hostname)",
"irods_port":1247,
"irods_user_name":"rods",
"irods_zone_name":"tempZone"
}
EOF
$PYTHON -c "import irods.client_init; irods.client_init.write_native_credentials_to_secrets_file('rods')"
setup()
{
setup_pam_login_for_alice "$ALICES_OLD_PAM_PASSWD"
}

teardown()
{
finalize_pam_login_for_alice
test_specific_cleanup
}

@test create_secrets_file {

# Old .irodsA is already created, so we delete it and alter the pam password.
sudo chpasswd <<<"alice:$ALICES_NEW_PAM_PASSWD"
rm -f ~/.irods/.irodsA
$PYTHON -c "import irods.client_init; irods.client_init.write_pam_credentials_to_secrets_file('$ALICES_NEW_PAM_PASSWD')"

# Define the core Python to be run, basically a minimal code block ensuring that we can authenticate to iRODS
# without an exception being raised.
Expand All @@ -34,5 +42,6 @@ print ('env_auth_scheme=%s' % ses.pool.account._original_authentication_scheme)
"
OUTPUT=$($PYTHON -c "$SCRIPT")
# Assert passing value
[ $OUTPUT = "env_auth_scheme=native" ]
[[ $OUTPUT = "env_auth_scheme=pam"* ]]

}

0 comments on commit 183e6e6

Please sign in to comment.