Skip to content

Commit c01ea3c

Browse files
committed
[state of supporting PR #772 as of the current Pull Request's creation]
[_697] Github workflows for running PRC tests Co-authored-by: d-w-moore <dmoore@renci.org> Includes a docker compose configuration in which the PRC test suite can be run in a way representative of typical operational use, and the version of iRODS server and python interpreter that we install are also easily reconfigurable. Additionally, this affords us the opportunity to run the test suite on a client node all its own, the iRODS server being reachable only via the network. [_502] test harness and container-based tests A new test harness is introduced in which we construct a new container (using either Docker or podman) for each test program we run. This allows full customization of the container environment for the particular needs of each test. Accordingly, included with the Github workflows (in a separate commit) is a full run of the PRC test suite with the iRODS server and catalog DB server running in the same container as the client. In the process of putting old tests through new rigors, faults were found and corrected in some of those tests. completely remove {send,recv}_oneshot sync mechanism review comments Comments moved to *.yml files. README.md no longer needed. update irods/harness/README deindent correct forgotten comment symbol clearer comment in run_tests.sh suggestions nr. 1 10-22-25 13:19 suggestions nr. 2 10-22-25 smchg package repo chg comments chg
1 parent 76ce0e6 commit c01ea3c

File tree

70 files changed

+2142
-228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2142
-228
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# https://github.com/actions/starter-workflows/blob/master/ci/python-package.yml
33
# (C) Github, MIT License
44

5+
# Static type checking tests using `mypy`.
6+
57
name: "Python type checking"
68

79
on: [push, pull_request]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Run a set of tests, each in its own container and with a potentially customized setup.
2+
# (Documentation and implementation for the test harness may be found in `irods/test/harness`.)
3+
4+
name: run-bats-tests
5+
6+
on: [push, pull_request]
7+
8+
jobs:
9+
tests:
10+
timeout-minutes: 20
11+
12+
name: Python ${{ matrix.python }}, iRODS ${{ matrix.irods_server }}
13+
runs-on: ubuntu-latest
14+
defaults:
15+
run:
16+
working-directory: ./irods/test/harness
17+
strategy:
18+
matrix:
19+
python: ['3.9','3.13']
20+
irods_server: ['4.3.4','5.0.2']
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Build images
27+
run: ./create_docker_images.sh "${{ matrix.irods_server }}" "${{ matrix.python }}"
28+
29+
- name: run tests
30+
run: |
31+
for script in ../scripts/test[0-9]*; do
32+
./docker_container_driver.sh -V $script
33+
done
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Run the client test suite in a Docker container, targeting a locally running instance of the iRODS server.
2+
# (Documentation and implementation for the test harness may be found in `irods/test/harness`.)
3+
4+
name: run-local-suite
5+
6+
on: [push, pull_request]
7+
8+
jobs:
9+
tests:
10+
timeout-minutes: 20
11+
12+
name: Python ${{ matrix.python }}, iRODS ${{ matrix.irods_server }}
13+
runs-on: ubuntu-latest
14+
defaults:
15+
run:
16+
working-directory: ./irods/test/harness
17+
strategy:
18+
matrix:
19+
python: ['3.9','3.13']
20+
irods_server: ['4.3.4','5.0.2']
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Build images
27+
run: ./create_docker_images.sh "${{ matrix.irods_server }}" "${{ matrix.python }}"
28+
29+
- name: run tests
30+
run: |
31+
./docker_container_driver.sh -V ../scripts/run_suite_locally.sh
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Create a networked set of containers (via a Docker compose project) on which to run the client test suite.
2+
# (For further information, see the README in `docker-testing`.)
3+
4+
name: run-the-tests
5+
6+
on: [push, pull_request]
7+
8+
jobs:
9+
tests:
10+
timeout-minutes: 20
11+
12+
name: Python ${{ matrix.python }}, iRODS ${{ matrix.irods_server }}
13+
runs-on: ubuntu-latest
14+
defaults:
15+
run:
16+
working-directory: ./docker-testing
17+
strategy:
18+
matrix:
19+
python: ['3.9','3.13']
20+
irods_server: ['4.3.4','5.0.2']
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Start containers
27+
run: ./start_containers.sh "${{ matrix.irods_server }}" "${{ matrix.python }}"
28+
29+
- name: run test
30+
run: |
31+
while :; do
32+
client_container=$(docker ps --format "{{.Names}}"|grep python.client)
33+
[ -n "$client_container" ] && break
34+
sleep 1
35+
done
36+
echo "client_container = [$client_container]"
37+
docker exec "${client_container}" /repo_root/docker-testing/run_tests.sh
38+
39+
- name: Stop containers
40+
if: always()
41+
run: ./stop_containers.sh "${{ matrix.irods_server }}" "${{ matrix.python }}"

Dockerfile.prc_test.centos

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,5 @@ RUN python${py_N} repo/docker_build/iinit.py \
2424
password rods
2525
SHELL ["/bin/bash","-c"]
2626
CMD echo "Waiting on iRODS server... " ; \
27-
python${PY_N} repo/docker_build/recv_oneshot -h irods-provider -p 8888 -t 360 && \
2827
sudo groupadd -o -g $(stat -c%g /irods_shared) irods && sudo usermod -aG irods user && \
2928
newgrp irods < repo/run_python_tests.sh

Dockerfile.prc_test.ubuntu

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,5 @@ SHELL ["/bin/bash","-c"]
3131
# 3. run python tests as the new group
3232

3333
CMD echo "Waiting on iRODS server... " ; \
34-
python${PY_N} repo/docker_build/recv_oneshot -h irods-provider -p 8888 -t 360 && \
3534
sudo groupadd -o -g $(stat -c%g /irods_shared) irods && sudo usermod -aG irods user && \
3635
newgrp irods < repo/run_python_tests.sh

docker-testing/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# A Topological Setup for Testing the Python Client
2+
3+
The `docker-testing` directory contains the necessary files for building and
4+
running tests from the perspective of a specific client node in a larger network.
5+
6+
We currently allow a choice of Python interpreter and iRODS server to be installed
7+
on the client and provider nodes of a simulated network topology.
8+
9+
The choice of versions are dictated when running the test:
10+
11+
|:------------------:|:---------------:|
12+
|Environment Variable| Valid Range |
13+
|:-------------------|-----------------|
14+
IRODS_PACKAGE_VERSION|4.3.1 to 5.0.2 |
15+
PYTHON_VERSION |3.9 to 3.13 |
16+
|:-------------------|-----------------|
17+
18+
Currently the database server is fixed as Postgres.
19+
20+
## Details of usage
21+
22+
The file `$REPO/.github/workflows/run-the-tests.yml`
23+
(where `$REPO` is the `/path/to/local/python-irodsclient` repository)
24+
contains commands for starting the server and client containers and running the PRC
25+
suite in response to a push or pull-request.
26+
27+
The test suite can also be run on any workstation with docker compose installed.
28+
What follows is a short summary of how to run the test configuration at the bench.
29+
It is this procedure which is run within the Github workflows.
30+
31+
1. cd into top level of $REPO
32+
33+
2. run:
34+
```
35+
./docker-testing/start_containers.sh 4.3.4 3.11
36+
```
37+
This builds and runs the docker images for the project, with "4.3.4" being the iRODS
38+
version installed on the provider and "3.11" is the version of python run on the client side.
39+
40+
3. run:
41+
```
42+
docker exec <name-of-python-client-container> /repo_root/docker-testing/run_tests.sh
43+
```
44+
(Note: `/repo_root` is an actual literal path, internal to the container.)
45+
You'll see the test output displayed on the console. At completion, xmlrunner outputs are in /tmp.
46+
47+
4. use `docker logs -f` with the provider instance name to tail the irods server log output
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
harness-docker-compose.yml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
harness-docker-compose.yml
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version: '3'
2+
3+
services:
4+
irods-catalog:
5+
build:
6+
context: irods_catalog_${irods_major}
7+
# 5432 is exposed by default and can conflict with other postgres containers.
8+
# When the metalnx-db service is no longer needed, this stanza can be removed.
9+
ports:
10+
- "5430:5432"
11+
environment:
12+
- POSTGRES_PASSWORD=testpassword
13+
14+
python-client:
15+
build:
16+
context: python_client
17+
args:
18+
python_version: ${python_version}
19+
command:
20+
tail -f /dev/null
21+
volumes:
22+
- ${repo_external}:/repo_root:ro
23+
- /tmp/irods-client-share.py-${python_version}:/irods_shared
24+
depends_on:
25+
irods-catalog-provider:
26+
condition: service_healthy
27+
28+
irods-catalog-provider:
29+
volumes:
30+
- /tmp/irods-client-share.py-${python_version}:/irods_shared
31+
build:
32+
context: irods_catalog_provider_${irods_major}
33+
args:
34+
irods_version: ${irods_version}
35+
shm_size: 500mb
36+
healthcheck:
37+
test: ["CMD", "su", "-", "irods", "-c", "ils || exit 1"]
38+
interval: 10s
39+
timeout: 10s
40+
retries: 3
41+
ports:
42+
- "1247:1247"
43+
depends_on:
44+
- irods-catalog
45+

0 commit comments

Comments
 (0)