From ef3b512dcf252418003e408d4e2de196c8f1d394 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Tue, 5 Aug 2014 20:56:05 +0200 Subject: [PATCH] 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 --- Makefile | 2 +- Makefile.INCLUDE | 4 ++-- storage/metric/tiered/end_to_end_test.go | 11 +++++++++-- templates/templates_test.go | 9 ++------- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 090c31482..7591d243d 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ tag: git push --tags $(BUILD_PATH)/cache/$(GOPKG): - curl -o $@ $(GOURL)/$(GOPKG) + curl -o $@ -L $(GOURL)/$(GOPKG) benchmark: test $(GO) test $(GO_TEST_FLAGS) -test.bench='Benchmark' ./... diff --git a/Makefile.INCLUDE b/Makefile.INCLUDE index 22ddf6c84..58d802bba 100644 --- a/Makefile.INCLUDE +++ b/Makefile.INCLUDE @@ -34,7 +34,7 @@ MAC_OS_X_VERSION ?= 10.8 BUILD_PATH = $(PWD)/.build -GO_VERSION := 1.2.1 +GO_VERSION := 1.3 GOOS = $(subst Darwin,darwin,$(subst Linux,linux,$(OS))) ifeq ($(GOOS),darwin) @@ -45,7 +45,7 @@ endif GOARCH = $(subst x86_64,amd64,$(ARCH)) 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 GOPATH = $(BUILD_PATH)/root/gopath GOCC = $(GOROOT)/bin/go diff --git a/storage/metric/tiered/end_to_end_test.go b/storage/metric/tiered/end_to_end_test.go index 40a1ff10f..a321d0883 100644 --- a/storage/metric/tiered/end_to_end_test.go +++ b/storage/metric/tiered/end_to_end_test.go @@ -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)) } for i := range expected { - if actual[i] != expected[i] { - t.Fatalf("%d. Got %s; want %s", i, actual[i], expected[i]) + inActual := false + 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]) } } } diff --git a/templates/templates_test.go b/templates/templates_test.go index 5aff1d860..c8aa8ce2f 100644 --- a/templates/templates_test.go +++ b/templates/templates_test.go @@ -74,8 +74,8 @@ func TestTemplateExpansion(t *testing.T) { output: "a", }, { - // Range over query. - text: "{{ range query \"metric\" }}{{.Labels.instance}}:{{.Value}}: {{end}}", + // Range over query and sort by label. + text: "{{ range query \"metric\" | sortByLabel \"instance\" }}{{.Labels.instance}}:{{.Value}}: {{end}}", output: "a:11: b:21: ", }, { @@ -98,11 +98,6 @@ func TestTemplateExpansion(t *testing.T) { text: "{{ reReplaceAll \"(a)b\" \"x$1\" \"ab\" }}", output: "xa", }, - { - // Sorting. - text: "{{ range query \"metric\" | sortByLabel \"instance\" }}{{.Labels.instance}} {{end}}", - output: "a b ", - }, { // Humanize. text: "{{ range . }}{{ humanize . }}:{{ end }}",