From d3506f2b759c7914e5dd67d8c1df3656f99030fe Mon Sep 17 00:00:00 2001 From: Roman Ettlinger Date: Tue, 27 Oct 2026 08:37:50 +0100 Subject: [PATCH] Subscription tests: wait for all initial values after a transfer InternalTransferSubscriptionAsync waited until each dynamic target subscription had received at least one notification, then asserted at least MonitoredItemCount when sendInitialValues is set. The initial values of a transferred subscription can arrive in several publish responses, so the wait could release after a partial batch (TransferSubscriptionAsync(True,True,True) saw 9 of 10 on Linux and 1 of 10 on net48 in PR #4916 CI). Wait for the same count the assertion checks. Co-Authored-By: Claude Opus 5.5 --- .../TransferSubscriptionTest.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/Opc.Ua.Subscriptions.Classic.Tests/TransferSubscriptionTest.cs b/tests/Opc.Ua.Subscriptions.Classic.Tests/TransferSubscriptionTest.cs index 899af3187a..a787ef47d8 100644 --- a/tests/Opc.Ua.Subscriptions.Classic.Tests/TransferSubscriptionTest.cs +++ b/tests/Opc.Ua.Subscriptions.Classic.Tests/TransferSubscriptionTest.cs @@ -451,11 +451,15 @@ namespace Opc.Ua.Subscriptions.Classic.Tests TestContext.Out .WriteLine("TargetSession is now SessionId={0}", targetSession.SessionId); + // The initial values of a transferred subscription can span several + // publish responses, so wait for the full count asserted below, not + // just the first notification. await TestPolling.WaitUntilAsync( () => staticTargetNotifications.Count >= expectedStaticBatchCount && Volatile.Read(ref targetKeepAliveCount) > 0 && Enumerable.Range(1, kTestSubscriptions - 1).All(index => - Volatile.Read(ref targetSubscriptionCounters[index]) > 0 && + Volatile.Read(ref targetSubscriptionCounters[index]) >= + (sendInitialValues ? (int)transferSubscriptions[index].MonitoredItemCount : 1) && Volatile.Read(ref targetSubscriptionFastDataCounters[index]) > 0), timeoutMessage: "The target did not deliver expected notifications and a keepalive.") .ConfigureAwait(false);