@@ -4543,3 +4543,58 @@ func TestCluster_ParseProxyUrl(t *testing.T) {
45434543 }
45444544 }
45454545}
4546+
4547+ func TestSanitized (t * testing.T ) {
4548+ now := metav1 .Now ()
4549+ cluster := & Cluster {
4550+ ID : "123" ,
4551+ Server : "https://example.com" ,
4552+ Name : "example" ,
4553+ ServerVersion : "v1.0.0" ,
4554+ Namespaces : []string {"default" , "kube-system" },
4555+ Project : "default" ,
4556+ Labels : map [string ]string {
4557+ "env" : "production" ,
4558+ },
4559+ Annotations : map [string ]string {
4560+ "annotation-key" : "annotation-value" ,
4561+ },
4562+ ConnectionState : ConnectionState {
4563+ Status : ConnectionStatusSuccessful ,
4564+ Message : "Connection successful" ,
4565+ ModifiedAt : & now ,
4566+ },
4567+ Config : ClusterConfig {
4568+ Username : "admin" ,
4569+ Password : "password123" ,
4570+ BearerToken : "abc" ,
4571+ TLSClientConfig : TLSClientConfig {
4572+ Insecure : true ,
4573+ },
4574+ ExecProviderConfig : & ExecProviderConfig {
4575+ Command : "test" ,
4576+ },
4577+ },
4578+ }
4579+
4580+ assert .Equal (t , & Cluster {
4581+ ID : "123" ,
4582+ Server : "https://example.com" ,
4583+ Name : "example" ,
4584+ ServerVersion : "v1.0.0" ,
4585+ Namespaces : []string {"default" , "kube-system" },
4586+ Project : "default" ,
4587+ Labels : map [string ]string {"env" : "production" },
4588+ Annotations : map [string ]string {"annotation-key" : "annotation-value" },
4589+ ConnectionState : ConnectionState {
4590+ Status : ConnectionStatusSuccessful ,
4591+ Message : "Connection successful" ,
4592+ ModifiedAt : & now ,
4593+ },
4594+ Config : ClusterConfig {
4595+ TLSClientConfig : TLSClientConfig {
4596+ Insecure : true ,
4597+ },
4598+ },
4599+ }, cluster .Sanitized ())
4600+ }
0 commit comments