Skip to content

Commit

Permalink
Merge pull request #28 from phac-nml/fix_tests_again
Browse files Browse the repository at this point in the history
Fix tests again
  • Loading branch information
deepsidhu85 authored Dec 6, 2022
2 parents ee1ba44 + 6c81752 commit 549e315
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ You will next want to make the appropriate changes with your connection informat
### MODIFY THESE ###
admin_key: d9c54f0b38b75dd6513035e4dd786a0b
galaxy_url: http://localhost:48888
galaxy_url: http://127.0.0.1:48888
####################
illumina_path: /illumina_reads
Expand All @@ -196,7 +196,7 @@ client_http_retry_delay: 30
### MODIFY THESE ###
client_secret: qlB82t7Ct917127lL7oQ82bd9o2iAP8bT0rJohpz7s
client_id: galaxy
irida_url: http://localhost:8080
irida_url: http://127.0.0.1:8080
####################
initial_endpoint_suffix: /projects
Expand Down
6 changes: 3 additions & 3 deletions irida_import/extras/apache2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}).config(function($sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
'self',
'http://localhost/**'
'http://127.0.0.1/**'
]);
}).controller('galaxyController', ['$scope', '$http', '$window', '$location','$timeout', galaxyController]);

Expand Down Expand Up @@ -73,9 +73,9 @@

