Skip to content

Commit

Permalink
Fix make test-ci run (influxdata#4002)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Schrijver authored and charless-splunk committed Apr 17, 2018
1 parent d9d66df commit c01c916
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git rev-parse --short HEAD)
GOFILES ?= $(shell git ls-files '*.go')
GOFMT ?= $(shell gofmt -l $(filter-out plugins/parsers/influx/machine.go, $(GOFILES)))
BUILDFLAGS ?=
BUILDFLAGS ?=

ifdef GOBIN
PATH := $(GOBIN):$(PATH)
Expand Down Expand Up @@ -46,7 +46,7 @@ fmt:

fmtcheck:
@echo '[INFO] running gofmt to identify incorrectly formatted code...'
@if [ ! -z $(GOFMT) ]; then \
@if [ ! -z "$(GOFMT)" ]; then \
echo "[ERROR] gofmt has found errors in the following files:" ; \
echo "$(GOFMT)" ; \
echo "" ;\
Expand All @@ -65,15 +65,15 @@ test-windows:
# any common errors.
vet:
@echo 'go vet $$(go list ./... | grep -v ./plugins/parsers/influx)'
@go vet $$(go list ./... | grep -v ./plugins/parsers/influx) ; if [ $$? -eq 1 ]; then \
@go vet $$(go list ./... | grep -v ./plugins/parsers/influx) ; if [ $$? -ne 0 ]; then \
echo ""; \
echo "go vet has found suspicious constructs. Please remediate any reported errors"; \
echo "to fix them before submitting code for review."; \
exit 1; \
fi

test-ci: fmtcheck vet
go test -short./...
go test -short ./...

test-all: fmtcheck vet
go test ./...
Expand Down
4 changes: 0 additions & 4 deletions plugins/outputs/influxdb/influxdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,12 @@ func TestConnectHTTPConfig(t *testing.T) {
}

func TestWriteRecreateDatabaseIfDatabaseNotFound(t *testing.T) {
var createDatabaseCalled bool

output := influxdb.InfluxDB{
URLs: []string{"http://localhost:8086"},

CreateHTTPClientF: func(config *influxdb.HTTPConfig) (influxdb.Client, error) {
return &MockClient{
CreateDatabaseF: func(ctx context.Context) error {
createDatabaseCalled = true
return nil
},
WriteF: func(ctx context.Context, metrics []telegraf.Metric) error {
Expand Down Expand Up @@ -178,7 +175,6 @@ func TestWriteRecreateDatabaseIfDatabaseNotFound(t *testing.T) {
require.NoError(t, err)
metrics := []telegraf.Metric{m}

createDatabaseCalled = false
err = output.Write(metrics)
// We only have one URL, so we expect an error
require.Error(t, err)
Expand Down

0 comments on commit c01c916

Please sign in to comment.