diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6a4109b..5985a32 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,15 +21,15 @@ jobs: fail-fast: false matrix: include: - - python-version: '3.7' + - python-version: '3.9.19' mongo-version: '3.6' - # - python-version: '3.7' - # mongo-version: '7.0.4' + - python-version: '3.9.19' + mongo-version: '7.0.4' services: mongo: image: mongo:${{matrix.mongo-version}} ports: - - 27017:27017 + - 27018:27017 options: --name mongo${{matrix.mongo-version}} steps: @@ -43,6 +43,12 @@ jobs: with: python-version: ${{matrix.python-version}} + - name: Install Docker Compose + run: | + sudo curl -L "https://github.com/docker/compose/releases/download/v2.32.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose + docker-compose --version + - name: Install dependencies and set up test config shell: bash env: @@ -52,7 +58,7 @@ jobs: run: | # test mongo connection - curl http://localhost:27017 + curl http://localhost:27018 returncode=$? if [ $returncode != 0 ]; then exit $returncode; fi @@ -77,6 +83,9 @@ jobs: sed -i "s#^nms-admin-token.*#nms-admin-token=$KBASE_CI_TOKEN#" test/test.cfg sed -i "s#^method-spec-admin-users.*#method-spec-admin-users=$ADMIN_USER#" test/test.cfg + # setup env variables in docker-compose_nms.yml file + echo "ADMIN_USER=$ADMIN_USER" >> $GITHUB_ENV + - name: Run tests shell: bash run: make test diff --git a/Makefile b/Makefile index 6be1ab4..7ce574a 100644 --- a/Makefile +++ b/Makefile @@ -103,7 +103,7 @@ setup-tests: mkdir -p $(TESTDIR)/nms rsync -av lib/biokbase/* $(TESTLIB)/biokbase/. --exclude *.bak-* rsync -av kbapi_common/lib/biokbase/* $(TESTLIB)/biokbase/. - cd narrative_method_store; make; make build-classpath-list; +# cd narrative_method_store; make; make build-classpath-list; # rsync -av narrative_method_store/lib/biokbase/* $(TESTLIB)/biokbase/. diff --git a/jars b/jars index 7a0edaf..06165dd 160000 --- a/jars +++ b/jars @@ -1 +1 @@ -Subproject commit 7a0edafa4dd508eb5f38c1d7810c91e73a0f76d7 +Subproject commit 06165dd6f6f499ae8610b775a7eef80a4794e2c8 diff --git a/narrative_method_store b/narrative_method_store index fb85ae8..6b371d3 160000 --- a/narrative_method_store +++ b/narrative_method_store @@ -1 +1 @@ -Subproject commit fb85ae8b6bea39c4834676e7cfbd2596c7bb182a +Subproject commit 6b371d3697a8eae59e2899624f5ca5091e056340 diff --git a/requirements.txt b/requirements.txt index b94e0b9..e7d24fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pymongo==3.10 +pymongo==4.7.2 docker>=3.5 gitpython pyyaml diff --git a/test/docker-compose_nms.yml b/test/docker-compose_nms.yml new file mode 100644 index 0000000..aa5cd76 --- /dev/null +++ b/test/docker-compose_nms.yml @@ -0,0 +1,47 @@ +version: '3.4' + +services: + nms: + image: ghcr.io/kbase/narrative_method_store:v0.3.12 + platform: linux/amd64 + ports: + - "7125:7125" + depends_on: ["mongo"] + environment: + # see deployment/conf/.templates for more environment variables + - method_spec_git_repo=https://github.com/kbase/narrative_method_specs_ci + - method_spec_git_repo_branch=master + - method_spec_git_repo_local_dir=narrative_method_specs_recreated_at_startup + - method_spec_git_repo_refresh_rate=2 + - method_spec_cache_size=5000 + - method_spec_temp_dir=narrative_method_store_temp + - method_spec_mongo_host=mongo:27017 + - method_spec_mongo_dbname=method_store_repo_db + - method_spec_admin_users=${ADMIN_USER} + - endpoint_host=https://ci.kbase.us + - endpoint_base=/services + - method_spec_default_tag=dev + - auth_service_url=https://ci.kbase.us/services/auth/api/legacy/KBase/Sessions/Login + - auth_service_url_allow_insecure=false + - service_port=7125 + command: + - "-wait" + - "tcp://mongo:27017" + - "-timeout" + - "120s" + - "-template" + - "/kb/deployment/conf/.templates/deployment.cfg.templ:/kb/deployment/conf/deployment.cfg" + - "-template" + - "/kb/deployment/conf/.templates/http.ini.templ:/kb/deployment/services/narrative_method_store/start.d/http.ini" + - "-template" + - "/kb/deployment/conf/.templates/server.ini.templ:/kb/deployment/services/narrative_method_store/start.d/server.ini" + - "-template" + - "/kb/deployment/conf/.templates/start_server.sh.templ:/kb/deployment/bin/start_server.sh" + - "-stdout" + - "/kb/deployment/services/narrative_method_store/logs/request.log" + - "/kb/deployment/bin/start_server.sh" + + mongo: + image: "mongo:7.0.4" + ports: + - "27017:27017" \ No newline at end of file diff --git a/test/run_tests.sh b/test/run_tests.sh index e4d84c5..a6d86ed 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -11,8 +11,7 @@ # start the test NMS endpoint echo 'Starting NMS...' export KB_DEPLOYMENT_CONFIG=test.cfg -classpath=`cat ../narrative_method_store/dist/jar.classpath.txt` -java -cp $classpath us.kbase.narrativemethodstore.NarrativeMethodStoreServer 7125 > nms/error.log 2>&1 & +docker-compose -f docker-compose_nms.yml up -d NMS_PID=$! echo 'Starting Mock Auth API...' @@ -62,5 +61,6 @@ kill -9 $NMS_PID #stop Docker containers docker stop mock-auth docker stop registry +docker-compose -f docker-compose_nms.yml down exit ${TEST_RETURN_CODE} \ No newline at end of file diff --git a/test/test.cfg.example b/test/test.cfg.example index 75e3f50..c482967 100644 --- a/test/test.cfg.example +++ b/test/test.cfg.example @@ -24,8 +24,8 @@ test-user-2 = wstester2 test-module-repo-1 = https://github.com/kbaseIncubator/catalog_test_module test-module-repo-2 = https://github.com/kbaseIncubator/catalog_test_module.git -# host where mongo lives, e.g. localhost:27017, for tests there should be not authentication required -mongodb-host = localhost:27017 +# host where mongo lives, e.g. localhost:27018, for tests there should be not authentication required +mongodb-host = localhost:27018 # docker registry host endpoint docker-registry-host = localhost:5000