Ocpp: reduce timeouts during testing (#7342)
Identifies test using build tags until https://github.com/golang/go/issues/52600 becomes available.
This commit is contained in:
parent
440fdf77a5
commit
7803937a0c
6 changed files with 37 additions and 3 deletions
2
Makefile
2
Makefile
|
|
@ -63,7 +63,7 @@ toml:
|
|||
|
||||
test::
|
||||
@echo "Running testsuite"
|
||||
CGO_ENABLED=0 go test $(BUILD_TAGS) ./...
|
||||
CGO_ENABLED=0 go test $(BUILD_TAGS),test ./...
|
||||
|
||||
porcelain::
|
||||
gofmt -w -l $$(find . -name '*.go')
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ func NewOCPPFromConfig(other map[string]interface{}) (api.Charger, error) {
|
|||
}{
|
||||
Connector: 1,
|
||||
IdTag: defaultIdTag,
|
||||
ConnectTimeout: 2 * time.Minute,
|
||||
Timeout: 2 * time.Minute,
|
||||
ConnectTimeout: ocppConnectTimeout,
|
||||
Timeout: ocppTimeout,
|
||||
}
|
||||
|
||||
if err := util.DecodeOther(other, &cc); err != nil {
|
||||
|
|
|
|||
10
charger/ocpp_timeout.go
Normal file
10
charger/ocpp_timeout.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
//go:build !test
|
||||
|
||||
package charger
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
ocppConnectTimeout = 5 * time.Minute
|
||||
ocppTimeout = 2 * time.Minute
|
||||
)
|
||||
10
charger/ocpp_timeouttest.go
Normal file
10
charger/ocpp_timeouttest.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
//go:build test
|
||||
|
||||
package charger
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
ocppConnectTimeout = 1 * time.Second
|
||||
ocppTimeout = 1 * time.Second
|
||||
)
|
||||
10
charger/tags_test.go
Normal file
10
charger/tags_test.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
//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")
|
||||
}
|
||||
|
|
@ -9,6 +9,10 @@ connector: {{ .connector }}
|
|||
{{- if .idtag }}
|
||||
idtag: {{ .idtag }}
|
||||
{{- end }}
|
||||
{{- if ne .connecttimeout "5m" }}
|
||||
connecttimeout: {{ .connecttimeout }}
|
||||
{{- end }}
|
||||
{{- if ne .timeout "2m" }}
|
||||
timeout: {{ .timeout }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue