Skip to content

Commit e88d26b

Browse files
Review and codacy updates
Co-authored-by: Kory Draughn <[email protected]>
1 parent 341ce7e commit e88d26b

File tree

10 files changed

+26
-26
lines changed

10 files changed

+26
-26
lines changed

irods/test/login_auth_test.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,21 @@ fi
4646
update_json_file $LOCAL_ACCOUNT_ENV_FILE \
4747
"$(newcontent $LOCAL_ACCOUNT_ENV_FILE ssl_keys encrypt_keys)"
4848

49-
if [ "$server_hup" = y ]; then
49+
update_time=0
50+
# We won't time out, however we will warn for each minute the server
51+
# has not returned to readiness.
52+
if [ "$server_hup" = "y" ]; then
5053
# wait for server to be ready after configuration reload
5154
while true; do
5255
sleep 2
5356
if ils >/dev/null 2>&1; then
5457
break
5558
else
56-
# Allow ~16 secs of total wait time.
57-
[ $((++server_check)) -gt 8 ] && {
58-
echo >&2 "Timed out on server reload"; exit 3; }
59+
now=$(date +%s)
60+
if [ $now -ge $((update_time + 60)) ]; then
61+
echo >&2 "At [$(date)] ... still waiting on server reload";
62+
update_time=$now
63+
fi
5964
fi
6065
done
6166
fi

irods/test/scripts/test_support_functions

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ set_up_ssl() {
2121
}
2222

2323
# Clears out environment and resets to rodsadmin 'rods'.
24-
# Meant mostly to allow initial steps by a rodsadminfor setting up tests.
24+
# Meant mostly to allow initial steps by a rodsadmin for setting up tests.
2525

