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/21 08:30:22 UTC

[plc4x] branch develop updated (12fc12cb9f -> bb605959d2)

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


    from 12fc12cb9f fix(site): Remove reference to the Confluent Hub in Readme.md
     new 77453bf1c4 fix(plc4go/spi): increase sleep times of DriverTestRunner
     new bb605959d2 chore(build/plc4go): expose testutils options as inputs [skip ci]

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/workflows/go-platform.yml        | 37 +++++++++++++++++++++++
 plc4go/spi/testutils/DriverTestRunner.go | 50 +++++++++++++++-----------------
 2 files changed, 60 insertions(+), 27 deletions(-)


[plc4x] 02/02: chore(build/plc4go): expose testutils options as inputs [skip ci]

Posted by sr...@apache.org.
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 bb605959d238edaa10e02cd51cefad3d992043b1
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Jun 21 10:30:10 2023 +0200

    chore(build/plc4go): expose testutils options as inputs [skip ci]
---
 .github/workflows/go-platform.yml | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/.github/workflows/go-platform.yml b/.github/workflows/go-platform.yml
index 9ea6135527..52aeaab503 100644
--- a/.github/workflows/go-platform.yml
+++ b/.github/workflows/go-platform.yml
@@ -36,6 +36,43 @@ on:
         description: "Forces a snapshot update"
         required: false
         default: 'false'
+      highLogPrecision:
+        description: "sets the logs to nano resolution"
+        required: false
+        default: 'false'
+      passLoggerToModel:
+        description: "passes the logger to the model"
+        required: false
+        default: 'false'
+      receiveTimeout:
+        description: "sets the receive timeout to milliseconds"
+        required: false
+        default: '600000'
+      traceTransactionManagerWorkers:
+        description: "sets tracing for transaction manager workers"
+        required: false
+        default: 'false'
+      traceTransactionManagerTransactions:
+        description: "sets tracing for transaction manager transactions"
+        required: false
+        default: 'false'
+      traceDefaultMessageCodecWorker:
+        description: "sets tracing for the default message codec worker"
+        required: false
+        default: 'false'
+      traceExecutorWorkers:
+        description: "sets tracing for executor workers"
+        required: false
+        default: 'false'
+
+env:
+  PLC4X_TEST_HIGH_TEST_LOG_PRECISION: ${{ github.event.inputs.highLogPrecision }}
+  PLC4X_TEST_PASS_LOGGER_TO_MODEL: ${{ github.event.inputs.passLoggerToModel }}
+  PLC4X_TEST_RECEIVE_TIMEOUT_MS: ${{ github.event.inputs.receiveTimeout }}
+  PLC4X_TEST_TRACE_TRANSACTION_MANAGER_WORKERS: ${{ github.event.inputs.traceTransactionManagerWorkers }}
+  PLC4X_TEST_TRACE_TRANSACTION_MANAGER_TRANSACTIONS: ${{ github.event.inputs.traceTransactionManagerTransactions }}
+  PLC4X_TEST_TRACE_MESSAGE_CODEC_WORKER: ${{ github.event.inputs.traceDefaultMessageCodecWorker }}
+  PLC4X_TEST_TRACE_EXECUTOR_WORKERS: ${{ github.event.inputs.traceExecutorWorkers }}
 
 jobs:
   test:


[plc4x] 01/02: fix(plc4go/spi): increase sleep times of DriverTestRunner

Posted by sr...@apache.org.
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 77453bf1c465ae4c069e3152b9f605af5be07a0f
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Jun 20 17:16:36 2023 +0200

    fix(plc4go/spi): increase sleep times of DriverTestRunner
---
 plc4go/spi/testutils/DriverTestRunner.go | 50 +++++++++++++++-----------------
 1 file changed, 23 insertions(+), 27 deletions(-)

