chore: simplify testing

This commit is contained in:
andig 2023-11-01 23:04:28 +01:00
parent 67d5bd6cdd
commit ac79357047
4 changed files with 13 additions and 25 deletions

View file

@ -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')

View file

@ -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
}
}

View file

@ -1,10 +0,0 @@
//go:build test
package charger
import "time"
const (
ocppConnectTimeout = 1 * time.Second
ocppTimeout = 1 * time.Second
)

View file

@ -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")
}