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 2022/08/02 09:38:01 UTC

[plc4x] 01/03: test(plc4go): fixed ManualTestRunner crashing and not cleaning up properly.

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 eede89a6b2980ca0e8b187450a07cbc13f155f2d
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Aug 2 10:48:25 2022 +0200

    test(plc4go): fixed ManualTestRunner crashing and not cleaning up properly.
---
 plc4go/internal/spi/testutils/ManualTestRunner.go | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plc4go/internal/spi/testutils/ManualTestRunner.go b/plc4go/internal/spi/testutils/ManualTestRunner.go
index dbf22becc..c30009090 100644
--- a/plc4go/internal/spi/testutils/ManualTestRunner.go
+++ b/plc4go/internal/spi/testutils/ManualTestRunner.go
@@ -59,10 +59,14 @@ func (m *ManualTestSuite) AddTestCase(address string, expectedReadValue interfac
 
 func (m *ManualTestSuite) Run() plc4go.PlcConnection {
 	connectionResult := <-m.DriverManager.GetConnection(m.ConnectionString)
-	if connectionResult.GetErr() != nil {
-		panic(connectionResult.GetErr())
+	if err := connectionResult.GetErr(); err != nil {
+		m.t.Error(err)
+		m.t.FailNow()
 	}
 	connection := connectionResult.GetConnection()
+	m.t.Cleanup(func() {
+		connection.Close()
+	})
 	log.Info().Msg("Reading all types in separate requests")
 	// Run all entries separately:
 	for _, testCase := range m.TestCases {