diff --git a/plc4go/spi/testutils/DriverTestRunner.go b/plc4go/spi/testutils/DriverTestRunner.go
index 15a11e3a68..b5a639ca2b 100644
--- a/plc4go/spi/testutils/DriverTestRunner.go
+++ b/plc4go/spi/testutils/DriverTestRunner.go
@@ -92,13 +92,13 @@ type TestTransportInstance interface {
 }
 
 func (m DriverTestsuite) Run(t *testing.T, driverManager plc4go.PlcDriverManager, testcase DriverTestcase) error {
-	var options []string
+	var driverParameters []string
 	for key, value := range m.driverParameters {
-		options = append(options, fmt.Sprintf("%s=%s", key, value))
+		driverParameters = append(driverParameters, fmt.Sprintf("%s=%s", key, value))
 	}
 	optionsString := ""
-	if len(options) > 0 {
-		optionsString = "?" + strings.Join(options, "&")
+	if len(driverParameters) > 0 {
+		optionsString = "?" + strings.Join(driverParameters, "&")
 	}
 	// Get a connection
 	connectionChan := driverManager.GetConnection(m.driverName + ":test://hurz" + optionsString)
@@ -119,8 +119,9 @@ func (m DriverTestsuite) Run(t *testing.T, driverManager plc4go.PlcDriverManager
 			return errors.Wrap(err, "error in setup step "+testStep.name)
 		}
 		// We sleep a bit to not run too fast into the post setup steps and give connections a bit time to settle built up
-		time.Sleep(10 * time.Millisecond)
+		time.Sleep(100 * time.Millisecond) // TODO: this is really bad as on CI sometimes those sleeps are not enough...
 	}
+	t.Log("setup done")
 
 	// Run the actual scenario steps
 	t.Logf("\n-------------------------------------------------------\nRunning testcases for: %s \n-------------------------------------------------------\n", testcase.name)
@@ -129,8 +130,9 @@ func (m DriverTestsuite) Run(t *testing.T, driverManager plc4go.PlcDriverManager
 		if err != nil {
 			return errors.Wrap(err, "error in step "+testStep.name)
 		}
-		time.Sleep(10 * time.Millisecond)
+		time.Sleep(100 * time.Millisecond) // TODO: this is really bad as on CI sometimes those sleeps are not enough...
 	}
+	t.Log("test steps done")
 
 	// Run the teardown steps
 	t.Logf("\n-------------------------------------------------------\nPerforming teardown for: %s \n-------------------------------------------------------\n", testcase.name)
@@ -139,8 +141,9 @@ func (m DriverTestsuite) Run(t *testing.T, driverManager plc4go.PlcDriverManager
 		if err != nil {
 			return errors.Wrap(err, "error in teardown step "+testStep.name)
 		}
-		time.Sleep(10 * time.Millisecond)
+		time.Sleep(100 * time.Millisecond) // TODO: this is really bad as on CI sometimes those sleeps are not enough...
 	}
+	t.Log("tear down done")
 
 	t.Logf("\n-------------------------------------------------------\nDone\n-------------------------------------------------------\n")
 	return nil
@@ -176,8 +179,7 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 			}
 
 			// Execute the read-request and store the response-channel in the testcase.
-			t.Logf("Execute read request (%T)", readRequest)
-			t.Logf("\n%s", readRequest)
+			t.Logf("Execute read request (%T)\n%[1]s", readRequest)
 			if testcase.readRequestResultChannel != nil {
 				return errors.New("testcase read-request result channel already occupied")
 			}
@@ -213,8 +215,7 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 			if err != nil {
 				return errors.Wrap(err, "Error creating write-request")
 			}
-			t.Logf("Execute write request (%T)", writeRequest)
-			t.Logf("\n%s", writeRequest)
+			t.Logf("Execute write request (%T)\n%[1]s", writeRequest)
 			if testcase.writeRequestResultChannel != nil {
 				return errors.New("testcase write-request result channel already occupied")
 			}
@@ -235,8 +236,7 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 			// Serialize the response to XML
 			xmlWriteBuffer := utils.NewXmlWriteBuffer()
 			response := readRequestResult.GetResponse()
