-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Expand file tree
/
Copy pathMsQuicRemoteExecutorTests.cs
More file actions
61 lines (55 loc) · 2.28 KB
/
MsQuicRemoteExecutorTests.cs
File metadata and controls
61 lines (55 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net.Security;
using System.Threading.Tasks;
using Microsoft.DotNet.RemoteExecutor;
using Microsoft.DotNet.XUnitExtensions;
using Xunit;
using Xunit.Abstractions;
namespace System.Net.Quic.Tests
{
[Collection(nameof(QuicTestCollection))]
[ConditionalClass(typeof(QuicTestBase), nameof(QuicTestBase.IsSupported), nameof(QuicTestBase.IsNotArm32CoreClrStressTest))]
public class MsQuicRemoteExecutorTests : QuicTestBase
{
public MsQuicRemoteExecutorTests()
: base(null!) { }
[ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[InlineData(true)]
[InlineData(false)]
public async Task SslKeyLogFile_IsCreatedAndFilled(bool enabledBySwitch)
{
if (PlatformDetection.IsDebugLibrary(typeof(QuicConnection).Assembly) && !enabledBySwitch)
{
// AppCtxSwitch is not checked for SSLKEYLOGFILE in Debug builds, the same code path
// will be tested by the enabledBySwitch = true case. Skip it here.
return;
}
var psi = new ProcessStartInfo();
var tempFile = Path.GetTempFileName();
psi.Environment.Add("SSLKEYLOGFILE", tempFile);
await RemoteExecutor.Invoke(async (enabledBySwitch) =>
{
if (bool.Parse(enabledBySwitch))
{
AppContext.SetSwitch("System.Net.EnableSslKeyLogging", true);
}
(QuicConnection clientConnection, QuicConnection serverConnection) = await CreateConnectedQuicConnection();
await clientConnection.DisposeAsync();
await serverConnection.DisposeAsync();
}
, enabledBySwitch.ToString(), new RemoteInvokeOptions { StartInfo = psi }).DisposeAsync();
if (enabledBySwitch)
{
Assert.True(File.ReadAllText(tempFile).Length > 0);
}
else
{
Assert.True(File.ReadAllText(tempFile).Length == 0);
}
}
}
}