From aeb02e60c152c446d7889e267d5da6e61d7a3c31 Mon Sep 17 00:00:00 2001 From: xinchen Date: Thu, 5 Sep 2024 11:32:53 -0700 Subject: [PATCH] Fix dev cert setup for websocket test --- test/Common/WebSocketTests.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/Common/WebSocketTests.cs b/test/Common/WebSocketTests.cs index 8ba517a..c926cbc 100644 --- a/test/Common/WebSocketTests.cs +++ b/test/Common/WebSocketTests.cs @@ -85,12 +85,13 @@ namespace Test.Amqp string testName = "WebSocketSslMutalAuthTest"; Address listenAddress = new Address("wss://localhost:18081/" + testName + "/"); - X509Certificate2 cert = Test.Common.Extensions.GetCertificate("localhost"); - string output; int code = Exec("netsh.exe", string.Format("http show sslcert hostnameport={0}:{1}", listenAddress.Host, listenAddress.Port), out output); if (code != 0) { + X509Certificate2 cert = null; + Test.Common.Extensions.TryGetCertificate(StoreLocation.LocalMachine, StoreName.My, "localhost", out cert); + Assert.IsTrue(cert != null, "Failed to get dev-cert from LocalMachine store"); string args = string.Format("http add sslcert hostnameport={0}:{1} certhash={2} certstorename=MY appid={{{3}}} clientcertnegotiation=enable", listenAddress.Host, listenAddress.Port, cert.Thumbprint, Guid.NewGuid()); code = Exec("netsh.exe", args, out output);