From 83a9738fd8d0f840e0a8785e029d5515d5caf3a1 Mon Sep 17 00:00:00 2001 From: Jeffrey Thiessen Date: Wed, 29 Jun 2022 10:12:22 -0500 Subject: [PATCH 1/2] switch intigration tests to launch irida via gradle --- CHANGELOG.md | 3 +++ README.md | 2 ++ .../bash_scripts/install_irida.sh | 11 +-------- .../integration_data_setup.py | 23 +++++++++++-------- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14abe04..89847f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ Bug Fixes: * config file now evaluates any capitalization of True/False and displays errors to the user if unable to parse. * Fixed command line help text inconsistency +Developer Changes: +* Integration Tests now launch IRIDA with Gradle + Beta 0.8.1 --------- Bug Fixes: diff --git a/README.md b/README.md index d545359..2a3ad8d 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,8 @@ Running the unittests can be done with the command: To run integration tests You will need to download and install chromedriver http://chromedriver.chromium.org/downloads +You will need Gradle installed to run IRIDA + You will need to grant the IRIDA instance access to the mysql database needed for the tests $ mysql -e "CREATE USER 'test'@'localhost' IDENTIFIED BY 'test'; GRANT ALL ON irida_uploader_test.* to 'test'@'localhost';" diff --git a/iridauploader/tests_integration/bash_scripts/install_irida.sh b/iridauploader/tests_integration/bash_scripts/install_irida.sh index 3fae763..1d2f4cb 100755 --- a/iridauploader/tests_integration/bash_scripts/install_irida.sh +++ b/iridauploader/tests_integration/bash_scripts/install_irida.sh @@ -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 @@ -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 - diff --git a/iridauploader/tests_integration/integration_data_setup.py b/iridauploader/tests_integration/integration_data_setup.py index b77b77d..5312746 100644 --- a/iridauploader/tests_integration/integration_data_setup.py +++ b/iridauploader/tests_integration/integration_data_setup.py @@ -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) +\ @@ -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 = "." @@ -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 @@ -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): @@ -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 From b481eeff252d6d624c740920bb93e6b0667f22f9 Mon Sep 17 00:00:00 2001 From: Jeffrey Thiessen Date: Wed, 6 Jul 2022 14:07:19 -0500 Subject: [PATCH 2/2] remove incorrect readme line --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 2a3ad8d..d545359 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,6 @@ Running the unittests can be done with the command: To run integration tests You will need to download and install chromedriver http://chromedriver.chromium.org/downloads -You will need Gradle installed to run IRIDA - You will need to grant the IRIDA instance access to the mysql database needed for the tests $ mysql -e "CREATE USER 'test'@'localhost' IDENTIFIED BY 'test'; GRANT ALL ON irida_uploader_test.* to 'test'@'localhost';"