cmd/golangorg: fix, restore tip.golang.org tests

The golang.org health check was failing the tip.golang.org tests
because the host enforcer was redirecting an unknown subdomain
to golang.org. Make tip a known subdomain to fix the tests, and
then restore them.

(The standard tip.golang.org setup disables the enforcer instead.)

Change-Id: Id15e7bcb3a704b7782e132c4303576f9d3e80cb0
Reviewed-on: https://go-review.googlesource.com/c/website/+/334112
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
This commit is contained in:
Russ Cox 2021-07-12 15:41:20 -04:00
Родитель e8cce616b8
Коммит 29745a29f8
2 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -224,6 +224,7 @@ func fmtHandler(w http.ResponseWriter, r *http.Request) {
var validHosts = map[string]bool{
"golang.org": true,
"golang.google.cn": true,
"tip.golang.org": true,
}
// hostEnforcerHandler redirects http://foo.golang.org/bar to https://golang.org/bar.

6
cmd/golangorg/testdata/web.txt поставляемый
Просмотреть файл

@ -98,6 +98,9 @@ redirect == /pkg/
GET https://golang.org/pkg/
redirect == https://pkg.go.dev/std
GET https://tip.golang.org/pkg/
redirect == https://pkg.go.dev/std@master
GET https://golang.org/pkg?m=old
redirect == /pkg/?m=old
@ -119,6 +122,9 @@ redirect == https://pkg.go.dev/bufio
GET https://golang.org/pkg/bufio/?GOOS=windows&GOARCH=amd64
redirect == https://pkg.go.dev/bufio?GOOS=windows&GOARCH=amd64
GET https://tip.golang.org/pkg/bufio/
redirect == https://pkg.go.dev/bufio@master
GET https://golang.org/pkg/bufio/?m=old
body contains href="/pkg/io/?m=old#Writer
body !contains href="/pkg/io/#Writer