Skip to content

Commit 6c204a9

Browse files
committed
devtools,tests/api: add set up with docker
tests/api/run.sh is added, which runs the symbol history comparison script in docker. For golang/go#37102 Change-Id: I11d7f3a61277d6756308f854a78504c3b63ac4fd Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/339395 Trust: Julie Qiu <[email protected]> Run-TryBot: Julie Qiu <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]>
1 parent 8f5e1ac commit 6c204a9

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

devtools/docker/compose.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ x-go-variables: &go-variables
1313
GOMODCACHE: /gomodcache
1414
GO_DISCOVERY_CONFIG_DYNAMIC:
1515
GO_DISCOVERY_LOG_LEVEL: ${GO_DISCOVERY_LOG_LEVEL:-info}
16+
GO_DISCOVERY_SERVE_STATS: "true"
1617

1718
services:
1819
allbash:
@@ -41,6 +42,18 @@ services:
4142
volumes:
4243
- ../../:/pkgsite
4344
working_dir: /pkgsite
45+
api:
46+
image: golang:1.15.5
47+
depends_on:
48+
- frontend
49+
environment:
50+
<<: *go-variables
51+
WAITFORIT_TIMEOUT: 300
52+
entrypoint: ./third_party/wait-for-it/wait-for-it.sh frontend:8080 -- go run
53+
command: "tests/api/main.go -frontend http://host.docker.internal:8080 -all compare "
54+
volumes:
55+
- ../../:/pkgsite
56+
working_dir: /pkgsite
4457
e2e:
4558
image: node:14.17.0
4659
depends_on:

tests/api/config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
experiments:
2+
- Name: symbol-history-main-page
3+
Rollout: 100
4+
- Name: symbol-history-versions-page
5+
Rollout: 100

tests/api/run.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2021 The Go Authors. All rights reserved.
4+
# Use of this source code is governed by a BSD-style
5+
# license that can be found in the LICENSE file.
6+
7+
source devtools/docker.sh || { echo "Are you at repo root?"; exit 1; }
8+
9+
set -e
10+
11+
main() {
12+
trap docker_cleanup EXIT
13+
trap docker_error ERR
14+
15+
export GO_DISCOVERY_DATABASE_NAME=discovery_api_test
16+
export GO_DISCOVERY_CONFIG_DYNAMIC=tests/api/config.yaml
17+
export GO_DISCOVERY_SEED_DB_FILE=tests/api/seed.txt
18+
dockercompose build && dockercompose run seeddb && dockercompose run api
19+
20+
local status=$?
21+
if [ $status -eq 0 ]
22+
then
23+
echo "Done!"
24+
else
25+
echo "API tests failed."
26+
fi
27+
exit $status
28+
}
29+
30+
main $@

tests/api/seed.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2021 The Go Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style
3+
# license that can be found in the LICENSE file.
4+
5+
rsc.io/quote@all

0 commit comments

Comments
 (0)