Run all Go tests with flag -race (#7783)
This commit is contained in:
commit
876fc5b4bc
22
Makefile
22
Makefile
|
|
@ -50,6 +50,12 @@ ifneq ($(tag),)
|
|||
LDFLAGS += -X main.version=$(version)
|
||||
endif
|
||||
|
||||
# Go built-in race detector works only for 64 bits architectures.
|
||||
ifneq ($(GOARCH), 386)
|
||||
race_detector := -race
|
||||
endif
|
||||
|
||||
|
||||
GOFILES ?= $(shell git ls-files '*.go')
|
||||
GOFMT ?= $(shell gofmt -l -s $(filter-out plugins/parsers/influx/machine.go, $(GOFILES)))
|
||||
|
||||
|
|
@ -89,7 +95,7 @@ telegraf:
|
|||
|
||||
.PHONY: test
|
||||
test:
|
||||
go test -short ./...
|
||||
go test -short $(race_detector) ./...
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
|
|
@ -107,12 +113,12 @@ fmtcheck:
|
|||
|
||||
.PHONY: test-windows
|
||||
test-windows:
|
||||
go test -short ./plugins/inputs/ping/...
|
||||
go test -short ./plugins/inputs/win_perf_counters/...
|
||||
go test -short ./plugins/inputs/win_services/...
|
||||
go test -short ./plugins/inputs/procstat/...
|
||||
go test -short ./plugins/inputs/ntpq/...
|
||||
go test -short ./plugins/processors/port_name/...
|
||||
go test -short $(race_detector) ./plugins/inputs/ping/...
|
||||
go test -short $(race_detector) ./plugins/inputs/win_perf_counters/...
|
||||
go test -short $(race_detector) ./plugins/inputs/win_services/...
|
||||
go test -short $(race_detector) ./plugins/inputs/procstat/...
|
||||
go test -short $(race_detector) ./plugins/inputs/ntpq/...
|
||||
go test -short $(race_detector) ./plugins/processors/port_name/...
|
||||
|
||||
.PHONY: vet
|
||||
vet:
|
||||
|
|
@ -139,7 +145,7 @@ check: fmtcheck vet
|
|||
|
||||
.PHONY: test-all
|
||||
test-all: fmtcheck vet
|
||||
go test ./...
|
||||
go test $(race_detector) ./...
|
||||
|
||||
.PHONY: check-deps
|
||||
check-deps:
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@ import (
|
|||
)
|
||||
|
||||
func (p *Ping) pingToURL(u string, acc telegraf.Accumulator) {
|
||||
if p.Count < 1 {
|
||||
p.Count = 1
|
||||
}
|
||||
|
||||
tags := map[string]string{"url": u}
|
||||
fields := map[string]interface{}{"result_code": 0}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue