You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2023/06/19 11:02:12 UTC
[plc4x] 03/05: feat(plc4go/spi): added env test util option for traceExecutorWorkers
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 9a21a7e03e8bf2a89e353ddd90c5a7875c688e28
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Jun 19 12:00:12 2023 +0200
feat(plc4go/spi): added env test util option for traceExecutorWorkers
---
plc4go/spi/testutils/TestUtils.go | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/plc4go/spi/testutils/TestUtils.go b/plc4go/spi/testutils/TestUtils.go
index 66c1b6f907..a13ac3100d 100644
--- a/plc4go/spi/testutils/TestUtils.go
+++ b/plc4go/spi/testutils/TestUtils.go
@@ -114,13 +114,20 @@ func TestContext(t *testing.T) context.Context {
return ctx
}
-var highLogPrecision bool
+var (
+ highLogPrecision bool
+ traceExecutorWorkers bool
+)
func init() {
highLogPrecision = os.Getenv("PLC4X_TEST_HIGH_TEST_LOG_PRECISION") == "true"
if highLogPrecision {
zerolog.TimeFieldFormat = time.RFC3339Nano
}
+ traceExecutorWorkers = true
+ if traceExecutorWorkersEnv := os.Getenv("PLC4X_TEST_TRACE_EXECUTOR_WORKERS"); traceExecutorWorkersEnv != "" {
+ traceExecutorWorkers = traceExecutorWorkersEnv == "true"
+ }
}
// ProduceTestingLogger produces a logger which redirects to testing.T
@@ -153,15 +160,14 @@ func ProduceTestingLogger(t *testing.T) zerolog.Logger {
// EnrichOptionsWithOptionsForTesting appends options useful for testing to config.WithOption s
func EnrichOptionsWithOptionsForTesting(t *testing.T, _options ...options.WithOption) []options.WithOption {
- traceWorkers := true
if extractedTraceWorkers, found := options.ExtractTracerWorkers(_options...); found {
- traceWorkers = extractedTraceWorkers
+ traceExecutorWorkers = extractedTraceWorkers
}
// TODO: apply to other options like above
return append(_options,
options.WithCustomLogger(ProduceTestingLogger(t)),
options.WithPassLoggerToModel(true),
- options.WithExecutorOptionTracerWorkers(traceWorkers),
+ options.WithExecutorOptionTracerWorkers(traceExecutorWorkers),
)
}