sampleFilePaths = [
"http://www.dgfdg.com/sample1file1",
"file://localhost/home/jthiessen/lib_imp_dir/test/test.fastq"
"file://127.0.0.1/home/jthiessen/lib_imp_dir/test/test.fastq"
];
addSample("thisissample1'sname","http://localhost/some_IRIDA_API_path/Projects/1/Samples/1",sampleFilePaths);
addSample("thisissample1'sname","http://127.0.0.1/some_IRIDA_API_path/Projects/1/Samples/1",sampleFilePaths);
$timeout(
function(){
document.getElementById("samplesSubmit").submit();
Expand Down
2 changes: 1 addition & 1 deletion irida_import/extras/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ events {}

http {
upstream galaxy_app {
server localhost:8888;
server 127.0.0.1:8888;
}

server {
Expand Down
2 changes: 1 addition & 1 deletion irida_import/irida_import.xml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
--log-file $log_file
--history-id "$__app__.security.encode_id($output.history.id)"
]]></command>
<inputs action="http://localhost:8080/projects" check_values="False" method="post">
<inputs action="http://127.0.0.1:8080/projects" check_values="False" method="post">
<display>import data from IRIDA to Galaxy</display>
<param name="galaxyCallbackUrl" type="hidden" value="GALAXY_URL/tool_runner?tool_id=TOOL_ID&amp;runtool_btn=Execute" />
<param name="appName" type="hidden" value="Galaxy" />
Expand Down
2 changes: 1 addition & 1 deletion irida_import/sample.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"param_dict": {"__new_file_path__": "/home/jthiessen/galaxy-dist/database/tmp", "runtool_btn": "Execute", "__user_id__": "1", "output": "/home/jthiessen/galaxy-dist/database/files/000/dataset_992.dat", "GALAXY_ROOT_DIR": "/home/jthiessen/galaxy-dist", "chromInfo": "/home/jthiessen/galaxy-dist/tool-data/shared/ucsc/chrom/?.len", "__tool_data_path__": "/home/jthiessen/galaxy-dist/tool-data", "userId": "1", "userEmail": "joel.thiessen@phac-aspc.gc.ca", "dbkey": "?", "__user_name__": "jthiessen", "__datatypes_config__": "/home/jthiessen/galaxy-dist/database/tmp/tmpaNhVAp", "__app__": "galaxy.app:UniverseApplication", "__user__": "galaxy.model:User", "GALAXY_DATA_INDEX_DIR": "/home/jthiessen/galaxy-dist/tool-data", "__root_dir__": "/home/jthiessen/galaxy-dist", "__user_email__": "joel.thiessen@phac-aspc.gc.ca", "__admin_users__": "joel.thiessen@phac-aspc.gc.ca", "json_params": "{\"_embedded\":{\"library\":{\"name\":\"Project 5-fbristow\"},\"user\":{\"email\":\"franklin.bristow@phac-aspc.gc.ca\"},\"oauth2\":{\"code\":\"4DEPzF\",\"redirect\":\"/galaxy/auth_code\"},\"samples\":[{\"name\":\"01-1111\",\"_links\":{\"self\":{\"href\":\"\"}},\"_embedded\":{\"sample_files\":[{\"_links\":{\"self\":{\"href\":\"http://localhost:8080/api/projects/4/samples/51/sequenceFiles/3\"}}},{\"_links\":{\"self\":{\"href\":\"http://localhost:8080/api/projects/4/samples/51/sequenceFiles/4\"}}},{\"_links\":{\"self\":{\"href\":\"http://localhost:8080/api/projects/4/samples/51/sequenceFiles/9\"}}},{\"_links\":{\"self\":{\"href\":\"http://localhost:8080/api/projects/4/samples/51/sequenceFiles/10\"}}}]}}]}}", "__get_data_table_entry__": "<function get_data_table_entry at 0x7ffba8254b18>", "GALAXY_DATATYPES_CONF_FILE": "/home/jthiessen/galaxy-dist/database/tmp/tmpaNhVAp"}, "output_data": [{"extra_files_path": "/home/jthiessen/galaxy-dist/database/job_working_directory/000/992/dataset_992_files", "ext": "auto", "out_data_name": "output", "hda_id": 801, "file_name": "/home/jthiessen/galaxy-dist/database/files/000/dataset_992.dat", "dataset_id": 992}], "job_config": {"GALAXY_ROOT_DIR": "/home/jthiessen/galaxy-dist", "TOOL_PROVIDED_JOB_METADATA_FILE": "galaxy.json", "GALAXY_DATATYPES_CONF_FILE": "/home/jthiessen/galaxy-dist/database/tmp/tmpaNhVAp"}}
{"param_dict": {"__new_file_path__": "/home/jthiessen/galaxy-dist/database/tmp", "runtool_btn": "Execute", "__user_id__": "1", "output": "/home/jthiessen/galaxy-dist/database/files/000/dataset_992.dat", "GALAXY_ROOT_DIR": "/home/jthiessen/galaxy-dist", "chromInfo": "/home/jthiessen/galaxy-dist/tool-data/shared/ucsc/chrom/?.len", "__tool_data_path__": "/home/jthiessen/galaxy-dist/tool-data", "userId": "1", "userEmail": "joel.thiessen@phac-aspc.gc.ca", "dbkey": "?", "__user_name__": "jthiessen", "__datatypes_config__": "/home/jthiessen/galaxy-dist/database/tmp/tmpaNhVAp", "__app__": "galaxy.app:UniverseApplication", "__user__": "galaxy.model:User", "GALAXY_DATA_INDEX_DIR": "/home/jthiessen/galaxy-dist/tool-data", "__root_dir__": "/home/jthiessen/galaxy-dist", "__user_email__": "joel.thiessen@phac-aspc.gc.ca", "__admin_users__": "joel.thiessen@phac-aspc.gc.ca", "json_params": "{\"_embedded\":{\"library\":{\"name\":\"Project 5-fbristow\"},\"user\":{\"email\":\"franklin.bristow@phac-aspc.gc.ca\"},\"oauth2\":{\"code\":\"4DEPzF\",\"redirect\":\"/galaxy/auth_code\"},\"samples\":[{\"name\":\"01-1111\",\"_links\":{\"self\":{\"href\":\"\"}},\"_embedded\":{\"sample_files\":[{\"_links\":{\"self\":{\"href\":\"http://127.0.0.1:8080/api/projects/4/samples/51/sequenceFiles/3\"}}},{\"_links\":{\"self\":{\"href\":\"http://127.0.0.1:8080/api/projects/4/samples/51/sequenceFiles/4\"}}},{\"_links\":{\"self\":{\"href\":\"http://127.0.0.1:8080/api/projects/4/samples/51/sequenceFiles/9\"}}},{\"_links\":{\"self\":{\"href\":\"http://127.0.0.1:8080/api/projects/4/samples/51/sequenceFiles/10\"}}}]}}]}}", "__get_data_table_entry__": "<function get_data_table_entry at 0x7ffba8254b18>", "GALAXY_DATATYPES_CONF_FILE": "/home/jthiessen/galaxy-dist/database/tmp/tmpaNhVAp"}, "output_data": [{"extra_files_path": "/home/jthiessen/galaxy-dist/database/job_working_directory/000/992/dataset_992_files", "ext": "auto", "out_data_name": "output", "hda_id": 801, "file_name": "/home/jthiessen/galaxy-dist/database/files/000/dataset_992.dat", "dataset_id": 992}], "job_config": {"GALAXY_ROOT_DIR": "/home/jthiessen/galaxy-dist", "TOOL_PROVIDED_JOB_METADATA_FILE": "galaxy.json", "GALAXY_DATATYPES_CONF_FILE": "/home/jthiessen/galaxy-dist/database/tmp/tmpaNhVAp"}}
7 changes: 4 additions & 3 deletions irida_import/tests/integration/bash_scripts/install_galaxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pushd /tmp/repos
echo "Downloading Galaxy..."
git clone https://github.com/galaxyproject/galaxy/ > galaxy-clone.log 2>&1
pushd galaxy
git checkout master > galaxy-checkout.log 2>&1
git checkout v22.01 > galaxy-checkout.log 2>&1
git fetch
git reset --hard
git clean -fd
Expand Down Expand Up @@ -40,7 +40,7 @@ echo " database_connection: postgresql:///galaxy_test" | cat >> galaxy.yml
sed -i 's/#admin_users:.*/admin_users: "irida@irida.ca"/' galaxy.yml

# run galaxy on port 8888 instead of 8080; Tomcat runs on 8080 by default.
sed -i "s|# bind: localhost:8080|bind: localhost:$galaxy_port|" galaxy.yml
sed -i "s|# bind: localhost:8080|bind: 127.0.0.1:$galaxy_port|" galaxy.yml

popd
popd
Expand All @@ -54,7 +54,8 @@ echo "Initializing the tool's configuration file."
pushd galaxy/tools/irida-galaxy-importer/
cp irida_import/config.ini.sample irida_import/config.ini
sed -i "s/^max_waits: .*$/max_waits: 1/" irida_import/config.ini
sed -i "s|^galaxy_url: http://localhost:8888$|galaxy_url: http://localhost:$galaxy_port|" irida_import/config.ini
sed -i "s|^galaxy_url: http://localhost:8888$|galaxy_url: http://127.0.0.1:$galaxy_port|" irida_import/config.ini
sed -i "s|^irida_url: http://localhost:8080$|irida_url: http://127.0.0.1:8080|" irida_import/config.ini

echo "Configuring the tool's XML file"
python -m irida_import.main --generate_xml
Expand Down
2 changes: 1 addition & 1 deletion irida_import/tests/integration/create_client.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ INSERT INTO client_details_grant_types (client_details_id,grant_value) VALUES (1
INSERT INTO client_details_scope (client_details_id,scope) VALUES (1,"read");
INSERT INTO client_details_scope (client_details_id,scope) VALUES (1,"write");
-- galaxy auth connection
INSERT INTO client_details (id,clientId,clientSecret,token_validity,refresh_validity,createdDate,modifiedDate,redirect_uri) VALUES (2,"auth_code_client","auth_code_secret",100000,2592000,now(),now(),"http://localhost:8080/galaxy/auth_code");
INSERT INTO client_details (id,clientId,clientSecret,token_validity,refresh_validity,createdDate,modifiedDate,redirect_uri) VALUES (2,"auth_code_client","auth_code_secret",100000,2592000,now(),now(),"http://127.0.0.1:8080/galaxy/auth_code");
INSERT INTO client_details_grant_types (client_details_id,grant_value) VALUES (2,"authorization_code");
INSERT INTO client_details_scope (client_details_id,scope) VALUES (2,"read");

Expand Down
4 changes: 2 additions & 2 deletions irida_import/tests/integration/galaxy_data_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, repo_dir, email, chrome_driver_path, chrome_driver_options):
'tools', 'irida-galaxy-importer', 'irida_import',
'config.ini')
self.INSTALL_EXEC = 'install_galaxy.sh'
self.GALAXY_DOMAIN = 'localhost'
self.GALAXY_DOMAIN = '127.0.0.1'
self.GALAXY_PORT = 8888
self.GALAXY_URL = 'http://' + self.GALAXY_DOMAIN + ':' + str(
self.GALAXY_PORT)
Expand Down Expand Up @@ -113,7 +113,7 @@ def _wait_until_up(self, address, port, timeout):
Wait until a port at an address is occupied, or time out
:type address: str
:param address: e.g. 'localhost' or '127.0.0.1'
:param address: e.g. '127.0.0.1'
:type port: int
:param port: e.g. 8888
:type timeout: int
Expand Down
1 change: 1 addition & 0 deletions irida_import/tests/integration/irida_data_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(self, base_url, user, password, branch, db_host, db_port, repo_dir)
'--spring.datasource.url={} '.format(self.DB_JDBC_URL) +\
'--spring.datasource.username={} '.format(self.DB_USERNAME) +\
'--spring.datasource.password={} '.format(self.DB_PASSWORD) +\
'--server.base.url=http://127.0.0.1:8080 ' +\
'--liquibase.update.database.schema=true ' +\
'--spring.jpa.hibernate.ddl-auto= ' +\
'--spring.jpa.properties.hibernate.hbm2ddl.import_files= ' +\
Expand Down
1 change: 0 additions & 1 deletion irida_import/tests/integration/test_irida_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ def _create_temp_file(file_name, file_contents):

