chore: simplify testing
This commit is contained in:
parent
67d5bd6cdd
commit
ac79357047
4 changed files with 13 additions and 25 deletions
2
Makefile
2
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')
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
//go:build test
|
||||
|
||||
package charger
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
ocppConnectTimeout = 1 * time.Second
|
||||
ocppTimeout = 1 * time.Second
|
||||
)
|
||||
|
|
@ -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")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue