From 9b5d557d54e717bfd38bf6226a3483d31760e836 Mon Sep 17 00:00:00 2001 From: Sijie Date: Tue, 2 Jan 2024 18:23:52 -0500 Subject: [PATCH 01/18] fix GHA --- .github/workflows/kb_sdk_test.yaml | 6 +++++- Makefile | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/kb_sdk_test.yaml b/.github/workflows/kb_sdk_test.yaml index 386b3452..ebb0a1bd 100644 --- a/.github/workflows/kb_sdk_test.yaml +++ b/.github/workflows/kb_sdk_test.yaml @@ -54,4 +54,8 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | sh $GITHUB_WORKSPACE/kb_sdk_actions/bin/kb-sdk test - bash <(curl -s https://codecov.io/bash) + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: true diff --git a/Makefile b/Makefile index c0867b95..80b247c3 100644 --- a/Makefile +++ b/Makefile @@ -51,15 +51,15 @@ build-test-script: echo 'export PYTHONPATH=$$script_dir/../$(LIB_DIR):$$PATH:$$PYTHONPATH' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'cd $$script_dir/../$(TEST_DIR)' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'python -m nose --with-coverage --cover-package=$(SERVICE_CAPS) --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture .' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) - echo 'cp /kb/module/.coveragerc .' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) - echo 'cp .coverage /kb/module/work/' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) - echo 'mkdir -p /kb/module/work/kb/module/lib/' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) - echo 'cp -R /kb/module/lib/$(SERVICE_CAPS)/ /kb/module/work/kb/module/lib/' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) chmod +x $(TEST_DIR)/$(TEST_SCRIPT_NAME) test: if [ ! -f /kb/module/work/token ]; then echo -e '\nOutside a docker container please run "kb-sdk test" rather than "make test"\n' && exit 1; fi bash $(SCRIPTS_DIR)/$(TEST_SCRIPT_NAME) + cp /kb/module/.coveragerc $(TEST_DIR)/. + cp $(TEST_DIR)/.coverage /kb/module/work/ + mkdir -p /kb/module/work/kb/module/lib/ + cp -R /kb/module/lib/$(SERVICE_CAPS)/ /kb/module/work/kb/module/lib/ clean: rm -rfv $(LBIN_DIR) From a7277ccbf864cfe4dedd999abb1432d2ebe4b5c2 Mon Sep 17 00:00:00 2001 From: Sijie Date: Tue, 2 Jan 2024 19:00:46 -0500 Subject: [PATCH 02/18] make GHA pass --- scripts/run_tests_within_container.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/run_tests_within_container.sh b/scripts/run_tests_within_container.sh index 74f21e85..ef404f3a 100644 --- a/scripts/run_tests_within_container.sh +++ b/scripts/run_tests_within_container.sh @@ -5,7 +5,8 @@ export KB_AUTH_TOKEN=`cat /kb/module/work/token` export PYTHONPATH=$script_dir/../lib:$PATH:$PYTHONPATH # Set TEST_PATH to run a specific test. Eg: TEST_PATH=test.core.update_taxon_assignments_test -export TEST_PATH=. +# export TEST_PATH=. +export TEST_PATH=test.core.fasta_download_test cd $script_dir/../test python -m nose --with-coverage --cover-package=GenomeFileUtil --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture $TEST_PATH From 11804d89066e0517c7962f4f0482ab5086b2a02b Mon Sep 17 00:00:00 2001 From: Sijie Date: Tue, 2 Jan 2024 19:06:59 -0500 Subject: [PATCH 03/18] run a single test --- scripts/run_tests_within_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run_tests_within_container.sh b/scripts/run_tests_within_container.sh index ef404f3a..24b0f726 100644 --- a/scripts/run_tests_within_container.sh +++ b/scripts/run_tests_within_container.sh @@ -6,7 +6,7 @@ export PYTHONPATH=$script_dir/../lib:$PATH:$PYTHONPATH # Set TEST_PATH to run a specific test. Eg: TEST_PATH=test.core.update_taxon_assignments_test # export TEST_PATH=. -export TEST_PATH=test.core.fasta_download_test +export TEST_PATH=test.core.update_taxon_assignments_test cd $script_dir/../test python -m nose --with-coverage --cover-package=GenomeFileUtil --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture $TEST_PATH From 6f375272a78889ac8cea57592a934f43515ef3e3 Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 13:21:59 -0500 Subject: [PATCH 04/18] fix cp error --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 80b247c3..37081c92 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,6 @@ build-test-script: test: if [ ! -f /kb/module/work/token ]; then echo -e '\nOutside a docker container please run "kb-sdk test" rather than "make test"\n' && exit 1; fi bash $(SCRIPTS_DIR)/$(TEST_SCRIPT_NAME) - cp /kb/module/.coveragerc $(TEST_DIR)/. cp $(TEST_DIR)/.coverage /kb/module/work/ mkdir -p /kb/module/work/kb/module/lib/ cp -R /kb/module/lib/$(SERVICE_CAPS)/ /kb/module/work/kb/module/lib/ From 92dbda4c6855ca3e659f467e598b29e6b59aa6fa Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 13:31:33 -0500 Subject: [PATCH 05/18] rm another cp error --- scripts/run_tests_within_container.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/run_tests_within_container.sh b/scripts/run_tests_within_container.sh index 24b0f726..41c05539 100644 --- a/scripts/run_tests_within_container.sh +++ b/scripts/run_tests_within_container.sh @@ -10,7 +10,6 @@ export TEST_PATH=test.core.update_taxon_assignments_test cd $script_dir/../test python -m nose --with-coverage --cover-package=GenomeFileUtil --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture $TEST_PATH -cp /kb/module/.coveragerc . cp .coverage /kb/module/work/ mkdir -p /kb/module/work/kb/module/lib/ cp -R /kb/module/lib/GenomeFileUtil/ /kb/module/work/kb/module/lib/P From 12223b37c5e7d5f3b188a51d9f6b3538a847c47f Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 13:41:31 -0500 Subject: [PATCH 06/18] clean up --- scripts/run_tests_within_container.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/run_tests_within_container.sh b/scripts/run_tests_within_container.sh index 41c05539..0813f58d 100644 --- a/scripts/run_tests_within_container.sh +++ b/scripts/run_tests_within_container.sh @@ -5,8 +5,7 @@ export KB_AUTH_TOKEN=`cat /kb/module/work/token` export PYTHONPATH=$script_dir/../lib:$PATH:$PYTHONPATH # Set TEST_PATH to run a specific test. Eg: TEST_PATH=test.core.update_taxon_assignments_test -# export TEST_PATH=. -export TEST_PATH=test.core.update_taxon_assignments_test +export TEST_PATH=. cd $script_dir/../test python -m nose --with-coverage --cover-package=GenomeFileUtil --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture $TEST_PATH From aa72b2b93244ec79f19e390b155364eca1c57f1a Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 17:26:46 -0500 Subject: [PATCH 07/18] GHA should fail --- scripts/run_tests_within_container.sh | 3 ++- test/core/update_taxon_assignments_test.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/run_tests_within_container.sh b/scripts/run_tests_within_container.sh index 0813f58d..41c05539 100644 --- a/scripts/run_tests_within_container.sh +++ b/scripts/run_tests_within_container.sh @@ -5,7 +5,8 @@ export KB_AUTH_TOKEN=`cat /kb/module/work/token` export PYTHONPATH=$script_dir/../lib:$PATH:$PYTHONPATH # Set TEST_PATH to run a specific test. Eg: TEST_PATH=test.core.update_taxon_assignments_test -export TEST_PATH=. +# export TEST_PATH=. +export TEST_PATH=test.core.update_taxon_assignments_test cd $script_dir/../test python -m nose --with-coverage --cover-package=GenomeFileUtil --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture $TEST_PATH diff --git a/test/core/update_taxon_assignments_test.py b/test/core/update_taxon_assignments_test.py index 5795c0b1..229513ac 100644 --- a/test/core/update_taxon_assignments_test.py +++ b/test/core/update_taxon_assignments_test.py @@ -93,7 +93,8 @@ def test_update_taxon_assignments_valid(self): }) # Fetch the object and check the mapping obj = self.wsClient.get_objects2({'objects': [get_obj_params]})['data'][0]['data'] - self.assertTrue(taxon_key in obj['taxon_assignments']) + # self.assertTrue(taxon_key in obj['taxon_assignments']) + self.assertTrue(taxon_key not in obj['taxon_assignments']) self.assertEqual(obj['taxon_assignments'][taxon_key], taxon_val) # Update the assignment we just added self.serviceImpl.update_taxon_assignments(self.ctx, { From 8245f2357de30308fe9bbd9576465f0ba103896f Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 18:14:03 -0500 Subject: [PATCH 08/18] add return_code --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 37081c92..87e6fe53 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,8 @@ build-test-script: echo 'export PYTHONPATH=$$script_dir/../$(LIB_DIR):$$PATH:$$PYTHONPATH' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'cd $$script_dir/../$(TEST_DIR)' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'python -m nose --with-coverage --cover-package=$(SERVICE_CAPS) --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture .' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) + echo 'returncode=$?' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) + echo 'if [ $returncode != 0 ]; then exit $returncode; fi' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) chmod +x $(TEST_DIR)/$(TEST_SCRIPT_NAME) test: From 0c5271f446588974391d0736c3348e3e5b6442b6 Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 18:22:56 -0500 Subject: [PATCH 09/18] add echo check --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 87e6fe53..009fd244 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,7 @@ build-test-script: echo 'cd $$script_dir/../$(TEST_DIR)' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'python -m nose --with-coverage --cover-package=$(SERVICE_CAPS) --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture .' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'returncode=$?' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) + echo 'echo returncode' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'if [ $returncode != 0 ]; then exit $returncode; fi' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) chmod +x $(TEST_DIR)/$(TEST_SCRIPT_NAME) From 713bd17ccbd34dc082a8fe21190301c36fa33495 Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 18:32:13 -0500 Subject: [PATCH 10/18] change to 22601 --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 009fd244..5b1cf0b7 100644 --- a/Makefile +++ b/Makefile @@ -52,8 +52,7 @@ build-test-script: echo 'cd $$script_dir/../$(TEST_DIR)' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'python -m nose --with-coverage --cover-package=$(SERVICE_CAPS) --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture .' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'returncode=$?' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) - echo 'echo returncode' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) - echo 'if [ $returncode != 0 ]; then exit $returncode; fi' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) + echo 'if [ $$returncode != 0 ]; then exit $$returncode; fi' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) chmod +x $(TEST_DIR)/$(TEST_SCRIPT_NAME) test: From 1386f502955e7375eea203d22cac79d99b331d90 Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 18:38:38 -0500 Subject: [PATCH 11/18] add cat command to help debug --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 5b1cf0b7..4395e5b3 100644 --- a/Makefile +++ b/Makefile @@ -57,6 +57,7 @@ build-test-script: test: if [ ! -f /kb/module/work/token ]; then echo -e '\nOutside a docker container please run "kb-sdk test" rather than "make test"\n' && exit 1; fi + cat $(SCRIPTS_DIR)/$(TEST_SCRIPT_NAME) bash $(SCRIPTS_DIR)/$(TEST_SCRIPT_NAME) cp $(TEST_DIR)/.coverage /kb/module/work/ mkdir -p /kb/module/work/kb/module/lib/ From 4c70d2de82ba5ccdae83b7a3784cd25531b5c76e Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 18:48:07 -0500 Subject: [PATCH 12/18] cat in test_dir --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4395e5b3..3465e80f 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ build-test-script: test: if [ ! -f /kb/module/work/token ]; then echo -e '\nOutside a docker container please run "kb-sdk test" rather than "make test"\n' && exit 1; fi - cat $(SCRIPTS_DIR)/$(TEST_SCRIPT_NAME) + cat $(TEST_DIR)/$(TEST_SCRIPT_NAME) bash $(SCRIPTS_DIR)/$(TEST_SCRIPT_NAME) cp $(TEST_DIR)/.coverage /kb/module/work/ mkdir -p /kb/module/work/kb/module/lib/ From d3ef69584fa30cfd62eff398f32015a9b1ae3f5b Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 19:03:09 -0500 Subject: [PATCH 13/18] add $ --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3465e80f..57cd18db 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ build-test-script: echo 'export PYTHONPATH=$$script_dir/../$(LIB_DIR):$$PATH:$$PYTHONPATH' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'cd $$script_dir/../$(TEST_DIR)' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'python -m nose --with-coverage --cover-package=$(SERVICE_CAPS) --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture .' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) - echo 'returncode=$?' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) + echo 'returncode=$$?' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'if [ $$returncode != 0 ]; then exit $$returncode; fi' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) chmod +x $(TEST_DIR)/$(TEST_SCRIPT_NAME) From a780c8313cc933e7e91f9d413e34b166a2653847 Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 19:09:58 -0500 Subject: [PATCH 14/18] change to test_dir --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 57cd18db..034c0ec1 100644 --- a/Makefile +++ b/Makefile @@ -51,14 +51,14 @@ build-test-script: echo 'export PYTHONPATH=$$script_dir/../$(LIB_DIR):$$PATH:$$PYTHONPATH' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'cd $$script_dir/../$(TEST_DIR)' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'python -m nose --with-coverage --cover-package=$(SERVICE_CAPS) --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture .' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) - echo 'returncode=$$?' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) - echo 'if [ $$returncode != 0 ]; then exit $$returncode; fi' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) + # echo 'returncode=$$?' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) + # echo 'if [ $$returncode != 0 ]; then exit $$returncode; fi' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) chmod +x $(TEST_DIR)/$(TEST_SCRIPT_NAME) test: if [ ! -f /kb/module/work/token ]; then echo -e '\nOutside a docker container please run "kb-sdk test" rather than "make test"\n' && exit 1; fi - cat $(TEST_DIR)/$(TEST_SCRIPT_NAME) - bash $(SCRIPTS_DIR)/$(TEST_SCRIPT_NAME) + # cat $(TEST_DIR)/$(TEST_SCRIPT_NAME) + bash $(TEST_DIR)/$(TEST_SCRIPT_NAME) cp $(TEST_DIR)/.coverage /kb/module/work/ mkdir -p /kb/module/work/kb/module/lib/ cp -R /kb/module/lib/$(SERVICE_CAPS)/ /kb/module/work/kb/module/lib/ From 67f6b19f9d5c0efa583775b8eb5922a254a77e5b Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 19:52:47 -0500 Subject: [PATCH 15/18] add exitcode logic --- Makefile | 11 ++++------- scripts/run_tests_within_container.sh | 2 ++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 034c0ec1..1d652ee9 100644 --- a/Makefile +++ b/Makefile @@ -51,17 +51,14 @@ build-test-script: echo 'export PYTHONPATH=$$script_dir/../$(LIB_DIR):$$PATH:$$PYTHONPATH' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'cd $$script_dir/../$(TEST_DIR)' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) echo 'python -m nose --with-coverage --cover-package=$(SERVICE_CAPS) --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture .' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) - # echo 'returncode=$$?' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) - # echo 'if [ $$returncode != 0 ]; then exit $$returncode; fi' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) + echo 'cp .coverage /kb/module/work/' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) + echo 'mkdir -p /kb/module/work/kb/module/lib/' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) + echo 'cp -R /kb/module/lib/$(SERVICE_CAPS)/ /kb/module/work/kb/module/lib/' >> $(TEST_DIR)/$(TEST_SCRIPT_NAME) chmod +x $(TEST_DIR)/$(TEST_SCRIPT_NAME) test: if [ ! -f /kb/module/work/token ]; then echo -e '\nOutside a docker container please run "kb-sdk test" rather than "make test"\n' && exit 1; fi - # cat $(TEST_DIR)/$(TEST_SCRIPT_NAME) - bash $(TEST_DIR)/$(TEST_SCRIPT_NAME) - cp $(TEST_DIR)/.coverage /kb/module/work/ - mkdir -p /kb/module/work/kb/module/lib/ - cp -R /kb/module/lib/$(SERVICE_CAPS)/ /kb/module/work/kb/module/lib/ + bash $(SCRIPTS_DIR)/$(TEST_SCRIPT_NAME) clean: rm -rfv $(LBIN_DIR) diff --git a/scripts/run_tests_within_container.sh b/scripts/run_tests_within_container.sh index 41c05539..41568fee 100644 --- a/scripts/run_tests_within_container.sh +++ b/scripts/run_tests_within_container.sh @@ -10,6 +10,8 @@ export TEST_PATH=test.core.update_taxon_assignments_test cd $script_dir/../test python -m nose --with-coverage --cover-package=GenomeFileUtil --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture $TEST_PATH +returncode=$? +if [ $returncode != 0 ]; then exit $returncode; fi cp .coverage /kb/module/work/ mkdir -p /kb/module/work/kb/module/lib/ cp -R /kb/module/lib/GenomeFileUtil/ /kb/module/work/kb/module/lib/P From 5022d9b4270ebc3fd3fdb0c1340125fca0b31990 Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 20:05:37 -0500 Subject: [PATCH 16/18] test run --- scripts/run_tests_within_container.sh | 1 + test/core/update_taxon_assignments_test.py | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/run_tests_within_container.sh b/scripts/run_tests_within_container.sh index 41568fee..9ec2e4f0 100644 --- a/scripts/run_tests_within_container.sh +++ b/scripts/run_tests_within_container.sh @@ -12,6 +12,7 @@ cd $script_dir/../test python -m nose --with-coverage --cover-package=GenomeFileUtil --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture $TEST_PATH returncode=$? if [ $returncode != 0 ]; then exit $returncode; fi +cp /kb/module/.coveragerc . cp .coverage /kb/module/work/ mkdir -p /kb/module/work/kb/module/lib/ cp -R /kb/module/lib/GenomeFileUtil/ /kb/module/work/kb/module/lib/P diff --git a/test/core/update_taxon_assignments_test.py b/test/core/update_taxon_assignments_test.py index 229513ac..5795c0b1 100644 --- a/test/core/update_taxon_assignments_test.py +++ b/test/core/update_taxon_assignments_test.py @@ -93,8 +93,7 @@ def test_update_taxon_assignments_valid(self): }) # Fetch the object and check the mapping obj = self.wsClient.get_objects2({'objects': [get_obj_params]})['data'][0]['data'] - # self.assertTrue(taxon_key in obj['taxon_assignments']) - self.assertTrue(taxon_key not in obj['taxon_assignments']) + self.assertTrue(taxon_key in obj['taxon_assignments']) self.assertEqual(obj['taxon_assignments'][taxon_key], taxon_val) # Update the assignment we just added self.serviceImpl.update_taxon_assignments(self.ctx, { From f9857e806482d13b6f6b1274b81f8634a8312bc6 Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 21:09:25 -0500 Subject: [PATCH 17/18] if test passes, GHA passes --- scripts/run_tests_within_container.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/run_tests_within_container.sh b/scripts/run_tests_within_container.sh index 9ec2e4f0..41568fee 100644 --- a/scripts/run_tests_within_container.sh +++ b/scripts/run_tests_within_container.sh @@ -12,7 +12,6 @@ cd $script_dir/../test python -m nose --with-coverage --cover-package=GenomeFileUtil --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture $TEST_PATH returncode=$? if [ $returncode != 0 ]; then exit $returncode; fi -cp /kb/module/.coveragerc . cp .coverage /kb/module/work/ mkdir -p /kb/module/work/kb/module/lib/ cp -R /kb/module/lib/GenomeFileUtil/ /kb/module/work/kb/module/lib/P From 9d805feeac818c22c3dac1137a434b268bcd6aa9 Mon Sep 17 00:00:00 2001 From: Sijie Date: Wed, 3 Jan 2024 21:14:25 -0500 Subject: [PATCH 18/18] if test fails, GHA fails --- scripts/run_tests_within_container.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/run_tests_within_container.sh b/scripts/run_tests_within_container.sh index 41568fee..5ce658c0 100644 --- a/scripts/run_tests_within_container.sh +++ b/scripts/run_tests_within_container.sh @@ -5,8 +5,7 @@ export KB_AUTH_TOKEN=`cat /kb/module/work/token` export PYTHONPATH=$script_dir/../lib:$PATH:$PYTHONPATH # Set TEST_PATH to run a specific test. Eg: TEST_PATH=test.core.update_taxon_assignments_test -# export TEST_PATH=. -export TEST_PATH=test.core.update_taxon_assignments_test +export TEST_PATH=. cd $script_dir/../test python -m nose --with-coverage --cover-package=GenomeFileUtil --cover-html --cover-html-dir=/kb/module/work/test_coverage --cover-xml --cover-xml-file=/kb/module/work/test_coverage/coverage.xml --nocapture --nologcapture $TEST_PATH