seq3 = _create_temp_file("seq3.fastq", fastq_contents)
self.irida_session.post(sequences2, files={'file': open(seq3, 'rb')})

# Export to Galaxy using the button on the dropdown menu
self.driver.get(tests_integration.galaxy_url)
history_panel = self.driver.find_element_by_id('current-history-panel')
Expand Down
6 changes: 3 additions & 3 deletions irida_import/tests/integration/tests_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
from os import path

from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.core.utils import ChromeType
from selenium.webdriver.chrome.options import Options as ChromeDriverOptions

from irida_import.tests.integration.irida_data_setup import SetupIridaData
from irida_import.tests.integration.galaxy_data_setup import SetupGalaxyData
from irida_import.tests.integration.test_irida_importer import IridaImporterTestSuite

# Modules level variables that can/will be changed when the setup starts
irida_base_url = "http://localhost:8080/api/"
irida_base_url = "http://127.0.0.1:8080/api/"
username = "jeff"
password = "password1"
client_id = "myClient"
Expand All @@ -26,7 +25,7 @@
repo_path = path.join('/tmp', 'repos')

# Have ChromeDriverManager handle chrome installation and driver for compatibility with github actions
chrome_driver_path = ChromeDriverManager(chrome_type=ChromeType.CHROMIUM).install()
chrome_driver_path = ChromeDriverManager().install()
chrome_driver_options = ChromeDriverOptions()
# When creating new tests, these can be commented out to have driver window display
chrome_driver_options.add_argument('--headless')
Expand Down Expand Up @@ -125,6 +124,7 @@ def start(irida_branch="master", db_host="localhost", db_port="3306"):
galaxy_handler.configure_galaxy_api_key()
galaxy_handler.configure_irida_galaxy_connection(galaxy_url)

