@@ -37,49 +37,6 @@ import (
3737 "sigs.k8s.io/controller-runtime/pkg/client/fake"
3838)
3939
40- func Test_ignore (t * testing.T ) {
41- sampleCluster := & unstructured.Unstructured {}
42- sampleCluster .SetKind ("Cluster" )
43- sampleCluster .SetAPIVersion ("cluster.kubesphere.io/v1alpha1" )
44-
45- type args struct {
46- cluster func () * unstructured.Unstructured
47- }
48- tests := []struct {
49- name string
50- args args
51- want bool
52- }{{
53- name : "cluster is nil" ,
54- want : true ,
55- }, {
56- name : "cluster without the particular label" ,
57- args : args {cluster : func () * unstructured.Unstructured {
58- return sampleCluster .DeepCopy ()
59- }},
60- want : false ,
61- }, {
62- name : "with the particular label" ,
63- args : args {cluster : func () * unstructured.Unstructured {
64- cluster := sampleCluster .DeepCopy ()
65- cluster .SetLabels (map [string ]string {
66- "cluster-role.kubesphere.io/host" : "" ,
67- })
68- return cluster
69- }},
70- want : true ,
71- }}
72- for _ , tt := range tests {
73- t .Run (tt .name , func (t * testing.T ) {
74- var cluster * unstructured.Unstructured
75- if tt .args .cluster != nil {
76- cluster = tt .args .cluster ()
77- }
78- assert .Equalf (t , tt .want , ignore (cluster ), "ignore(%v)" , tt .args .cluster )
79- })
80- }
81- }
82-
8340func Test_createArgoCluster (t * testing.T ) {
8441 defaultCluster := & unstructured.Unstructured {}
8542 defaultCluster .SetKind ("Cluster" )
0 commit comments