File tree Expand file tree Collapse file tree 6 files changed +43
-9
lines changed
DotNet.Testcontainers.Tests Expand file tree Collapse file tree 6 files changed +43
-9
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ Task("SonarBegin")
106106 Organization = param . SonarQubeCredentials . Organization ,
107107 Branch = param . Branch ,
108108 Silent = true ,
109- VsTestReportsPath = $ "{ param . Paths . Directories . TestResults } /*.trx",
109+ VsTestReportsPath = $ "{ MakeAbsolute ( param . Paths . Directories . TestResults ) } /*.trx",
110110 OpenCoverReportsPath = $ "{ MakeAbsolute ( param . Paths . Directories . TestCoverage ) } /coverage.opencover.xml"
111111 } ) ;
112112} ) ;
Original file line number Diff line number Diff line change 11namespace DotNet . Testcontainers . Tests
22{
3- using System ;
43 using System . Runtime . InteropServices ;
4+ using DotNet . Testcontainers . Core . Builder ;
55 using Xunit ;
66
77 public sealed class IgnoreOnLinuxEngine : FactAttribute
88 {
9- private static readonly bool IsWindowsEngineEnabled = "Windows_NT" . Equals ( Environment . GetEnvironmentVariable ( "AGENT_OS" ) ) ; // TODO: Replace this with and Docker API call.
10-
119 public IgnoreOnLinuxEngine ( )
1210 {
13- if ( ! RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) || ! IsWindowsEngineEnabled )
11+ if ( ! RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) || ! DockerHostConfiguration . IsWindowsEngineEnabled )
1412 {
1513 this . Skip = "Ignore as long as Docker Windows engine is not available." ;
1614 }
Original file line number Diff line number Diff line change @@ -3,9 +3,16 @@ namespace DotNet.Testcontainers.Tests.Unit.Windows
33 using System . Threading . Tasks ;
44 using DotNet . Testcontainers . Core . Builder ;
55 using DotNet . Testcontainers . Core . Containers ;
6+ using Xunit ;
67
78 public class TestcontainersContainerTest
89 {
10+ [ IgnoreOnLinuxEngine ]
11+ public void IsWindowsEngineEnabled ( )
12+ {
13+ Assert . True ( DockerHostConfiguration . IsWindowsEngineEnabled ) ;
14+ }
15+
916 [ IgnoreOnLinuxEngine ]
1017 public async Task Disposable ( )
1118 {
Original file line number Diff line number Diff line change @@ -8,10 +8,7 @@ namespace DotNet.Testcontainers.Clients
88
99 internal sealed class MetaDataClientImages : DockerMetaDataClient < ImagesListResponse >
1010 {
11- private static readonly Lazy < DockerMetaDataClient < ImagesListResponse > > MetaDataClient = new Lazy < DockerMetaDataClient < ImagesListResponse > > ( ( ) =>
12- {
13- return new MetaDataClientImages ( ) ;
14- } ) ;
11+ private static readonly Lazy < DockerMetaDataClient < ImagesListResponse > > MetaDataClient = new Lazy < DockerMetaDataClient < ImagesListResponse > > ( ( ) => new MetaDataClientImages ( ) ) ;
1512
1613 private MetaDataClientImages ( )
1714 {
Original file line number Diff line number Diff line change 1+ namespace DotNet . Testcontainers . Clients
2+ {
3+ using System ;
4+
5+ internal sealed class MetaDataClientSystem : DockerApiClient
6+ {
7+ private static readonly Lazy < MetaDataClientSystem > MetaDataClient = new Lazy < MetaDataClientSystem > ( ( ) => new MetaDataClientSystem ( ) ) ;
8+
9+ private MetaDataClientSystem ( )
10+ {
11+ }
12+
13+ internal static MetaDataClientSystem Instance
14+ {
15+ get
16+ {
17+ return MetaDataClient . Value ;
18+ }
19+ }
20+
21+ internal bool IsWindowsEngineEnabled { get ; } = "Windows_NT" . Equals ( Docker . System . GetSystemInfoAsync ( ) . Result . OperatingSystem ) ;
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ namespace DotNet . Testcontainers . Core . Builder
2+ {
3+ using DotNet . Testcontainers . Clients ;
4+
5+ public static class DockerHostConfiguration
6+ {
7+ public static bool IsWindowsEngineEnabled => MetaDataClientSystem . Instance . IsWindowsEngineEnabled ;
8+ }
9+ }
You can’t perform that action at this time.
0 commit comments