fix: Do not return on disconnect to avoid breaking reconnect (#9524)

This commit is contained in:
Sven Rebhan 2021-08-05 17:54:29 +02:00 committed by GitHub
parent 16597586f5
commit 249bcd25d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -407,7 +407,9 @@ func Connect(o *OpcUA) error {
if o.client != nil {
if err := o.client.CloseSession(); err != nil {
return err
// Only log the error but to not bail-out here as this prevents
// reconnections for multiple parties (see e.g. #9523).
o.Log.Errorf("Closing session failed: %v", err)
}
}

View File

@ -8,6 +8,7 @@ import (
"github.com/influxdata/telegraf/config"
"github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@ -44,7 +45,6 @@ func TestClient1Integration(t *testing.T) {
o.SecurityPolicy = "None"
o.SecurityMode = "None"
o.Log = testutil.Logger{}
for _, tags := range testopctags {
o.RootNodes = append(o.RootNodes, MapOPCTag(tags))
}