Skip to content

Commit 5c19d32

Browse files
committed
test001 working
1 parent 4a9df26 commit 5c19d32

4 files changed

Lines changed: 18 additions & 3 deletions

File tree

irods/test/harness/test_script_parameters

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ declare -A wrapper_arglist=(
1212

1313
declare -A wrappers=(
1414
[login_auth_test.py]=./login_auth_test.sh
15+
[test001_pam_password_expiration.bats]=../login_auth_test.sh
1516
[demo.sh]=./demo_hook.sh
1617
)
1718

irods/test/login_auth_test.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,12 @@ iinit_as_rods >/dev/null 2>&1 || { echo >&2 "couldn't iinit as rods"; exit 2; }
2626
update_json_file $LOCAL_ACCOUNT_ENV_FILE \
2727
"$(newcontent $LOCAL_ACCOUNT_ENV_FILE ssl_keys encrypt_keys)"
2828

29+
original_script=/prc/$ORIGINAL_SCRIPT_RELATIVE_TO_ROOT
2930
# Run tests.
30-
python "/prc/$ORIGINAL_SCRIPT_RELATIVE_TO_ROOT" $*
31+
if [ -x "$original_script" ]; then
32+
command "$original_script" $*
33+
elif [[ $original_script =~ \.py$ ]]; then
34+
python "$original_script" $*
35+
else
36+
echo >&2 "I don't know how to run this: original_script=[$original_script]"
37+
fi

irods/test/scripts/funcs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ _begin_pam_environment_and_password() {
100100
mv ~/.irods ~/.irods.$$
101101
mkdir ~/.irods
102102
echo "$ENV" > ~/.irods/irods_environment.json
103-
iinit <<<"$1" 2>/dev/tty
103+
104+
# TODO: check: it seems /dev/tty won't work if docker exec is not invoked with -t
105+
iinit <<<"$1" 2>/tmp/iinit_as_alice.log
104106
}
105107

106108
_end_pam_environment_and_password() {
@@ -147,6 +149,11 @@ age_out_pam_password() {
147149
sudo su - postgres -c "psql ICAT -c 'update r_user_password set create_ts=$new_time, modify_ts=$new_time where user_id=$id'"
148150
}
149151

152+
call_irodsctl() {
153+
local arg=${1:-restart}
154+
sudo su - irods -c "./irodsctl $arg"
155+
}
156+
150157
add_irods_to_system_pam_configuration() {
151158
local tempfile=/tmp/irods-pam-config.$$
152159
cat <<-EOF >$tempfile

irods/test/scripts/test001_pam_password_expiration.bats

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ print ('env_auth_scheme=%s' % ses.pool.account._original_authentication_scheme)
4848
HOME_COLLECTION=$(ipwd)
4949
sleep 9
5050
OUTPUT=$($PYTHON -c "$SCRIPT" 2>&1 >/dev/null || true)
51-
grep 'RuntimeError: Time To Live' <<<"$OUTPUT"
51+
grep 'CAT_PASSWORD_EXPIRED' <<<"$OUTPUT"
5252

5353
# Test that the $SCRIPT, when run with proper settings, can successfully reset the password.
5454

0 commit comments

Comments
 (0)