mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:31:43 +00:00
Another step towards https://github.com/sourcegraph/sourcegraph/issues/59155, previously `bazel test //...` would error at analysis time on `//client/web/src/end-to-end:e2e` due to it attempting to perform variable substitution for env vars e.g. `"HEADLESS": "$(E2E_HEADLESS)"`, for values not defined via `--define` (we only set these explicitly in .aspect/bazelrc/ci.sourcegraph.bazelrc and some `sg` targets). By leveraging https://bazel.build/rules/lib/builtins/actions#run.use_default_shell_env, we can allow the test to read values from `--action_env` while _also_ having explicit values set via `env` macro parameter. Previously, setting `env` macro parameter would completely shadow any `--action_env` values. Unfortunately, we cant use `--test_env` for this, as `js_run_binary` is an action not a test (or something like that?). We also cant do env renaming anymore, meaning we have to drop the `E2E_` prefix for some env vars. At least one script needed some reworking to accommodate that `e2e_test.sh`  ## Test plan 👁️ CI once again 👁️
36 lines
871 B
Bash
Executable File
36 lines
871 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
source ./testing/tools/integration_runner.sh || exit 1
|
|
|
|
tarball="$1"
|
|
image_name="$2"
|
|
e2e_test="$3"
|
|
mocha_config="$4"
|
|
files="$5"
|
|
|
|
E2E_SOURCEGRAPH_BASE_URL="$SOURCEGRAPH_BASE_URL"
|
|
|
|
url="http://localhost:$PORT"
|
|
|
|
SOURCEGRAPH_BASE_URL="$url"
|
|
export SOURCEGRAPH_BASE_URL
|
|
|
|
# Backend integration tests uses a specific GITHUB_TOKEN that is available as GHE_GITHUB_TOKEN
|
|
# because it refers to our internal GitHub enterprise instance used for testing.
|
|
GITHUB_TOKEN="$GHE_GITHUB_TOKEN"
|
|
export GITHUB_TOKEN
|
|
|
|
ALLOW_SINGLE_DOCKER_CODE_INSIGHTS="true"
|
|
export ALLOW_SINGLE_DOCKER_CODE_INSIGHTS
|
|
|
|
run_server_image "$tarball" "$image_name" "$url" "$PORT"
|
|
|
|
SOURCEGRAPH_BASE_URL="$E2E_SOURCEGRAPH_BASE_URL"
|
|
export SOURCEGRAPH_BASE_URL
|
|
|
|
echo "--- e2e test //client/web/src/end-to-end:e2e"
|
|
"$e2e_test" --config "$mocha_config" --retries 4 "$files"
|
|
|
|
echo "--- done"
|