-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from CommunityToolkit/improve-docker-testing-c…
…hecks Test improvements"
- Loading branch information
Showing
18 changed files
with
82 additions
and
445 deletions.
There are no files selected for viewing
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,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RunSettings> | ||
<RunConfiguration> | ||
<!-- Filter out failing (wrong framework, platform, runtime or activeissue) tests --> | ||
<TestCaseFilter>category!=unsupported-platform</TestCaseFilter> | ||
</RunConfiguration> | ||
</RunSettings> |
6 changes: 3 additions & 3 deletions
6
tests/Aspire.CommunityToolkit.Hosting.Java.Tests/JavaHostingComponentTests.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
6 changes: 3 additions & 3 deletions
6
tests/Aspire.CommunityToolkit.Hosting.Ollama.Tests/AppHostTests.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
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
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,6 @@ | ||
namespace Aspire.Components.Common.Tests; | ||
|
||
public static class PlatformDetection | ||
{ | ||
public static bool IsRunningOnCI => Environment.GetEnvironmentVariable("CI") is not null; | ||
} |
34 changes: 34 additions & 0 deletions
34
tests/Aspire.CommunityToolkit.Testing/RequiresDockerAttribute.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,34 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
// Copied from: https://github.com/dotnet/aspire/blob/d31331d6132aeb22940dcd8834344956ba811373/tests/Aspire.Components.Common.Tests/RequiresDockerAttribute.cs | ||
|
||
using Xunit.Sdk; | ||
|
||
namespace Aspire.Components.Common.Tests; | ||
|
||
[TraitDiscoverer("Aspire.Components.Common.Tests.RequiresDockerDiscoverer", "Aspire.CommunityToolkit.Testing")] | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false)] | ||
public class RequiresDockerAttribute : Attribute, ITraitAttribute | ||
{ | ||
// This property is `true` when docker is *expected* to be available. | ||
// | ||
// A hard-coded *expected* value is used here to ensure that docker | ||
// dependent tests *fail* if docker is not available/usable in an environment | ||
// where it is expected to be available. A run-time check would allow tests | ||
// to fail silently, which is not desirable. | ||
// | ||
// scenarios: | ||
// - Windows: assume installed only for *local* runs as docker isn't supported on CI yet | ||
// - https://github.com/dotnet/aspire/issues/4291 | ||
// - Linux - Local, or CI: always assume that docker is installed | ||
public static bool IsSupported => | ||
!OperatingSystem.IsWindows() || | ||
!PlatformDetection.IsRunningOnCI; | ||
|
||
public string? Reason { get; init; } | ||
public RequiresDockerAttribute(string? reason = null) | ||
{ | ||
Reason = reason; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
tests/Aspire.CommunityToolkit.Testing/RequiresDockerDiscoverer.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,20 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
// Copied from: https://github.com/dotnet/aspire/blob/d31331d6132aeb22940dcd8834344956ba811373/tests/Aspire.Components.Common.Tests/RequiresDockerDiscoverer.cs | ||
|
||
using Xunit.Abstractions; | ||
using Xunit.Sdk; | ||
|
||
namespace Aspire.Components.Common.Tests; | ||
|
||
public class RequiresDockerDiscoverer : ITraitDiscoverer | ||
{ | ||
public IEnumerable<KeyValuePair<string, string>> GetTraits(IAttributeInfo traitAttribute) | ||
{ | ||
if (!RequiresDockerAttribute.IsSupported) | ||
{ | ||
yield return new KeyValuePair<string, string>("category", "unsupported-platform"); | ||
} | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
tests/Aspire.CommunityToolkit.Testing/XUnit/ConditionalFactAttribute.cs
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
tests/Aspire.CommunityToolkit.Testing/XUnit/ConditionalFactDiscoverer.cs
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
tests/Aspire.CommunityToolkit.Testing/XUnit/ConditionalTheoryAttribute.cs
This file was deleted.
Oops, something went wrong.
84 changes: 0 additions & 84 deletions
84
tests/Aspire.CommunityToolkit.Testing/XUnit/ConditionalTheoryDiscoverer.cs
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
tests/Aspire.CommunityToolkit.Testing/XUnit/ITestCondition.cs
This file was deleted.
Oops, something went wrong.
69 changes: 0 additions & 69 deletions
69
tests/Aspire.CommunityToolkit.Testing/XUnit/OSSkipConditionAttribute.cs
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
tests/Aspire.CommunityToolkit.Testing/XUnit/OperatingSystems.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.