# import pdb;pdb.set_trace()
# Run tests
full_suite = create_test_suite()

Expand Down
2 changes: 1 addition & 1 deletion irida_import/tests/unit/data/test.dat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"param_dict": {"__new_file_path__": "/home/jthiessen/galaxy-dist/database/tmp", "runtool_btn": "Execute", "__user_id__": "1", "output": "/home/jthiessen/galaxy-dist/database/files/000/dataset_992.dat", "GALAXY_ROOT_DIR": "/home/jthiessen/galaxy-dist", "chromInfo": "/home/jthiessen/galaxy-dist/tool-data/shared/ucsc/chrom/?.len", "__tool_data_path__": "/home/jthiessen/galaxy-dist/tool-data", "userId": "1", "userEmail": "joel.thiessen@phac-aspc.gc.ca", "dbkey": "?", "__user_name__": "jthiessen", "__datatypes_config__": "/home/jthiessen/galaxy-dist/database/tmp/tmpaNhVAp", "__app__": "galaxy.app:UniverseApplication", "__user__": "galaxy.model:User", "GALAXY_DATA_INDEX_DIR": "/home/jthiessen/galaxy-dist/tool-data", "__root_dir__": "/home/jthiessen/galaxy-dist", "__user_email__": "joel.thiessen@phac-aspc.gc.ca", "__admin_users__": "joel.thiessen@phac-aspc.gc.ca", "json_params": "{\"_embedded\":{\"library\":{\"name\":\"Project 5-fbristow\"},\"user\":{\"email\":\"franklin.bristow@phac-aspc.gc.ca\"},\"addtohistory\":true,\"includeAssemblies\":false,\"makepairedcollection\":true,\"oauth2\":{\"code\":\"4DEPzF\",\"redirect\":\"/galaxy/auth_code\"},\"samples\":[{\"name\":\"01-1111\",\"_links\":{\"self\":{\"href\":\"\"}},\"_embedded\":{\"sample_files\":[{\"_links\":{\"self\":{\"href\":\"http://localhost:8080/api/projects/4/samples/51/sequenceFiles/3\"}}},{\"_links\":{\"self\":{\"href\":\"http://localhost:8080/api/projects/4/samples/51/sequenceFiles/4\"}}},{\"_links\":{\"self\":{\"href\":\"http://localhost:8080/api/projects/4/samples/51/sequenceFiles/9\"}}},{\"_links\":{\"self\":{\"href\":\"http://localhost:8080/api/projects/4/samples/51/sequenceFiles/10\"}}}]}}]}}", "__get_data_table_entry__": "<function get_data_table_entry at 0x7ffba8254b18>", "GALAXY_DATATYPES_CONF_FILE": "/home/jthiessen/galaxy-dist/database/tmp/tmpaNhVAp"}, "output_data": [{"extra_files_path": "/home/jthiessen/galaxy-dist/database/job_working_directory/000/992/dataset_992_files", "ext": "auto", "out_data_name": "output", "hda_id": 801, "file_name": "/home/jthiessen/galaxy-dist/database/files/000/dataset_992.dat", "dataset_id": 992}], "job_config": {"GALAXY_ROOT_DIR": "/home/jthiessen/galaxy-dist", "TOOL_PROVIDED_JOB_METADATA_FILE": "galaxy.json", "GALAXY_DATATYPES_CONF_FILE": "/home/jthiessen/galaxy-dist/database/tmp/tmpaNhVAp"}}
{"param_dict": {"__new_file_path__": "/home/jthiessen/galaxy-dist/database/tmp", "runtool_btn": "Execute", "__user_id__": "1", "output": "/home/jthiessen/galaxy-dist/database/files/000/dataset_992.dat", "GALAXY_ROOT_DIR": "/home/jthiessen/galaxy-dist", "chromInfo": "/home/jthiessen/galaxy-dist/tool-data/shared/ucsc/chrom/?.len", "__tool_data_path__": "/home/jthiessen/galaxy-dist/tool-data", "userId": "1", "userEmail": "joel.thiessen@phac-aspc.gc.ca", "dbkey": "?", "__user_name__": "jthiessen", "__datatypes_config__": "/home/jthiessen/galaxy-dist/database/tmp/tmpaNhVAp", "__app__": "galaxy.app:UniverseApplication", "__user__": "galaxy.model:User", "GALAXY_DATA_INDEX_DIR": "/home/jthiessen/galaxy-dist/tool-data", "__root_dir__": "/home/jthiessen/galaxy-dist", "__user_email__": "joel.thiessen@phac-aspc.gc.ca", "__admin_users__": "joel.thiessen@phac-aspc.gc.ca", "json_params": "{\"_embedded\":{\"library\":{\"name\":\"Project 5-fbristow\"},\"user\":{\"email\":\"franklin.bristow@phac-aspc.gc.ca\"},\"addtohistory\":true,\"includeAssemblies\":false,\"makepairedcollection\":true,\"oauth2\":{\"code\":\"4DEPzF\",\"redirect\":\"/galaxy/auth_code\"},\"samples\":[{\"name\":\"01-1111\",\"_links\":{\"self\":{\"href\":\"\"}},\"_embedded\":{\"sample_files\":[{\"_links\":{\"self\":{\"href\":\"http://127.0.0.1:8080/api/projects/4/samples/51/sequenceFiles/3\"}}},{\"_links\":{\"self\":{\"href\":\"http://127.0.0.1:8080/api/projects/4/samples/51/sequenceFiles/4\"}}},{\"_links\":{\"self\":{\"href\":\"http://127.0.0.1:8080/api/projects/4/samples/51/sequenceFiles/9\"}}},{\"_links\":{\"self\":{\"href\":\"http://127.0.0.1:8080/api/projects/4/samples/51/sequenceFiles/10\"}}}]}}]}}", "__get_data_table_entry__": "<function get_data_table_entry at 0x7ffba8254b18>", "GALAXY_DATATYPES_CONF_FILE": "/home/jthiessen/galaxy-dist/database/tmp/tmpaNhVAp"}, "output_data": [{"extra_files_path": "/home/jthiessen/galaxy-dist/database/job_working_directory/000/992/dataset_992_files", "ext": "auto", "out_data_name": "output", "hda_id": 801, "file_name": "/home/jthiessen/galaxy-dist/database/files/000/dataset_992.dat", "dataset_id": 992}], "job_config": {"GALAXY_ROOT_DIR": "/home/jthiessen/galaxy-dist", "TOOL_PROVIDED_JOB_METADATA_FILE": "galaxy.json", "GALAXY_DATATYPES_CONF_FILE": "/home/jthiessen/galaxy-dist/database/tmp/tmpaNhVAp"}}
4 changes: 2 additions & 2 deletions irida_import/tests/unit/test_irida_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class MockConfig:
def __init__(self):
self.ADMIN_KEY = "09008eb345c9d5a166b0d8f301b1e72c"
self.GALAXY_URL = "http://localhost:8888/"
self.GALAXY_URL = "http://127.0.0.1:8888/"
self.ILLUMINA_PATH = '/illumina_reads'
self.REFERENCE_PATH = '/references'
self.MAX_WAITS = 1
Expand All @@ -30,7 +30,7 @@ def __init__(self):
self.CLIENT_RETRY_DELAY = 30
self.CLIENT_ID = 'webClient'
self.CLIENT_SECRET = 'webClientSecret'
self.TOKEN_ENDPOINT = 'http://localhost:8080/api/oauth/token'
self.TOKEN_ENDPOINT = 'http://127.0.0.1:8080/api/oauth/token'


class TestIridaImport:
Expand Down

0 comments on commit 549e315

Please sign in to comment.