This repository was archived by the owner on Oct 6, 2025. It is now read-only.
  
  
  
  
    
    
    
      
    
  
  
    
File tree Expand file tree Collapse file tree 2 files changed +106
-1
lines changed Expand file tree Collapse file tree 2 files changed +106
-1
lines changed Original file line number Diff line number Diff line change 11module  github.com/argoproj/gitops-engine 
22
3- go  1.24.1  
3+ go  1.24.2  
44
55require  (
66	github.com/davecgh/go-spew  v1.1.2-0.20180830191138-d8f796af33cc 
Original file line number Diff line number Diff line change 1+ package  json
2+ 
3+ import  (
4+ 	"reflect" 
5+ 	"testing" 
6+ )
7+ 
8+ func  Test_removeFields (t  * testing.T ) {
9+ 	tests  :=  []struct  {
10+ 		name    string 
11+ 		config  any 
12+ 		live    any 
13+ 		want    any 
14+ 	}{
15+ 		{
16+ 			name : "map" ,
17+ 			config : map [string ]any {
18+ 				"foo" : "bar" ,
19+ 			},
20+ 			live : map [string ]any {
21+ 				"foo" : "baz" ,
22+ 				"bar" : "baz" ,
23+ 			},
24+ 			want : map [string ]any {
25+ 				"foo" : "baz" ,
26+ 			},
27+ 		},
28+ 		{
29+ 			name : "nested map" ,
30+ 			config : map [string ]any {
31+ 				"foo" : map [string ]any {
32+ 					"bar" : "baz" ,
33+ 				},
34+ 				"bar" : "baz" ,
35+ 			},
36+ 			live : map [string ]any {
37+ 				"foo" : map [string ]any {
38+ 					"bar" : "qux" ,
39+ 					"baz" : "qux" ,
40+ 				},
41+ 				"bar" : "baz" ,
42+ 			},
43+ 			want : map [string ]any {
44+ 				"foo" : map [string ]any {
45+ 					"bar" : "qux" ,
46+ 				},
47+ 				"bar" : "baz" ,
48+ 			},
49+ 		},
50+ 		{
51+ 			name : "list" ,
52+ 			config : []any {
53+ 				map [string ]any {
54+ 					"foo" : "bar" ,
55+ 				},
56+ 			},
57+ 			live : []any {
58+ 				map [string ]any {
59+ 					"foo" : "baz" ,
60+ 					"bar" : "baz" ,
61+ 				},
62+ 			},
63+ 			want : []any {
64+ 				map [string ]any {
65+ 					"foo" : "baz" ,
66+ 				},
67+ 			},
68+ 		},
69+ 		{
70+ 			name : "nested list" ,
71+ 			config : []any {
72+ 				map [string ]any {
73+ 					"foo" : map [string ]any {
74+ 						"bar" : "baz" ,
75+ 					},
76+ 					"bar" : "baz" ,
77+ 				},
78+ 			},
79+ 			live : []any {
80+ 				map [string ]any {
81+ 					"foo" : map [string ]any {
82+ 						"bar" : "qux" ,
83+ 						"baz" : "qux" ,
84+ 					},
85+ 					"bar" : "baz" ,
86+ 				},
87+ 			},
88+ 			want : []any {
89+ 				map [string ]any {
90+ 					"foo" : map [string ]any {
91+ 						"bar" : "qux" ,
92+ 					},
93+ 					"bar" : "baz" ,
94+ 				},
95+ 			},
96+ 		},
97+ 	}
98+ 	for  _ , tt  :=  range  tests  {
99+ 		t .Run (tt .name , func (t  * testing.T ) {
100+ 			if  got  :=  removeFields (tt .config , tt .live ); ! reflect .DeepEqual (got , tt .want ) {
101+ 				t .Errorf ("removeFields() = %v, want %v" , got , tt .want )
102+ 			}
103+ 		})
104+ 	}
105+ }
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments