From 4719482f5fa4ba79855adf6210bd65a3c4dc4b7d Mon Sep 17 00:00:00 2001
From: beorn7
Date: Tue, 13 Dec 2016 16:57:49 +0100
Subject: [PATCH] storage: Make tests go-vet and golint clean
---
storage/local/chunk/chunk_test.go | 5 ++++-
storage/local/noop_storage.go | 3 +++
storage/local/storage_test.go | 16 ++++++++--------
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/storage/local/chunk/chunk_test.go b/storage/local/chunk/chunk_test.go
index f5f21f67db9..20ac73c7e67 100644
--- a/storage/local/chunk/chunk_test.go
+++ b/storage/local/chunk/chunk_test.go
@@ -39,7 +39,10 @@ func TestLen(t *testing.T) {
t.Errorf("chunk type %s should have %d samples, had %d", c.Encoding(), i, c.Len())
}
- cs, _ := c.Add(model.SamplePair{model.Time(i), model.SampleValue(i)})
+ cs, _ := c.Add(model.SamplePair{
+ Timestamp: model.Time(i),
+ Value: model.SampleValue(i),
+ })
c = cs[0]
}
}
diff --git a/storage/local/noop_storage.go b/storage/local/noop_storage.go
index 360849da1bf..70b5a32f192 100644
--- a/storage/local/noop_storage.go
+++ b/storage/local/noop_storage.go
@@ -45,6 +45,9 @@ func (s *NoopStorage) Querier() (Querier, error) {
return &NoopQuerier{}, nil
}
+// NoopQuerier is a dummy Querier for use when Prometheus's local storage is
+// disabled. It is returned by the NoopStorage Querier method and always returns
+// empty results.
type NoopQuerier struct{}
// Close implements Querier.
diff --git a/storage/local/storage_test.go b/storage/local/storage_test.go
index fc72b44b3f0..d63b6d3ab18 100644
--- a/storage/local/storage_test.go
+++ b/storage/local/storage_test.go
@@ -319,31 +319,31 @@ func TestFingerprintsForLabels(t *testing.T) {
expected model.Fingerprints
}{
{
- pairs: []model.LabelPair{{"label1", "x"}},
+ pairs: []model.LabelPair{{Name: "label1", Value: "x"}},
expected: fingerprints[:0],
},
{
- pairs: []model.LabelPair{{"label1", "test_0"}},
+ pairs: []model.LabelPair{{Name: "label1", Value: "test_0"}},
expected: fingerprints[:10],
},
{
pairs: []model.LabelPair{
- {"label1", "test_0"},
- {"label1", "test_1"},
+ {Name: "label1", Value: "test_0"},
+ {Name: "label1", Value: "test_1"},
},
expected: fingerprints[:0],
},
{
pairs: []model.LabelPair{
- {"label1", "test_0"},
- {"label2", "test_1"},
+ {Name: "label1", Value: "test_0"},
+ {Name: "label2", Value: "test_1"},
},
expected: fingerprints[5:10],
},
{
pairs: []model.LabelPair{
- {"label1", "test_1"},
- {"label2", "test_2"},
+ {Name: "label1", Value: "test_1"},
+ {Name: "label2", Value: "test_2"},
},
expected: fingerprints[15:20],
},