@@ -8,6 +8,8 @@ namespace DotNet.Testcontainers.Tests.Unit
8
8
using DotNet . Testcontainers . Configurations ;
9
9
using DotNet . Testcontainers . Tests . Fixtures ;
10
10
using Microsoft . Extensions . Logging . Abstractions ;
11
+ using Org . BouncyCastle . Crypto ;
12
+ using Org . BouncyCastle . Crypto . Parameters ;
11
13
using Xunit ;
12
14
13
15
public static class ProtectDockerDaemonSocketTest
@@ -18,12 +20,43 @@ private static IDockerEndpointAuthenticationConfiguration GetAuthConfig(ProtectD
18
20
return new IDockerEndpointAuthenticationProvider [ ] { new MTlsEndpointAuthenticationProvider ( customConfiguration ) , new TlsEndpointAuthenticationProvider ( customConfiguration ) } . First ( authProvider => authProvider . IsApplicable ( ) ) . GetAuthConfig ( ) ;
19
21
}
20
22
21
- public sealed class MTls : IClassFixture < DockerMTlsFixture >
23
+ public sealed class MTlsOpenSsl1_1_1 : IClassFixture < OpenSsl1_1_1Fixture >
22
24
{
25
+ private readonly ProtectDockerDaemonSocket _fixture ;
26
+
27
+ private readonly IDockerEndpointAuthenticationConfiguration _authConfig ;
28
+
29
+ public MTlsOpenSsl1_1_1 ( OpenSsl1_1_1Fixture dockerMTlsFixture )
30
+ {
31
+ _fixture = dockerMTlsFixture ;
32
+ _authConfig = GetAuthConfig ( dockerMTlsFixture ) ;
33
+ }
34
+
35
+ [ Fact ]
36
+ public async Task GetVersionReturnsVersion ( )
37
+ {
38
+ // Given
39
+ var client = new TestcontainersClient ( Guid . Empty , _authConfig , NullLogger . Instance ) ;
40
+
41
+ // When
42
+ var version = await client . System . GetVersionAsync ( )
43
+ . ConfigureAwait ( false ) ;
44
+
45
+ // Then
46
+ Assert . StartsWith ( version . Version , _fixture . Image . Tag ) ;
47
+ Assert . IsType < AsymmetricCipherKeyPair > ( _fixture . TlsKey ) ;
48
+ }
49
+ }
50
+
51
+ public sealed class MTlsOpenSsl3_1 : IClassFixture < OpenSsl3_1Fixture >
52
+ {
53
+ private readonly ProtectDockerDaemonSocket _fixture ;
54
+
23
55
private readonly IDockerEndpointAuthenticationConfiguration _authConfig ;
24
56
25
- public MTls ( DockerMTlsFixture dockerMTlsFixture )
57
+ public MTlsOpenSsl3_1 ( OpenSsl3_1Fixture dockerMTlsFixture )
26
58
{
59
+ _fixture = dockerMTlsFixture ;
27
60
_authConfig = GetAuthConfig ( dockerMTlsFixture ) ;
28
61
}
29
62
@@ -38,16 +71,20 @@ public async Task GetVersionReturnsVersion()
38
71
. ConfigureAwait ( false ) ;
39
72
40
73
// Then
41
- Assert . Equal ( ProtectDockerDaemonSocket . DockerVersion , version . Version ) ;
74
+ Assert . StartsWith ( version . Version , _fixture . Image . Tag ) ;
75
+ Assert . IsType < RsaPrivateCrtKeyParameters > ( _fixture . TlsKey ) ;
42
76
}
43
77
}
44
78
45
79
public sealed class Tls : IClassFixture < DockerTlsFixture >
46
80
{
81
+ private readonly ProtectDockerDaemonSocket _fixture ;
82
+
47
83
private readonly IDockerEndpointAuthenticationConfiguration _authConfig ;
48
84
49
85
public Tls ( DockerTlsFixture dockerTlsFixture )
50
86
{
87
+ _fixture = dockerTlsFixture ;
51
88
_authConfig = GetAuthConfig ( dockerTlsFixture ) ;
52
89
}
53
90
@@ -62,7 +99,7 @@ public async Task GetVersionReturnsVersion()
62
99
. ConfigureAwait ( false ) ;
63
100
64
101
// Then
65
- Assert . Equal ( ProtectDockerDaemonSocket . DockerVersion , version . Version ) ;
102
+ Assert . StartsWith ( version . Version , _fixture . Image . Tag ) ;
66
103
}
67
104
}
68
105
}
0 commit comments