From 5146bb14ef61a25c9b5986280fb48ef2781c71f1 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Le Duigou Date: Tue, 15 Oct 2019 00:48:08 +0200 Subject: [PATCH 1/3] adding unit test for target group (#6138) Signed-off-by: Jean-Baptiste Le Duigou --- discovery/targetgroup/targetgroup_test.go | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/discovery/targetgroup/targetgroup_test.go b/discovery/targetgroup/targetgroup_test.go index 0087b272f..ceb6bf9b9 100644 --- a/discovery/targetgroup/targetgroup_test.go +++ b/discovery/targetgroup/targetgroup_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/prometheus/prometheus/util/testutil" + "gopkg.in/yaml.v2" ) func TestTargetGroupStrictJsonUnmarshal(t *testing.T) { @@ -46,3 +47,45 @@ func TestTargetGroupStrictJsonUnmarshal(t *testing.T) { } } + +func TestTargetGroupYamlUnmarshal(t *testing.T) { + unmarshal := func(d []byte) func(interface{}) error { + return func(o interface{}) error { + return yaml.Unmarshal(d, o) + } + } + tests := []struct { + yaml string + expectedNumberOfTargets int + expectedNumberOfLabels int + expectedReply error + }{ + { + yaml: "labels:\ntargets:\n", + expectedNumberOfTargets: 0, + expectedNumberOfLabels: 0, + expectedReply: nil, + }, + { + yaml: "labels:\n my: label\ntargets:\n ['localhost:9090', 'localhost:9191']", + expectedNumberOfTargets: 2, + expectedNumberOfLabels: 1, + expectedReply: nil, + }, + { + yaml: "labels:\ntargets:\n 'localhost:9090'", + expectedNumberOfTargets: 0, + expectedNumberOfLabels: 0, + expectedReply: &yaml.TypeError{Errors: []string{"line 3: cannot unmarshal !!str `localho...` into []string"}}, + }, + } + + for _, test := range tests { + tg := Group{} + actual := tg.UnmarshalYAML(unmarshal([]byte(test.yaml))) + testutil.Equals(t, test.expectedReply, actual) + testutil.Equals(t, test.expectedNumberOfTargets, len(tg.Targets)) + testutil.Equals(t, test.expectedNumberOfLabels, len(tg.Labels)) + } + +} From b035c55a960a4fad56ba6026d8c9c54f4ba3b6fb Mon Sep 17 00:00:00 2001 From: Goutham Veeramachaneni Date: Thu, 10 Oct 2019 12:43:00 +0530 Subject: [PATCH 2/3] Step down and propose Ganesh as TSDB maintainer Signed-off-by: Goutham Veeramachaneni --- MAINTAINERS.md | 2 ++ tsdb/MAINTAINERS.md | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 tsdb/MAINTAINERS.md diff --git a/MAINTAINERS.md b/MAINTAINERS.md index e00da702c..a61d396a6 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -3,4 +3,6 @@ Maintainers of this repository with their focus areas: * Brian Brazil @brian-brazil: Console templates; semantics of PromQL, service discovery, and relabeling. * Fabian Reinartz @fabxc: PromQL parsing and evaluation; implementation of retrieval, alert notification, and service discovery. * Julius Volz @juliusv: Remote storage integrations; web UI. +* Krasi Georgiev @krasi-georgiev: TSDB - the storage engine. +* Ganesh Vernekar @codesome: TSDB - the storage engine. diff --git a/tsdb/MAINTAINERS.md b/tsdb/MAINTAINERS.md deleted file mode 100644 index dcb57a80d..000000000 --- a/tsdb/MAINTAINERS.md +++ /dev/null @@ -1,4 +0,0 @@ -Maintainers of this repository: - -* Krasi Georgiev @krasi-georgiev -* Goutham Veeramachaneni @gouthamve \ No newline at end of file From f7e1f064e3fbc919c2b3920497393764fb6b13cd Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Tue, 15 Oct 2019 09:33:38 +0200 Subject: [PATCH 3/3] Makefile: change default target to include check_assets (#5932) The CI has only to execute "make" to run all necessary checks. Signed-off-by: Simon Pasquier --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 11d4fa508..b029fa67a 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,9 @@ TSDB_BENCHMARK_NUM_METRICS ?= 1000 TSDB_BENCHMARK_DATASET ?= "$(TSDB_PROJECT_DIR)/testdata/20kseries.json" TSDB_BENCHMARK_OUTPUT_DIR ?= "$(TSDB_CLI_DIR)/benchout" +.PHONY: all +all: common-all check_assets + include Makefile.common DOCKER_IMAGE_NAME ?= prometheus @@ -39,9 +42,11 @@ check_assets: assets exit 1; \ fi +.PHONY: build_tsdb build_tsdb: GO111MODULE=$(GO111MODULE) $(GO) build -o $(TSDB_BIN) $(TSDB_CLI_DIR) +.PHONY: bench_tsdb bench_tsdb: build_tsdb @echo ">> running benchmark, writing result to $(TSDB_BENCHMARK_OUTPUT_DIR)" @$(TSDB_BIN) bench write --metrics=$(TSDB_BENCHMARK_NUM_METRICS) --out=$(TSDB_BENCHMARK_OUTPUT_DIR) $(TSDB_BENCHMARK_DATASET)