Update used Go version to 1.3.

Go downloads moved to a different URL and require following redirects
(curl's '-L' option) now.

Go 1.3 deliberately randomizes ranges over maps, which uncovered some
bugs in our tests. These are fixed too.

Change-Id: Id2d9e185d8d2379a9b7b8ad5ba680024565d15f4
This commit is contained in:
Julius Volz 2014-08-05 20:56:05 +02:00 committed by Bjoern Rabenstein
parent 85497e3f38
commit c6e9f085a3
4 changed files with 14 additions and 12 deletions

View file

@ -49,7 +49,7 @@ tag:
git push --tags git push --tags
$(BUILD_PATH)/cache/$(GOPKG): $(BUILD_PATH)/cache/$(GOPKG):
curl -o $@ $(GOURL)/$(GOPKG) curl -o $@ -L $(GOURL)/$(GOPKG)
benchmark: test benchmark: test
$(GO) test $(GO_TEST_FLAGS) -test.bench='Benchmark' ./... $(GO) test $(GO_TEST_FLAGS) -test.bench='Benchmark' ./...

View file

@ -34,7 +34,7 @@ MAC_OS_X_VERSION ?= 10.8
BUILD_PATH = $(PWD)/.build BUILD_PATH = $(PWD)/.build
GO_VERSION := 1.2.1 GO_VERSION := 1.3
GOOS = $(subst Darwin,darwin,$(subst Linux,linux,$(OS))) GOOS = $(subst Darwin,darwin,$(subst Linux,linux,$(OS)))
ifeq ($(GOOS),darwin) ifeq ($(GOOS),darwin)
@ -45,7 +45,7 @@ endif
GOARCH = $(subst x86_64,amd64,$(ARCH)) GOARCH = $(subst x86_64,amd64,$(ARCH))
GOPKG ?= go$(GO_VERSION).$(GOOS)-$(GOARCH)$(RELEASE_SUFFIX).tar.gz GOPKG ?= go$(GO_VERSION).$(GOOS)-$(GOARCH)$(RELEASE_SUFFIX).tar.gz
GOURL ?= http://go.googlecode.com/files GOURL ?= http://golang.org/dl
GOROOT = $(BUILD_PATH)/root/go GOROOT = $(BUILD_PATH)/root/go
GOPATH = $(BUILD_PATH)/root/gopath GOPATH = $(BUILD_PATH)/root/gopath
GOCC = $(GOROOT)/bin/go GOCC = $(GOROOT)/bin/go

View file

@ -189,8 +189,15 @@ func GetLabelValuesForLabelNameTests(p metric.Persistence, t testing.TB) {
t.Fatalf("Number of values don't match for label %s: got %d; want %d", name, len(actual), len(expected)) t.Fatalf("Number of values don't match for label %s: got %d; want %d", name, len(actual), len(expected))
} }
for i := range expected { for i := range expected {
if actual[i] != expected[i] { inActual := false
t.Fatalf("%d. Got %s; want %s", i, actual[i], expected[i]) for _, a := range actual {
if expected[i] == a {
inActual = true
break
}
}
if !inActual {
t.Fatalf("%d. Expected label value %s not in output", i, expected[i])
} }
} }
} }

View file

@ -74,8 +74,8 @@ func TestTemplateExpansion(t *testing.T) {
output: "a", output: "a",
}, },
{ {
// Range over query. // Range over query and sort by label.
text: "{{ range query \"metric\" }}{{.Labels.instance}}:{{.Value}}: {{end}}", text: "{{ range query \"metric\" | sortByLabel \"instance\" }}{{.Labels.instance}}:{{.Value}}: {{end}}",
output: "a:11: b:21: ", output: "a:11: b:21: ",
}, },
{ {
@ -98,11 +98,6 @@ func TestTemplateExpansion(t *testing.T) {
text: "{{ reReplaceAll \"(a)b\" \"x$1\" \"ab\" }}", text: "{{ reReplaceAll \"(a)b\" \"x$1\" \"ab\" }}",
output: "xa", output: "xa",
}, },
{
// Sorting.
text: "{{ range query \"metric\" | sortByLabel \"instance\" }}{{.Labels.instance}} {{end}}",
output: "a b ",
},
{ {
// Humanize. // Humanize.
text: "{{ range . }}{{ humanize . }}:{{ end }}", text: "{{ range . }}{{ humanize . }}:{{ end }}",