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/16 18:16:49 UTC

[plc4x] branch develop updated: test(plc4go/cbus): fixed defer cleanup messup

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


The following commit(s) were added to refs/heads/develop by this push:
     new 6d23e0cbc5 test(plc4go/cbus): fixed defer cleanup messup
6d23e0cbc5 is described below

commit 6d23e0cbc54b87b056f6b1380b099a1fe45f2bb8
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Jun 16 20:16:41 2023 +0200

    test(plc4go/cbus): fixed defer cleanup messup
---
 plc4go/internal/cbus/Reader_test.go | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/plc4go/internal/cbus/Reader_test.go b/plc4go/internal/cbus/Reader_test.go
index 68348c57dd..4a4c639b80 100644
--- a/plc4go/internal/cbus/Reader_test.go
+++ b/plc4go/internal/cbus/Reader_test.go
@@ -190,9 +190,9 @@ func TestReader_readSync(t *testing.T) {
 				})
 				fields.messageCodec = codec
 				fields.tm = transactions.NewRequestTransactionManager(10, _options...)
-				defer func() {
+				t.Cleanup(func() {
 					assert.NoError(t, fields.tm.Close())
-				}()
+				})
 			},
 			resultEvaluator: func(t *testing.T, results chan apiModel.PlcReadRequestResult) bool {
 				timer := time.NewTimer(2 * time.Second)
@@ -254,9 +254,9 @@ func TestReader_readSync(t *testing.T) {
 				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
 
 				fields.tm = transactions.NewRequestTransactionManager(10, _options...)
-				defer func() {
+				t.Cleanup(func() {
 					assert.NoError(t, fields.tm.Close())
-				}()
+				})
 				transport := test.NewTransport()
 				transportUrl := url.URL{Scheme: "test"}
 				transportInstance, err := transport.CreateTransportInstance(transportUrl, nil, _options...)
@@ -300,7 +300,7 @@ func TestReader_readSync(t *testing.T) {
 					assert.NotNil(t, response)
 					value := response.GetValue("blub")
 					assert.NotNil(t, value)
-					assert.Implements(t, (interface{ GetString() string })(nil), value)
+					require.True(t, value.IsString())
 					assert.Equal(t, "PC_CNIED", value.GetString())
 				}
 				return true
@@ -333,9 +333,9 @@ func TestReader_readSync(t *testing.T) {
 				_options := testutils.EnrichOptionsWithOptionsForTesting(t)
 
 				fields.tm = transactions.NewRequestTransactionManager(10, _options...)
-				defer func() {
+				t.Cleanup(func() {
 					assert.NoError(t, fields.tm.Close())
-				}()
+				})
 
 				transport := test.NewTransport()
 				transportUrl := url.URL{Scheme: "test"}