2626
iinit_as_rods() {
2727
rm -fr ~/.irods
@@ -119,7 +119,6 @@ _begin_pam_environment_and_password() {
119119
mkdir ~/.irods
120120
echo "$ENV" > ~/.irods/irods_environment.json
121121

122-
# TODO: check: it seems /dev/tty won't work if docker exec is not invoked with -t
123122
if [ -n "$1" -a -z "$SKIP_IINIT_FOR_PASSWORD" ]; then
124123
iinit <<<"$1" 2>/tmp/iinit_as_alice.log
125124
fi
@@ -206,7 +205,8 @@ setup_pyN() {
206205
fi
207206
}
208207

209-
# requires image to descend from bats-python3
208+
# Call to both initialize and activate a virtualenv with the requested Python3 interpreter
209+
# installed. Requires image to descend from 'bats-and-system-python'.
210210
activate_virtual_env_with_prc_installed()
211211
{
212212
local py_venv=${1:-pyN}
@@ -219,6 +219,8 @@ activate_virtual_env_with_prc_installed()
219219
python -c 'import irods' || { echo >&2 "ERROR: python-irodsclient install failed."; false; }
220220
}
221221

222+
# Produces an output of a precise timestamp with the file content appended,
223+
# as an indicator of whether a file has been modified.
222224
mtime_and_content()
223225
{
224226
stat -c%y "$1"

test_harness/multiple_node/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ Currently the database server is fixed as Postgres.
2323

2424
The file `.github/workflows/run-the-tests.yml` describes a Github action which
2525
will be started to run the client test suite in response to creating a pull
26-
request, or pushing new commits to the Github branch, containing it.
26+
request, or pushing new commits to the GitHub branch, containing it.
2727

2828
The command-line recipe outlined in the file also supports running the
2929
test suite on any workstation with docker compose installed.
3030

3131
A summary of how to run the tests "at the bench" follows:
3232

33-
1. Change the working directory to the repository top directory, e.g.:
33+
1. Change the working directory to the root directory of the repository, e.g.:
3434
```
3535
cd /path/to/python-irodsclient
3636
```
@@ -39,8 +39,8 @@ A summary of how to run the tests "at the bench" follows:
3939
```
4040
./docker-testing/start_containers.sh 4.3.4 3.11
4141
```
42-
This builds and runs the docker images for the project, with "4.3.4" being the iRODS
43-
version installed on the provider and "3.11" is the version of python run on the client side.
42+
This builds and runs the docker images for the project, with "4.3.4" being the iRODS
43+
version installed on the provider and "3.11" being the version of python installed on the client side.
4444
4545
3. Run:
4646
```

test_harness/multiple_node/start_containers.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ python_version=\"${PYTHON_VERSION}\"
4646
irods_version=\"${IRODS_VERSION}\"
4747
irods_major=\"${IRODS_MAJOR}\"" >.env
4848

49-
# In case the docker-compose setup varies between iRODS major releases, the .YML file may be a symbolic link.
50-
5149
docker compose -f harness-docker-compose-irods-${IRODS_MAJOR}.yml build $SHELL_DOCKER_COMPOSE_BUILD_ARGS
5250

5351
if [ -z "$DO_NOT_RUN" ]; then

test_harness/multiple_node/stop_containers.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@ fi
2121

2222
IRODS_MAJOR=${IRODS_VERSION//.*/}
2323

24-
# In case the docker-compose setup varies between iRODS major releases, the .YML file may be a symbolic link.
25-
2624
docker compose -f harness-docker-compose-irods-${IRODS_MAJOR}.yml down

test_harness/single_node/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Description
44

5-
A series of docker images which support running isolated test scripts (using BATS, bash, or Python).
5+
A series of Docker images which support running isolated test scripts (using BATS, bash, or Python).
66
Once built, the images allow loading and customizing the Docker container environment for a given
77
test script.
88

@@ -50,7 +50,7 @@ Sample command lines to build Docker images:
5050
Builds (ignoring docker cache) images based on specific iRODS package version and desired
5151
Python Interpreter version, optionally with a restricted list of Docker files in need of rebulding.
5252

53-
### To run a test script.
53+
### To run a test script
5454

5555
```
5656
$REPO_ROOT/irods/test/harness/docker_container_driver.sh $REPO_ROOT/irods/test/scripts/run_local_suite

test_harness/single_node/install.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# A script to manage the main steps in installing an iRODS server as well as all necessary support. (Dependencies,
44
# catalog database, etc.)
55

6-
IRODS_HOME=/var/lib/irods
76
DEV_HOME="$HOME"
87
: ${DEV_REPOS:="$DEV_HOME/github"}
98

@@ -29,7 +28,7 @@ add_package_repo()
2928
sudo apt update
3029
}
3130

32-
# Expand a spec of the leading version tuple eg. 4.3.4 out to the full name of
31+
# Expand a spec of the leading version tuple eg. 4.3.4 out to the full name of
3332
# the most recent matching version of the package
3433

3534
# Report the latest version spec (including OS) that matches the env var IRODS_PACKAGE_VERSION (eg. "5.0.2" -> "5.0.2-0~jammy)
@@ -50,8 +49,7 @@ while [[ "$1" = -* ]]; do
5049
ARG="$1"
5150
shift
5251
case $ARG in
53-
--i=* | --irods=* |\
54-
--irods-version=*) IRODS_PACKAGE_VERSION=${ARG#*=};;
52+
--i=* | --irods=* | --irods-version=* ) IRODS_PACKAGE_VERSION=${ARG#*=};;
5553
--w=* | --with=* | --with-options=* ) withopts=${ARG#*=} ;;
5654
esac
5755
done

test_harness/single_node/irods_version_greater_or_equal_to

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ if __name__ == '__main__':
3939
j = json.load(open(version_files[0]))
4040
version_to_test = j["irods_version"]
4141

42-
if version_to_tuple(version_to_test) < version_to_tuple(arg[0]):
42+
if version_to_tuple(version_to_test) < version_to_tuple(arg[0]):
4343
exit(1)

test_harness/single_node/setup_python_rule_engine

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
wait=""
66
if [ $1 = --wait ]; then
7-
wait=1
8-
shift
7+
wait=1
8+
shift
99
fi
1010

1111
DIR=$(dirname "$0")
@@ -82,7 +82,7 @@ if [ -n "$wait" ]; then
8282
times=0
8383
OUTFILE=/tmp/irule_output.stderr
8484
while :; do
85-
irule -a 2>/dev/null| grep irods_rule_engine_plugin-python-instance >/dev/null
85+
irule -a 2>/dev/null | grep irods_rule_engine_plugin-python-instance >/dev/null
8686
[ ${PIPESTATUS[1]} -eq 0 ] && break
8787
sleep 1
8888
if [ $((++times)) -ge 10 ]; then

test_harness/utility/iinit.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import sys
1111
from os import chmod
1212
from os.path import expanduser,exists,join
13-
from getopt import getopt
1413

1514

1615
home_env_path = expanduser('~/.irods')

0 commit comments

Comments
 (0)