-			t.Logf("Got response (%T)", response)
-			t.Logf("\n%s", response)
+			t.Logf("Got response (%T)\n%[1]s", response)
 			err := response.(utils.Serializable).SerializeWithWriteBuffer(context.Background(), xmlWriteBuffer)
 			if err != nil {
 				return errors.Wrap(err, "error serializing response")
@@ -263,8 +263,7 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 			// Serialize the response to XML
 			xmlWriteBuffer := utils.NewXmlWriteBuffer()
 			response := writeResponseResult.GetResponse()
-			t.Logf("Got response (%T)", response)
-			t.Logf("\n%s", response)
+			t.Logf("Got response (%T)\n%[1]s", response)
 			err := response.(utils.Serializable).SerializeWithWriteBuffer(context.Background(), xmlWriteBuffer)
 			if err != nil {
 				return errors.Wrap(err, "error serializing response")
@@ -290,8 +289,7 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 		if err != nil {
 			return errors.Wrap(err, "Error parsing message")
 		}
-		t.Logf("Parsed message (%T)", expectedMessage)
-		t.Logf("\n%s", expectedMessage)
+		t.Logf("Parsed message (%T)\n%[1]s", expectedMessage)
 
 		// Serialize the model into bytes
 		t.Log("Write to bytes")
@@ -312,11 +310,11 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 		expectedRawOutput := expectedWriteBuffer.GetBytes()
 		expectedRawOutputLength := uint32(len(expectedRawOutput))
 
-		now := time.Now()
+		startTransportPolling := time.Now()
 		// Read exactly this amount of bytes from the transport
-		t.Logf("Reading bytes (expectedRawOutputLength %d)", expectedRawOutputLength)
+		t.Logf("Reading bytes from transport instance (expectedRawOutputLength %d)", expectedRawOutputLength)
 		for testTransportInstance.GetNumDrainableBytes() < expectedRawOutputLength {
-			if time.Now().Sub(now) > 2*time.Second {
+			if time.Since(startTransportPolling) > 2*time.Second {
 				drainableBytes := testTransportInstance.GetNumDrainableBytes()
 				actualRawOutput := testTransportInstance.DrainWriteBuffer(drainableBytes)
 				return errors.Errorf("error getting bytes from transport. Not enough data available: actual(%d)<expected(%d), \nactual:   %#X\nexpected: %#X\nHexdumps:\n%s",
@@ -349,6 +347,7 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 				return errors.Errorf("actual output doesn't match expected output:\nactual:   %#X\nexpected: %#X\nHexdumps:\n%s", actualRawOutput, expectedRawOutput, utils.DiffHex(expectedRawOutput, actualRawOutput))
 			}
 		}
+		t.Log("outputs are matching")
 		// If there's a difference, parse the input and display it to simplify debugging
 	case StepTypeOutgoingPlcBytes:
 		// Read exactly this amount of bytes from the transport
@@ -378,8 +377,7 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 		if err != nil {
 			return errors.Wrap(err, "error parsing message")
 		}
-		t.Logf("Parsed message (%T)", expectedMessage)
-		t.Logf("\n%s", expectedMessage)
+		t.Logf("Parsed message (%T)\n%[1]s", expectedMessage)
 
 		// Serialize the model into bytes
 		t.Log("Serializing bytes")
@@ -399,9 +397,8 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 		}
 
 		// Send these bytes to the transport
-		t.Log("Writing to transport")
 		_bytes := wb.GetBytes()
-		t.Logf("\n%s", hex.Dump(_bytes))
+		t.Logf("Writing to transport\n%s", hex.Dump(_bytes))
 		testTransportInstance.FillReadBuffer(_bytes)
 	case StepTypeIncomingPlcBytes:
 		// Get the raw hex-data.
@@ -412,8 +409,7 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 		}
 
 		// Send these bytes to the transport
-		t.Log("Writing bytes to transport")
-		t.Logf("\n%s", hex.Dump(rawInput))
+		t.Logf("Writing bytes to transport\n%[1]s", hex.Dump(rawInput))
 		testTransportInstance.FillReadBuffer(rawInput)
 	case StepTypeDelay:
 		// Get the number of milliseconds
@@ -433,7 +429,7 @@ func (m DriverTestsuite) ExecuteStep(t *testing.T, connection plc4go.PlcConnecti
 			return errors.Wrap(err, "error closing transport")
 		}
 	}
-	t.Logf("\n-------------------------------------------------------\n - Finished step: %s after %vms \n-------------------------------------------------------", step.name, time.Now().Sub(start).Milliseconds())
+	t.Logf("\n-------------------------------------------------------\n - Finished step: %s after %sms \n-------------------------------------------------------", step.name, time.Since(start))
 	return nil
 }