mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-17 05:11:13 +08:00
06ae192084
## Summary - stabilize the History, authentication lockout, Robotics, redundancy, and DI tests reported in #4301-#4305 - fix the closed-transport buffered-write completion deadlock that hung `ConnectMultipleSessionsAsync` - add macOS crash diagnostics for #4306 and retain evidence for root-cause analysis - run macOS tests and NativeAOT in GitHub Actions pull requests, using supported Intel and ARM64 runners, while keeping every Azure macOS definition disabled by default - move all remaining source-level `InternalsVisibleTo` declarations into project files so signed OpenUSD builds receive the repository public key ## Local validation - MCP PubSub: 29 passed - History focused tests: 3 passed - Sessions lockout: 3 passed - Sessions multiple-session regression: 3 passed - deterministic binary client channel tests: 22 passed - Robotics runtime: 34 passed - Redundancy focused tests: 4 passed - OpenUSD net10.0: 914 passed - affected OpenUSD projects build on net10.0 and net48 Refs #4299, #4300, #4306 Fixes #4301 Fixes #4302 Fixes #4303 Fixes #4304 Fixes #4305 --------- Copilot-Session: 7cb486de-8b4c-43c5-a900-e7d2e0ad04a8
98 lines
4.3 KiB
C#
98 lines
4.3 KiB
C#
/* ========================================================================
|
|
* Copyright (c) 2005-2026 The OPC Foundation, Inc. All rights reserved.
|
|
*
|
|
* OPC Foundation MIT License 1.00
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person
|
|
* obtaining a copy of this software and associated documentation
|
|
* files (the "Software"), to deal in the Software without
|
|
* restriction, including without limitation the rights to use,
|
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following
|
|
* conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be
|
|
* included in all copies or substantial portions of the Software.
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
*
|
|
* The complete license agreement can be found here:
|
|
* http://opcfoundation.org/License/MIT/1.00/
|
|
* ======================================================================*/
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
|
|
namespace Opc.Ua.Redundancy.Samples.Tests
|
|
{
|
|
/// <summary>
|
|
/// Shared environment-variable helpers used to launch the redundant sample
|
|
/// applications from the integration tests. Factory methods rather than
|
|
/// static properties are used where the environment depends on a freshly
|
|
/// allocated port so that parallel test children do not share the same
|
|
/// network resource.
|
|
/// </summary>
|
|
internal static class SampleTestEnvironment
|
|
{
|
|
/// <summary>
|
|
/// Builds an environment for the single-process PubSub demo that shortens
|
|
/// the two demo phases so the failover narrative completes quickly during
|
|
/// tests. Each call allocates a fresh loopback UDP port so that parallel
|
|
/// test processes do not contend on the same endpoint.
|
|
/// </summary>
|
|
/// <returns>
|
|
/// A new environment dictionary with a unique <c>PUBSUB_ENDPOINT</c> for
|
|
/// this child process.
|
|
/// </returns>
|
|
public static IReadOnlyDictionary<string, string?> BuildFastDemo()
|
|
{
|
|
int port = TestPorts.GetFreeUdpPort();
|
|
return new Dictionary<string, string?>(StringComparer.Ordinal)
|
|
{
|
|
["DEMO_FIRST_SECONDS"] = "1",
|
|
["DEMO_SECOND_SECONDS"] = "1",
|
|
["PUBSUB_ENDPOINT"] = "opc.udp://127.0.0.1:" + port.ToString(CultureInfo.InvariantCulture),
|
|
["HA_INSECURE"] = "true"
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// Environment for a plain, independent managed RedundantClient (one that fails
|
|
/// over on its own rather than joining a coordinated client replica set).
|
|
/// </summary>
|
|
public static IReadOnlyDictionary<string, string?> IndependentClient { get; } =
|
|
new Dictionary<string, string?>(StringComparer.Ordinal)
|
|
{
|
|
["CLIENT_MODE"] = "independent"
|
|
};
|
|
|
|
/// <summary>
|
|
/// Reads the configured long-haul duration in minutes from the
|
|
/// <c>SAMPLE_HA_DURATION_MINUTES</c> environment variable, falling back to the
|
|
/// supplied default when it is unset or invalid.
|
|
/// </summary>
|
|
/// <param name="defaultMinutes">The default duration in minutes.</param>
|
|
/// <returns>The configured long-haul duration.</returns>
|
|
public static TimeSpan LongHaulDuration(double defaultMinutes)
|
|
{
|
|
string? configured = Environment.GetEnvironmentVariable("SAMPLE_HA_DURATION_MINUTES");
|
|
if (!string.IsNullOrWhiteSpace(configured) &&
|
|
double.TryParse(configured, NumberStyles.Float, CultureInfo.InvariantCulture, out double minutes) &&
|
|
minutes > 0)
|
|
{
|
|
return TimeSpan.FromMinutes(minutes);
|
|
}
|
|
|
|
return TimeSpan.FromMinutes(defaultMinutes);
|
|
}
|
|
}
|
|
}
|