Repository navigation
Add unit tests for Server Subscription and Session handling - #3639
Conversation
…ling - SubscriptionLifecycleTests.cs: 46 tests covering subscription lifecycle (constructor, modify, publish mode, queue overflow, session closed, publish timeout, republish, durable subscriptions, triggering, etc.) - SessionExtendedTests.cs: 29 tests covering session operations (expiry, channel validation, locale updates, continuation points, diagnostics, ValidateRequest, etc.) All 578 tests pass (503 existing + 75 new). Co-authored-by: romanett <7413710+romanett@users.noreply.github.com> Agent-Logs-Url: https://github.com/OPCFoundation/UA-.NETStandard/sessions/d28cf5ce-a461-4e95-b23f-689ec5f5113b
|
|
|
@copilot remove all #region / #endregion directives from the new code. |
Agent-Logs-Url: https://github.com/OPCFoundation/UA-.NETStandard/sessions/a845e70e-0caa-4ed9-b694-c696b38b7e73 Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>
|
@copilot ensure build succeeds against .net framework. Current error for the tests: D:\a\1\s\Tests\Opc.Ua.Server.Tests\SubscriptionLifecycleTests.cs(88,59): error CS0117: 'ValueTask' does not contain a definition for 'CompletedTask' [D:\a\1\s\Tests\Opc.Ua.Server.Tests\Opc.Ua.Server.Tests.csproj::TargetFramework=net472] |
…ask) Agent-Logs-Url: https://github.com/OPCFoundation/UA-.NETStandard/sessions/36d75700-6e4a-4183-909a-95215e97932d Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com>
Fixed in d8d4454 — replaced |
No unit tests existed for core
SubscriptionandSessionlifecycle logic inOpc.Ua.Server. This adds 75 new tests covering previously untested code paths, compatible with all target frameworks including .NET Framework 4.7.2.Proposed changes
SubscriptionLifecycleTests.cs— 46 tests:IsDurabledefaultModify: publishing interval, keepalive/lifetime counts, priority,ModifyCounttrackingSetPublishingMode: enable/disable with counter tracking, no-op on unchanged stateQueueOverflowHandler:MonitoringQueueOverflowCountincrementsSessionClosed: clears session reference, resetsSessionIdand diagnosticsPublishTimeout: returnsBadTimeoutStatusChangeNotification, marks subscription expiredSubscriptionTransferred: returnsGoodSubscriptionTransferrednotificationSetSubscriptionDurable:BadNotSupportedwithout factory; setsIsDurable=truewith supportAcknowledge/Republish: sequence number validation, cache hit/miss, message countersPublish: keepalive for new subscription,PublishRequestCount, null context guard, post-timeout null returnSetTriggering: invalid item ID and null context guardsSessionExtendedTests.cs— 29 tests:HasExpired,IsSecureChannelValid,ActivatedstateUpdateLocaleIds: change detection,PreferredLocalesupdate, empty array handlingSaveContinuationPoint/RestoreContinuationPoint: round-trip, unknown ID, short byte string, remove-on-restoreSaveHistoryContinuationPoint/RestoreHistoryContinuationPoint: same patternsValidateRequest: wrong channel →BadSecureChannelIdInvalid, null header guard, per-service diagnostic countersSessionDiagnostics: name match, positive timeout valueRelated Issues
Types of changes
Checklist
Further comments
Tests follow existing project conventions: NUnit
Assert.Thatconstraint syntax, PascalCase method names,ServerFixture-based integration tests for session scenarios, and direct construction with mocks for subscription unit tests. All#region/#endregiondirectives have been omitted in line with project code style. Mock setup usesdefault(ValueTask)instead ofValueTask.CompletedTaskto ensure compatibility with .NET Framework 4.7.2 and all other target frameworks.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.