From 9b48aaa978f686e3182e296a2944c65270846b78 Mon Sep 17 00:00:00 2001 From: Kory Draughn Date: Tue, 14 May 2024 13:34:58 -0400 Subject: [PATCH] [#446] Fix launch of iRODS consumer in testing framework. --- docker-test-framework/4-3/docker-compose.yml | 36 ++++++++++++-------- docker-test-framework/4-3/start_consumer.sh | 15 +++++--- docker-test-framework/4-3/start_provider.sh | 8 ++--- docker-test-framework/DOCKERTEST.md | 15 +++----- 4 files changed, 40 insertions(+), 34 deletions(-) diff --git a/docker-test-framework/4-3/docker-compose.yml b/docker-test-framework/4-3/docker-compose.yml index 31ac996b9..310d5d4a5 100644 --- a/docker-test-framework/4-3/docker-compose.yml +++ b/docker-test-framework/4-3/docker-compose.yml @@ -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: @@ -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: @@ -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: diff --git a/docker-test-framework/4-3/start_consumer.sh b/docker-test-framework/4-3/start_consumer.sh index aec412a77..981f45061 100755 --- a/docker-test-framework/4-3/start_consumer.sh +++ b/docker-test-framework/4-3/start_consumer.sh @@ -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 diff --git a/docker-test-framework/4-3/start_provider.sh b/docker-test-framework/4-3/start_provider.sh index f8c198cd9..8ade46a72 100755 --- a/docker-test-framework/4-3/start_provider.sh +++ b/docker-test-framework/4-3/start_provider.sh @@ -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 diff --git a/docker-test-framework/DOCKERTEST.md b/docker-test-framework/DOCKERTEST.md index 740a546e3..5c5c22625 100644 --- a/docker-test-framework/DOCKERTEST.md +++ b/docker-test-framework/DOCKERTEST.md @@ -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 ``` @@ -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='#,#, ...' -DfailIfNoTests=false -pl -am @@ -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. -