forked from dotnet/aspnetcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HTTP/3 test to verify platform support (dotnet#46523)
- Loading branch information
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/Servers/Kestrel/Transport.Quic/test/SkipOnMarinerAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Runtime.InteropServices; | ||
using Microsoft.AspNetCore.Testing; | ||
|
||
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests; | ||
|
||
[AttributeUsage(AttributeTargets.Method)] | ||
public class SkipOnMarinerAttribute : Attribute, ITestCondition | ||
{ | ||
public SkipOnMarinerAttribute(string issueUrl = "") | ||
{ | ||
IssueUrl = issueUrl; | ||
} | ||
|
||
public string IssueUrl { get; } | ||
|
||
public bool IsMet { get; } = !IsMariner; | ||
|
||
public string SkipReason => "Test cannot run on Mariner Linux."; | ||
|
||
// This logic is borrowed from https://github.com/dotnet/runtime/blob/6a5a78bec9a6e14b4aa52cd5ac558f6cf5c6a211/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs | ||
private static bool IsMariner { get; } = | ||
RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && File.Exists("/etc/os-release") && | ||
File.ReadAllLines("/etc/os-release").Any(line => | ||
line.StartsWith("ID=", StringComparison.Ordinal) && line.Substring(3).Trim('"', '\'') == "mariner"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters