File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using Xunit ;
3
+ using k8s ;
4
+ using System . IO ;
5
+
6
+ namespace k8s . Tests
7
+ {
8
+ public class UtilsTests
9
+ {
10
+ /// <summary>
11
+ /// This file contains a sample kubeconfig file
12
+ /// </summary>
13
+ private static readonly string kubeConfigFileName = "assets/kubeconfig.yml" ;
14
+
15
+ /// <summary>
16
+ /// Checks that a certificate can be loaded from files.
17
+ /// </summary>
18
+ [ Fact ]
19
+ public void LoadFromFiles ( )
20
+ {
21
+ var fi = new FileInfo ( kubeConfigFileName ) ;
22
+ var cfg = new KubernetesClientConfiguration ( fi , "federal-context" ) ;
23
+
24
+ // Just validate that this doesn't throw and private key is non-null
25
+ var cert = Utils . GeneratePfx ( cfg ) ;
26
+ Assert . NotNull ( cert . PrivateKey ) ;
27
+ }
28
+
29
+ /// <summary>
30
+ /// Checks that a certificate can be loaded from inline.
31
+ /// </summary>
32
+ [ Fact ]
33
+ public void LoadFromInlineData ( )
34
+ {
35
+ var fi = new FileInfo ( kubeConfigFileName ) ;
36
+ var cfg = new KubernetesClientConfiguration ( fi , "victorian-context" ) ;
37
+
38
+ // Just validate that this doesn't throw and private key is non-null
39
+ var cert = Utils . GeneratePfx ( cfg ) ;
40
+ Assert . NotNull ( cert . PrivateKey ) ;
41
+ }
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments