From 9b264891a595ea3d9f13bb7fb4cdf146ccb5418e Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Thu, 18 Apr 2024 11:36:40 +0100 Subject: [PATCH] Refactor how we determine TEST_LIGHTSPEED_URL --- package.json | 6 +++--- tools/coverage-all.sh | 10 ++-------- tools/run-ui-test-with-mock-lightspeed-server.sh | 10 ++-------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 0b11d6ba8..807124716 100644 --- a/package.json +++ b/package.json @@ -1025,12 +1025,12 @@ "_test-ui": "extest get-vscode -c ${CODE_VERSION} -s out/test-resources && extest get-chromedriver -c ${CODE_VERSION} -s out/test-resources && extest install-vsix -f ansible-*.vsix -e out/ext -s out/test-resources && extest install-from-marketplace redhat.vscode-yaml ms-python.python -e out/ext -s out/test-resources && extest run-tests -s out/test-resources -e out/ext --code_settings test/testFixtures/settings.json out/client/test/ui-test/allTestsSuite.js", "test-ui-current": "CODE_VERSION='max' yarn _test-ui", "test-ui-oldest": "CODE_VERSION='min' yarn _test-ui", - "test-ui-with-mock-lightspeed-server": "TEST_LIGHTSPEED_URL='http://127.0.0.1:3000' ./tools/run-ui-test-with-mock-lightspeed-server.sh", + "test-ui-with-mock-lightspeed-server": "./tools/run-ui-test-with-mock-lightspeed-server.sh", "_coverage-ui": "extest get-vscode -c ${CODE_VERSION} -s out/test-resources && extest get-chromedriver -c ${CODE_VERSION} -s out/test-resources && extest install-from-marketplace redhat.vscode-yaml ms-python.python -e out/ext -s out/test-resources && extest run-tests --coverage -s out/test-resources -e out/ext --code_settings test/testFixtures/settings.json out/client/test/ui-test/allTestsSuite.js", "coverage-ui-current": "COVERAGE=1 CODE_VERSION='max' yarn _coverage-ui", "coverage-ui-oldest": "COVERAGE=1 CODE_VERSION='min' yarn _coverage-ui", "_coverage-ui-with-mock-lightspeed-server": "./tools/run-ui-test-with-mock-lightspeed-server.sh --coverage", - "coverage-ui-with-mock-lightspeed-server": "TEST_LIGHTSPEED_URL='http://127.0.0.1:3000' yarn _coverage-ui-with-mock-lightspeed-server", + "coverage-ui-with-mock-lightspeed-server": "yarn _coverage-ui-with-mock-lightspeed-server", "vscode-prepublish": "yarn run webpack", "watch": "tsc -b -w", "watch-server": "tsc -p ../ansible-language-server --outDir out/server -w", @@ -1044,7 +1044,7 @@ "mock-lightspeed-server": "DEBUG='express:*' node ./out/client/test/mockLightspeedServer/server.js >>out/log/express.log 2>&1", "kill-mock-lightspeed-server": "pkill -f mockLightspeedServer/server.js", "_coverage-all": "./tools/coverage-all.sh", - "coverage-all": "TEST_LIGHTSPEED_URL='http://127.0.0.1:3000' yarn _coverage-all", + "coverage-all": "yarn _coverage-all", "als-compile": "yarn workspace @ansible/ansible-language-server compile" }, "version": "0.0.0", diff --git a/tools/coverage-all.sh b/tools/coverage-all.sh index 07d61d8b3..f3f00877a 100755 --- a/tools/coverage-all.sh +++ b/tools/coverage-all.sh @@ -1,11 +1,5 @@ #!/bin/bash -# If TEST_LIGHTSPEED_URL is not defined, set a URL with the ipv6 callback hostname, -# which is available in the GitHub Actions Linux environment. -if [[ -z "${TEST_LIGHTSPEED_URL}" ]]; then - TEST_LIGHTSPEED_URL="http://ip6-localhost:3000" -fi - # Create log dir for express.log if [ ! -d out/log ]; then mkdir out/log @@ -13,6 +7,6 @@ fi # Start the mock Lightspeed server and run e2e tests with code coverage enabled. npx start-server-and-test \ - "TEST_LIGHTSPEED_URL=${TEST_LIGHTSPEED_URL} yarn mock-lightspeed-server" \ + "yarn mock-lightspeed-server" \ "${TEST_LIGHTSPEED_URL}" \ - "TEST_LIGHTSPEED_ACCESS_TOKEN=dummy TEST_LIGHTSPEED_URL=${TEST_LIGHTSPEED_URL} yarn coverage-e2e" + "TEST_LIGHTSPEED_ACCESS_TOKEN=dummy yarn coverage-e2e" diff --git a/tools/run-ui-test-with-mock-lightspeed-server.sh b/tools/run-ui-test-with-mock-lightspeed-server.sh index b5e023d31..3b5ccaa4a 100755 --- a/tools/run-ui-test-with-mock-lightspeed-server.sh +++ b/tools/run-ui-test-with-mock-lightspeed-server.sh @@ -6,12 +6,6 @@ else TEST_SCRIPT=test-ui-current fi -# If TEST_LIGHTSPEED_URL is not defined, set a URL with the ipv6 callback hostname, -# which is available in the GitHub Actions Linux environment. -if [[ -z "${TEST_LIGHTSPEED_URL}" ]]; then - TEST_LIGHTSPEED_URL="http://ip6-localhost:3000" -fi - # Create log dir for express.log if [ ! -d out/log ]; then mkdir out/log @@ -19,6 +13,6 @@ fi # Start the mock Lightspeed server and run UI tests with the new VS Code npx start-server-and-test \ - "TEST_LIGHTSPEED_URL=${TEST_LIGHTSPEED_URL} yarn mock-lightspeed-server --ui-test"\ + "yarn mock-lightspeed-server --ui-test" \ "${TEST_LIGHTSPEED_URL}" \ - "TEST_LIGHTSPEED_ACCESS_TOKEN=dummy TEST_LIGHTSPEED_URL=${TEST_LIGHTSPEED_URL} yarn ${TEST_SCRIPT}" + "TEST_LIGHTSPEED_ACCESS_TOKEN=dummy yarn ${TEST_SCRIPT}"