Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor how we determine TEST_LIGHTSPEED_URL #1251

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
10 changes: 2 additions & 8 deletions tools/coverage-all.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
#!/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
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"
10 changes: 2 additions & 8 deletions tools/run-ui-test-with-mock-lightspeed-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@ 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
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}"