File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,11 @@ public class KubernetesClientConfigurationTests
33
33
/// </summary>
34
34
private static readonly string kubeConfigNoServer = "assets/kubeconfig.no-server.yml" ;
35
35
36
+ /// <summary>
37
+ /// Sample configuration file with incorrect cluster/server structure on purpose
38
+ /// </summary>
39
+ private static readonly string kubeConfigNoCluster = "assets/kubeconfig.no-cluster.yml" ;
40
+
36
41
/// <summary>
37
42
/// The configuration file is not present. An KubeConfigException should be thrown
38
43
/// </summary>
@@ -162,6 +167,16 @@ public void ServerNotFound()
162
167
Assert . Throws < k8s . Exceptions . KubeConfigException > ( ( ) => new KubernetesClientConfiguration ( fi ) ) ;
163
168
}
164
169
170
+ /// <summary>
171
+ /// Checks that a KubeConfigException is thrown when the clusters section is missing
172
+ /// </summary>
173
+ [ Fact ]
174
+ public void ClusterNotFound ( )
175
+ {
176
+ var fi = new FileInfo ( kubeConfigNoCluster ) ;
177
+ Assert . Throws < k8s . Exceptions . KubeConfigException > ( ( ) => new KubernetesClientConfiguration ( fi ) ) ;
178
+ }
179
+
165
180
// /// <summary>
166
181
// /// Checks if the are pods
167
182
// /// </summary>
Original file line number Diff line number Diff line change
1
+ # Sample file based on https://kubernetes.io/docs/tasks/access-application-cluster/authenticate-across-clusters-kubeconfig/
2
+ # WARNING: File includes minor fixes
3
+ ---
4
+ current-context : federal-context
5
+ apiVersion : v1
6
+ contexts :
7
+ - context :
8
+ cluster : horse-cluster
9
+ namespace : chisel-ns
10
+ user : green-user
11
+ name : federal-context
12
+ kind : Config
13
+ users :
14
+ - name : green-user
15
+ user :
16
+ password : secret
17
+ username : admin
You can’t perform that action at this time.
0 commit comments