Skip to content

Commit

Permalink
Merge pull request #140 from phac-nml/int_tests_gradle
Browse files Browse the repository at this point in the history
switch intigration tests to launch irida via gradle
  • Loading branch information
ericenns authored Jul 7, 2022
2 parents 0503661 + b481eef commit e1f0974
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Bug Fixes:
* Fixed command line help text inconsistency
* Catch mixed paired end and single end files in a sequencing run at the validation step and show user which samples are incorrect.

Developer Changes:
* Integration Tests now launch IRIDA with Gradle

Beta 0.8.1
---------
Bug Fixes:
Expand Down
11 changes: 1 addition & 10 deletions iridauploader/tests_integration/bash_scripts/install_irida.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash

# This file is modified from https://irida.corefacility.ca/gitlab/irida/import-tool-for-galaxy/blob/development/irida_import/tests/integration/bash_scripts/install.sh
# This file creates a repos directory and pulls the irida branch with the name in $1

if ! mkdir repos
then
Expand All @@ -16,13 +15,5 @@ then
echo >&2 "Failed to clone"
exit 1
else
pushd irida
echo "Preparing IRIDA for first excecution..."

pushd lib
./install-libs.sh
popd
popd
echo "IRIDA has been installed"
fi

23 changes: 13 additions & 10 deletions iridauploader/tests_integration/integration_data_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def __init__(self, base_url, user, password, branch, db_host, db_port):
self.DB_NAME + ' < {}'.format(sql_file)

self.IRIDA_CMD = \
'mvn clean compile spring-boot:start -DskipTests --quiet ' +\
'-Dspring-boot.run.arguments=\"' +\
'./gradlew -q clean bootRun -x check ' +\
'--args=\"' +\
'--spring.datasource.url={} '.format(self.DB_JDBC_URL) +\
'--spring.datasource.username={} '.format(self.DB_USERNAME) +\
'--spring.datasource.password={} '.format(self.DB_PASSWORD) +\
Expand All @@ -70,8 +70,6 @@ def __init__(self, base_url, user, password, branch, db_host, db_port):
'--logging.pattern.console=' +\
'\"'

self.IRIDA_STOP = 'mvn spring-boot:stop'

self.PATH_TO_MODULE = path.dirname(__file__)
if len(self.PATH_TO_MODULE) == 0:
self.PATH_TO_MODULE = "."
Expand All @@ -83,6 +81,9 @@ def __init__(self, base_url, user, password, branch, db_host, db_port):
self.REPO_PATH = path.join(self.PATH_TO_MODULE, "repos")
self.IRIDA_PATH = path.join(self.REPO_PATH, "irida")

# Handles the irida subprocess
self.irida_subprocess = None

def install_irida(self):
"""
Installs IRIDA
Expand Down Expand Up @@ -124,8 +125,11 @@ def run_irida(self):
Waits until IRIDA is up to return
:return:
"""
subprocess.Popen(
self.IRIDA_CMD, cwd=self.IRIDA_PATH, shell=True)
self.irida_subprocess = subprocess.Popen(
"exec " + self.IRIDA_CMD, # assign new process image
stdout=subprocess.PIPE, # makes subprocess.Popen return pid of command, and not shell (default behaviour)
cwd=self.IRIDA_PATH,
shell=True)
self._wait_until_up()

def _wait_until_up(self):
Expand All @@ -150,10 +154,9 @@ def _wait_until_up(self):

def stop_irida(self):
"""
Stops the IRIDA mvn process
Kill the IRIDA gradlew process
This will sometimes dump errors into the log, but it is harmless
:return:
"""
stopper = subprocess.Popen(
self.IRIDA_STOP, cwd=self.IRIDA_PATH, shell=True)
stopper.wait()
self.irida_subprocess.kill()
self.irida_subprocess = None

0 comments on commit e1f0974

Please sign in to comment.