forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodeintel_integration_test.sh
executable file
·64 lines (45 loc) · 1.89 KB
/
codeintel_integration_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
set -eu
source ./testing/tools/integration_runner.sh || exit 1
if [ "$(uname)" = "Darwin" ] && [ "$__LOCAL__" != "true" ]; then
echo -e "⚠️ It seems you're running this test target on a MacOs machine.\n👉 This target only works in CI, and you should instead use //testing:codeintel_integration_test_local."
exit 1
fi
if [ "$__LOCAL__" = "true" ] && [ "${GOOGLE_APPLICATION_CREDENTIALS:-}" = "" ]; then
echo -e "⚠️ This targets requires \$GOOGLE_APPLICATION_CREDENTIALS to be set to where your gcloud creds are stored. Usually, this is \$HOME/.config/gcloud/application_default_credentials.json."
echo -e "👉 Set this var with\n\texport GOOGLE_APPLICATION_CREDENTIALS=\$HOME/.config/gcloud/application_default_credentials.json\nand run this target again."
exit 1
fi
tarball="$1"
image_name="$2"
init_sg="$3"
src_cli="$4"
cmd_download="$5"
cmd_clear="$6"
cmd_upload="$7"
cmd_query="$8"
testdata_repos="$9"
url="http://localhost:$PORT"
SOURCEGRAPH_BASE_URL="$url"
export SOURCEGRAPH_BASE_URL
ALLOW_SINGLE_DOCKER_CODE_INSIGHTS="true"
export ALLOW_SINGLE_DOCKER_CODE_INSIGHTS
run_server_image "$tarball" "$image_name" "$url" "$PORT"
echo '--- Initializing instance'
"$init_sg" initSG -sg_envrc="./sg_envrc"
# shellcheck disable=SC1091
source ./sg_envrc
echo '--- :horse: Running init-sg addRepos'
"$init_sg" addRepos -config "$testdata_repos"
echo '--- :brain: Running the test suite'
echo '--- :zero: downloading test data from GCS'
"$cmd_download"
echo '--- :one: clearing existing state'
"$cmd_clear"
# src-cli must be in the PATH for upload to find it.
echo '--- :two: integration test
./dev/codeintel-qa/cmd/upload'
"$cmd_upload" --timeout=5m --index-dir="./dev/codeintel-qa/testdata/indexes" --src-path="$(rlocation "$src_cli")"
echo '--- :three: integration test ./dev/codeintel-qa/cmd/query'
"$cmd_query" --index-dir="./dev/codeintel-qa/testdata/indexes"
echo "--- done"