diff --git a/Makefile b/Makefile index 8c7793ac21..d161e1f50c 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ toml:: test:: @echo "Running testsuite" - CGO_ENABLED=0 go test $(BUILD_TAGS),test ./... + CGO_ENABLED=0 go test $(BUILD_TAGS) ./... porcelain:: gofmt -w -l $$(find . -name '*.go') diff --git a/charger/ocpp_timeout.go b/charger/ocpp_timeout.go index 07a5ac3736..a05f511537 100644 --- a/charger/ocpp_timeout.go +++ b/charger/ocpp_timeout.go @@ -1,10 +1,18 @@ -//go:build !test - package charger -import "time" +import ( + "testing" + "time" +) -const ( +var ( ocppConnectTimeout = 5 * time.Minute ocppTimeout = 2 * time.Minute ) + +func init() { + if testing.Testing() { + ocppConnectTimeout = 1 * time.Second + ocppTimeout = 1 * time.Second + } +} diff --git a/charger/ocpp_timeouttest.go b/charger/ocpp_timeouttest.go deleted file mode 100644 index 5243d6a7b4..0000000000 --- a/charger/ocpp_timeouttest.go +++ /dev/null @@ -1,10 +0,0 @@ -//go:build test - -package charger - -import "time" - -const ( - ocppConnectTimeout = 1 * time.Second - ocppTimeout = 1 * time.Second -) diff --git a/charger/tags_test.go b/charger/tags_test.go deleted file mode 100644 index e845bb50e3..0000000000 --- a/charger/tags_test.go +++ /dev/null @@ -1,10 +0,0 @@ -//go:build !test - -package charger - -import "log" - -// TODO remove when https://github.com/golang/go/issues/52600 becomes available -func init() { - log.Fatal("running a test without -tags test") -}