Skip to content

Commit

Permalink
[DICE-UNC#446] Fix launch of iRODS consumer in testing framework.
Browse files Browse the repository at this point in the history
  • Loading branch information
korydraughn committed May 21, 2024
1 parent d48fc50 commit 9b48aaa
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 34 deletions.
36 changes: 22 additions & 14 deletions docker-test-framework/4-3/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ services:
args:
irods_package_version: 4.3.2-0~focal
hostname: icat.example.org
healthcheck:
test: ["CMD", "su", "-", "irods", "-c", "ils"]
interval: 10s
timeout: 10s
retries: 3
start_period: 20s
start_interval: 2s
networks:
irodsnet:
aliases:
Expand All @@ -18,19 +25,6 @@ services:
#- "5432:5432"
#- "20000-21999"

maven:
container_name: maven
build:
context: .
dockerfile: Dockerfile.testbuild
volumes:
- ../..:/usr/src/jargon
- ../../settings.xml:/root/.m2/settings.xml
networks:
irodsnet:
aliases:
- maven.example.org

irods-catalog-consumer-resource1:
container_name: irods-catalog-consumer-resource1
build:
Expand All @@ -44,7 +38,21 @@ services:
aliases:
- resource1.example.org
depends_on:
- irods-catalog-provider
irods-catalog-provider:
condition: service_healthy

maven:
container_name: maven
build:
context: .
dockerfile: Dockerfile.testbuild
volumes:
- ../..:/usr/src/jargon
- ../../settings.xml:/root/.m2/settings.xml
networks:
irodsnet:
aliases:
- maven.example.org

networks:
irodsnet:
Expand Down
15 changes: 11 additions & 4 deletions docker-test-framework/4-3/start_consumer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@
topo_provider="irods-catalog-provider"

# Wait until the provider is up and accepting connections.
echo 'Waiting for setup of iRODS Provider to accept connections ...'
until nc -z $topo_provider 1247; do
sleep 1
done

# Wait until the provider is started again.
echo 'Giving the iRODS Provider a few seconds to restart ...'
sleep 10
until nc -z $topo_provider 1247; do
sleep 1
done

# Set up iRODS.
sed -i '5s/.*/'$topo_provider'/'
python3 /var/lib/irods/scripts/setup_irods.py < /irods_consumer.input
su - irods -c './irodsctl -v start'
echo 'iRODS Consumer is ready.'

# Keep container running if the test fails.
tail -f /dev/null
# Is this better? sleep 2147483647d

sleep 2147483647d
8 changes: 2 additions & 6 deletions docker-test-framework/4-3/start_provider.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ echo Postgres took approximately $counter seconds to fully start ...

# Set up iRODS.
python3 /var/lib/irods/scripts/setup_irods.py < /var/lib/irods/packaging/localhost_setup_postgres.input
service irods start
su - irods -c './irodsctl -v start'

echo Running Test Setup Script
su irods -c '/testsetup-consortium.sh'
echo Completed Test Setup Script

# Keep container running if the test fails.
tail -f /dev/null
# Is this better? sleep 2147483647d

© 2020 GitHub, Inc.

sleep 2147483647d
15 changes: 5 additions & 10 deletions docker-test-framework/DOCKERTEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ CONTAINER ID IMAGE COMMAND
072086ac44e1 4-2_irods-catalog-provider "./start_provider.sh" 22 minutes ago Up 22 minutes 0.0.0.0:1247->1247/tcp, 1248/tcp irods-catalog-provider
c7e102bd061d 4-2_maven "/usr/local/bin/mvn-…" 22 minutes ago Up 22 minutes maven
(base) ~/Documents/workspace-niehs-rel/jargon/docker-test-framework/4-2 @ ALMBP-02010755(conwaymc):
```

**NOTE (4-3 directory only)**: _"iRODS Consumer is ready."_ will be printed to the terminal when the framework is ready for use.

To build and test, simply cd to /usr/src/jargon and run mvn commands after logging into the test container. This snippet illustrates logging in and positioning to the top of the Jargon project, ready to issue maven commands

```
Expand All @@ -43,11 +42,11 @@ To build and test, simply cd to /usr/src/jargon and run mvn commands after loggi
# ls
CHANGELOG.md README.md docker-build-test.sh docker-test-framework jargon-core jargon-mdquery jargon-ruleservice jargon-user-tagging pom.xml target
LICENSE.txt data-profile docker-build.sh eclipse-formatting.xml jargon-data-utils jargon-pool jargon-ticket jargon-zipservice settings.xml user-guide
#
```

Here's a helpful command for running specific tests.
**NOTE**: The settings.xml file is mounted that has the correct coordinates for the iRODS grid pre-configured with test accounts, resources, groups, etc as expected by the Jargon unit test framework.

## Running Specific Tests

```
mvn test -Dtest='<class>#<method>,<class>#<method>, ...' -DfailIfNoTests=false -pl <module> -am
Expand All @@ -62,7 +61,3 @@ mvn test \
-pl jargon-core \
-am
```


Note the settings.xml file is mounted that has the correct coordinates for the iRODS grid pre-configured with test accounts, resources, groups, etc as expected by the Jargon unit test framework.

0 comments on commit 9b48aaa

Please sign in to comment.