Fix make test-ci run (#4002)

This commit is contained in:
Boris Schrijver 2018-04-11 00:35:58 +02:00 committed by Daniel Nelson
parent 6ff0bcd677
commit d44b3f6839
2 changed files with 4 additions and 8 deletions

View File

@ -44,7 +44,7 @@ fmt:
fmtcheck: fmtcheck:
@echo '[INFO] running gofmt to identify incorrectly formatted code...' @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 "[ERROR] gofmt has found errors in the following files:" ; \
echo "$(GOFMT)" ; \ echo "$(GOFMT)" ; \
echo "" ;\ echo "" ;\
@ -64,7 +64,7 @@ test-windows:
# any common errors. # any common errors.
vet: vet:
@echo 'go vet $$(go list ./... | grep -v ./plugins/parsers/influx)' @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 ""; \
echo "go vet has found suspicious constructs. Please remediate any reported errors"; \ echo "go vet has found suspicious constructs. Please remediate any reported errors"; \
echo "to fix them before submitting code for review."; \ echo "to fix them before submitting code for review."; \

View File

@ -137,15 +137,12 @@ func TestConnectHTTPConfig(t *testing.T) {
} }
func TestWriteRecreateDatabaseIfDatabaseNotFound(t *testing.T) { func TestWriteRecreateDatabaseIfDatabaseNotFound(t *testing.T) {
var createDatabaseCalled bool
output := influxdb.InfluxDB{ output := influxdb.InfluxDB{
URLs: []string{"http://localhost:8086"}, URLs: []string{"http://localhost:8086"},
CreateHTTPClientF: func(config *influxdb.HTTPConfig) (influxdb.Client, error) { CreateHTTPClientF: func(config *influxdb.HTTPConfig) (influxdb.Client, error) {
return &MockClient{ return &MockClient{
CreateDatabaseF: func(ctx context.Context) error { CreateDatabaseF: func(ctx context.Context) error {
createDatabaseCalled = true
return nil return nil
}, },
WriteF: func(ctx context.Context, metrics []telegraf.Metric) error { WriteF: func(ctx context.Context, metrics []telegraf.Metric) error {
@ -178,7 +175,6 @@ func TestWriteRecreateDatabaseIfDatabaseNotFound(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
metrics := []telegraf.Metric{m} metrics := []telegraf.Metric{m}
createDatabaseCalled = false
err = output.Write(metrics) err = output.Write(metrics)
// We only have one URL, so we expect an error // We only have one URL, so we expect an error
require.Error(t, err) require.Error(t, err)