diff --git a/plugins/inputs/opcua/opcua_test.go b/plugins/inputs/opcua/opcua_test.go index ee03d07e7..d49e69255 100644 --- a/plugins/inputs/opcua/opcua_test.go +++ b/plugins/inputs/opcua/opcua_test.go @@ -40,7 +40,10 @@ func TestGetDataBadNodeContainerIntegration(t *testing.T) { container := testutil.Container{ Image: "open62541/open62541", ExposedPorts: []string{servicePort}, - WaitingFor: wait.ForListeningPort(nat.Port(servicePort)), + WaitingFor: wait.ForAll( + wait.ForListeningPort(nat.Port(servicePort)), + wait.ForLog("TCP network layer listening on opc.tcp://"), + ), } err := container.Start() require.NoError(t, err, "failed to start container") @@ -95,7 +98,6 @@ func TestGetDataBadNodeContainerIntegration(t *testing.T) { err = readClient.Connect() require.NoError(t, err) - require.Contains(t, logger.LastError, "E! [] status not OK for node ProductName") } func TestReadClientIntegration(t *testing.T) { @@ -106,7 +108,10 @@ func TestReadClientIntegration(t *testing.T) { container := testutil.Container{ Image: "open62541/open62541", ExposedPorts: []string{servicePort}, - WaitingFor: wait.ForListeningPort(nat.Port(servicePort)), + WaitingFor: wait.ForAll( + wait.ForListeningPort(nat.Port(servicePort)), + wait.ForLog("TCP network layer listening on opc.tcp://"), + ), } err := container.Start() require.NoError(t, err, "failed to start container") @@ -187,7 +192,7 @@ password = "" name="name2" namespace="2" identifier_type="s" - identifier="two" + identifier="two" tags=[["tag0", "val0"], ["tag00", "val00"]] default_tags = {tag6 = "val6"} diff --git a/plugins/inputs/opcua_listener/opcua_listener_test.go b/plugins/inputs/opcua_listener/opcua_listener_test.go index 9c2817b04..18a41f950 100644 --- a/plugins/inputs/opcua_listener/opcua_listener_test.go +++ b/plugins/inputs/opcua_listener/opcua_listener_test.go @@ -41,7 +41,10 @@ func TestSubscribeClientIntegration(t *testing.T) { container := testutil.Container{ Image: "open62541/open62541", ExposedPorts: []string{servicePort}, - WaitingFor: wait.ForListeningPort(nat.Port(servicePort)), + WaitingFor: wait.ForAll( + wait.ForListeningPort(nat.Port(servicePort)), + wait.ForLog("TCP network layer listening on opc.tcp://"), + ), } err := container.Start() require.NoError(t, err, "failed to start container") @@ -87,10 +90,14 @@ func TestSubscribeClientIntegration(t *testing.T) { o, err := subscribeConfig.CreateSubscribeClient(testutil.Logger{}) require.NoError(t, err) - err = o.Init() - require.NoError(t, err, "Initialization") + // give init a couple extra attempts, seconds as on CircleCI this can + // be attempted to soon + require.Eventually(t, func() bool { + return o.Init() == nil + }, 5*time.Second, 10*time.Millisecond) + err = o.Connect() - require.NoError(t, err, "Connect") + require.NoError(t, err, "Connection failed") ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel()