Skip to content

Commit 2fc1ad1

Browse files
Copilotromanett
andauthored
Use temp folder for GDS test certificate storage (#3368)
* Initial plan * Use Path.GetTempPath() for GDS test certificate storage instead of %LocalApplicationData% This change addresses the issue where GDS tests could fail when stale certificates from previous test runs existed in %LocalApplicationData%/OPC. Changes: - Update GlobalDiscoveryTestClient.cs to use Path.GetTempPath() for programmatic config - Update GlobalDiscoveryTestServer.cs to use Path.GetTempPath() for programmatic config - Update ServerConfigurationPushTestClient.cs to use Path.GetTempPath() for programmatic config - Update CertificateGroupTests.cs to use Path.GetTempPath() directly Note: XML config files (used only by net48 on Windows) remain unchanged as they use %LocalApplicationData% which works correctly on Windows and clears properly. Co-authored-by: romanett <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: romanett <[email protected]>
1 parent e297529 commit 2fc1ad1

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Tests/Opc.Ua.Gds.Tests/CertificateGroupTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class CertificateGroupTests
2222
[SetUp]
2323
public void Setup()
2424
{
25-
m_path = Utils.ReplaceSpecialFolderNames("%LocalApplicationData%/OPC/GDS/TestStore");
25+
m_path = Path.Combine(Path.GetTempPath(), "OPC", "GDS", "TestStore");
2626
}
2727

2828
[TearDown]

Tests/Opc.Ua.Gds.Tests/GlobalDiscoveryTestClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public async Task LoadClientConfigurationAsync(int port = -1, bool clean = true)
9696
Configuration = await m_application.LoadApplicationConfigurationAsync(false)
9797
.ConfigureAwait(false);
9898
#else
99-
string root = Path.Combine("%LocalApplicationData%", "OPC");
99+
string root = Path.Combine(Path.GetTempPath(), "OPC");
100100
string pkiRoot = Path.Combine(root, "pki");
101101
var clientConfig = new GlobalDiscoveryTestClientConfiguration
102102
{

Tests/Opc.Ua.Gds.Tests/GlobalDiscoveryTestServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ private static async Task<ApplicationConfiguration> LoadAsync(
246246
.ConfigureAwait(false);
247247
#else
248248
string[] baseAddresses = ["opc.tcp://localhost:58810/GlobalDiscoveryTestServer"];
249-
string root = Path.Combine("%LocalApplicationData%", "OPC");
249+
string root = Path.Combine(Path.GetTempPath(), "OPC");
250250
string gdsRoot = Path.Combine(root, "GDS");
251251
var gdsConfig = new GlobalDiscoveryServerConfiguration
252252
{

Tests/Opc.Ua.Gds.Tests/ServerConfigurationPushTestClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public async Task LoadClientConfigurationAsync(int port = -1)
7575
Config = await application.LoadApplicationConfigurationAsync(false)
7676
.ConfigureAwait(false);
7777
#else
78-
string root = Path.Combine("%LocalApplicationData%", "OPC");
78+
string root = Path.Combine(Path.GetTempPath(), "OPC");
7979
string pkiRoot = Path.Combine(root, "pki");
8080
var clientConfig = new ServerConfigurationPushTestClientConfiguration
8181
{

0 commit comments

Comments
 (0)