diff --git a/integration-tests/pkg/mock_sensor/expect_conn.go b/integration-tests/pkg/mock_sensor/expect_conn.go index dd2be10ae9..849a05e4a7 100644 --- a/integration-tests/pkg/mock_sensor/expect_conn.go +++ b/integration-tests/pkg/mock_sensor/expect_conn.go @@ -103,8 +103,7 @@ func (s *MockSensor) ExpectSameElementsConnections(t *testing.T, containerID str types.SortConnections(expected) connections := s.SortedConnections(containerID) - success := s.checkIfConnectionsMatchExpected(t, connections, expected) - if success { + if s.checkIfConnectionsMatchExpected(t, connections, expected) { return true } diff --git a/integration-tests/pkg/mock_sensor/server.go b/integration-tests/pkg/mock_sensor/server.go index fc7febafc7..9a5f072f68 100644 --- a/integration-tests/pkg/mock_sensor/server.go +++ b/integration-tests/pkg/mock_sensor/server.go @@ -155,7 +155,9 @@ func (m *MockSensor) Connections(containerID string) []types.NetworkInfo { defer m.networkMutex.Unlock() if connections, ok := m.connections[containerID]; ok { - return connections + conns := make([]types.NetworkInfo, len(connections)) + copy(conns, connections) + return conns } return make([]types.NetworkInfo, 0) }