Skip to content
This repository was archived by the owner on Aug 13, 2019. It is now read-only.

Commit ecb8d92

Browse files
committed
chore: Added common test to the Travis CI jobs
Signed-off-by: Martin Chodur <[email protected]>
1 parent 7751bd8 commit ecb8d92

File tree

3 files changed

+46
-53
lines changed

3 files changed

+46
-53
lines changed

.travis.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
sudo: false
2-
32
language: go
43

54
go:
6-
- 1.9.x
7-
- 1.10.x
5+
- 1.9.x
6+
- 1.10.x
87

98
go_import_path: github.com/prometheus/tsdb
109

10+
install:
11+
- go get -v -t ./...
12+
1113
script:
12-
- go test -timeout 5m ./...
14+
# `check_license` target is ommited due to some missing license headers
15+
# `staticcheck` target is ommited due to lining errors
16+
- make style unused test

Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,42 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313

14+
TSDB_CLI_DIR="./cmd/tsdb"
15+
TSDB_BIN = "$(TSDB_CLI_DIR)/tsdb"
16+
TSDB_BENCHMARK_NUM_METRICS ?= 1000
17+
TSDB_PROJECT_DIR = "."
18+
TSDB_BENCHMARK_DATASET ?= "$(TSDB_PROJECT_DIR)/testdata/20kseries.json"
19+
TSDB_BENCHMARK_OUTPUT_DIR ?= "$(TSDB_CLI_DIR)/benchout"
20+
21+
STATICCHECK_IGNORE =
1422
include Makefile.common
23+
24+
# Since tsdb client yet has no tests we can at least try to run benchmark
25+
test: bench #common-test
26+
# Overriding common-test because it uses --race tests which fails
27+
@$(GO) test $(TSDB_PROJECT_DIR)/...
28+
29+
build:
30+
@$(GO) build -o $(TSDB_BIN) $(TSDB_CLI_DIR)
31+
32+
bench: build
33+
# Check if dataset exists
34+
@test -e $(TSDB_BENCHMARK_DATASET) >/dev/null 2>&1 || (echo "ERROR: Cannot find benchmark dataset. Specify file using the TSDB_BENCHMARK_DATASET variable"; exit 1)
35+
@echo ">> running benchmark"
36+
@$(TSDB_BIN) bench write --metrics=$(TSDB_BENCHMARK_NUM_METRICS) $(TSDB_BENCHMARK_DATASET)
37+
38+
bench-vizualization: bench
39+
# Check if Graphviz is installed
40+
@command -v dot >/dev/null 2>&1 || (echo "ERROR: You need to have Graphviz installed to generate pprof visualization."; exit 1)
41+
@$(GO) tool pprof -svg ./tsdb $(TSDB_BENCHMARK_OUTPUT_DIR)/cpu.prof > $(TSDB_BENCHMARK_OUTPUT_DIR)/cpuprof.svg
42+
@$(GO) tool pprof --inuse_space -svg ./tsdb $(TSDB_BENCHMARK_OUTPUT_DIR)/mem.prof > $(TSDB_BENCHMARK_OUTPUT_DIR)/memprof.inuse.svg
43+
@$(GO) tool pprof --alloc_space -svg ./tsdb $(TSDB_BENCHMARK_OUTPUT_DIR)/mem.prof > $(TSDB_BENCHMARK_OUTPUT_DIR)/memprof.alloc.svg
44+
@$(GO) tool pprof -svg ./tsdb $(TSDB_BENCHMARK_OUTPUT_DIR)/block.prof > $(TSDB_BENCHMARK_OUTPUT_DIR)/blockprof.svg
45+
@$(GO) tool pprof -svg ./tsdb $(TSDB_BENCHMARK_OUTPUT_DIR)/mutex.prof > $(TSDB_BENCHMARK_OUTPUT_DIR)/mutexprof.svg
46+
47+
clean:
48+
# Remove built binary and benchmark results
49+
rm -f $(TSDB_BIN)
50+
rm -rf $(TSDB_BENCHMARK_OUTPUT_DIR)
51+
52+
.PHONY: clean test

cmd/tsdb/Makefile

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)