@@ -37,7 +37,6 @@ import (
37
37
38
38
appsetmetrics "github.com/argoproj/argo-cd/v2/applicationset/metrics"
39
39
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
40
- appclientset "github.com/argoproj/argo-cd/v2/pkg/client/clientset/versioned/fake"
41
40
dbmocks "github.com/argoproj/argo-cd/v2/util/db/mocks"
42
41
43
42
"github.com/argoproj/argo-cd/v2/pkg/apis/application"
@@ -48,9 +47,6 @@ func TestCreateOrUpdateInCluster(t *testing.T) {
48
47
err := v1alpha1 .AddToScheme (scheme )
49
48
require .NoError (t , err )
50
49
51
- err = v1alpha1 .AddToScheme (scheme )
52
- require .NoError (t , err )
53
-
54
50
for _ , c := range []struct {
55
51
// name is human-readable test name
56
52
name string
@@ -1091,9 +1087,6 @@ func TestRemoveFinalizerOnInvalidDestination_FinalizerTypes(t *testing.T) {
1091
1087
err := v1alpha1 .AddToScheme (scheme )
1092
1088
require .NoError (t , err )
1093
1089
1094
- err = v1alpha1 .AddToScheme (scheme )
1095
- require .NoError (t , err )
1096
-
1097
1090
for _ , c := range []struct {
1098
1091
// name is human-readable test name
1099
1092
name string
@@ -1214,9 +1207,6 @@ func TestRemoveFinalizerOnInvalidDestination_DestinationTypes(t *testing.T) {
1214
1207
err := v1alpha1 .AddToScheme (scheme )
1215
1208
require .NoError (t , err )
1216
1209
1217
- err = v1alpha1 .AddToScheme (scheme )
1218
- require .NoError (t , err )
1219
-
1220
1210
for _ , c := range []struct {
1221
1211
// name is human-readable test name
1222
1212
name string
@@ -1371,9 +1361,6 @@ func TestRemoveOwnerReferencesOnDeleteAppSet(t *testing.T) {
1371
1361
err := v1alpha1 .AddToScheme (scheme )
1372
1362
require .NoError (t , err )
1373
1363
1374
- err = v1alpha1 .AddToScheme (scheme )
1375
- require .NoError (t , err )
1376
-
1377
1364
for _ , c := range []struct {
1378
1365
// name is human-readable test name
1379
1366
name string
@@ -1447,9 +1434,6 @@ func TestCreateApplications(t *testing.T) {
1447
1434
err := v1alpha1 .AddToScheme (scheme )
1448
1435
require .NoError (t , err )
1449
1436
1450
- err = v1alpha1 .AddToScheme (scheme )
1451
- require .NoError (t , err )
1452
-
1453
1437
testCases := []struct {
1454
1438
name string
1455
1439
appSet v1alpha1.ApplicationSet
@@ -1653,8 +1637,6 @@ func TestDeleteInCluster(t *testing.T) {
1653
1637
scheme := runtime .NewScheme ()
1654
1638
err := v1alpha1 .AddToScheme (scheme )
1655
1639
require .NoError (t , err )
1656
- err = v1alpha1 .AddToScheme (scheme )
1657
- require .NoError (t , err )
1658
1640
1659
1641
for _ , c := range []struct {
1660
1642
// appSet is the application set on which the delete function is called
@@ -1809,8 +1791,6 @@ func TestGetMinRequeueAfter(t *testing.T) {
1809
1791
scheme := runtime .NewScheme ()
1810
1792
err := v1alpha1 .AddToScheme (scheme )
1811
1793
require .NoError (t , err )
1812
- err = v1alpha1 .AddToScheme (scheme )
1813
- require .NoError (t , err )
1814
1794
1815
1795
client := fake .NewClientBuilder ().WithScheme (scheme ).Build ()
1816
1796
metrics := appsetmetrics .NewFakeAppsetMetrics (client )
@@ -1913,12 +1893,6 @@ func TestValidateGeneratedApplications(t *testing.T) {
1913
1893
err := v1alpha1 .AddToScheme (scheme )
1914
1894
require .NoError (t , err )
1915
1895
1916
- err = v1alpha1 .AddToScheme (scheme )
1917
- require .NoError (t , err )
1918
-
1919
- client := fake .NewClientBuilder ().WithScheme (scheme ).Build ()
1920
- metrics := appsetmetrics .NewFakeAppsetMetrics (client )
1921
-
1922
1896
// Valid cluster
1923
1897
myCluster := v1alpha1.Cluster {
1924
1898
Server : "https://kubernetes.default.svc" ,
@@ -1945,6 +1919,9 @@ func TestValidateGeneratedApplications(t *testing.T) {
1945
1919
},
1946
1920
}
1947
1921
1922
+ client := fake .NewClientBuilder ().WithScheme (scheme ).WithObjects (myProject ).Build ()
1923
+ metrics := appsetmetrics .NewFakeAppsetMetrics (client )
1924
+
1948
1925
// Test a subset of the validations that 'validateGeneratedApplications' performs
1949
1926
for _ , cc := range []struct {
1950
1927
name string
@@ -2094,21 +2071,15 @@ func TestValidateGeneratedApplications(t *testing.T) {
2094
2071
myCluster ,
2095
2072
}}, nil )
2096
2073
2097
- argoObjs := []runtime.Object {myProject }
2098
- for _ , app := range cc .apps {
2099
- argoObjs = append (argoObjs , & app )
2100
- }
2101
-
2102
2074
r := ApplicationSetReconciler {
2103
- Client : client ,
2104
- Scheme : scheme ,
2105
- Recorder : record .NewFakeRecorder (1 ),
2106
- Generators : map [string ]generators.Generator {},
2107
- ArgoDB : & argoDBMock ,
2108
- ArgoCDNamespace : "namespace" ,
2109
- ArgoAppClientset : appclientset .NewSimpleClientset (argoObjs ... ),
2110
- KubeClientset : kubeclientset ,
2111
- Metrics : metrics ,
2075
+ Client : client ,
2076
+ Scheme : scheme ,
2077
+ Recorder : record .NewFakeRecorder (1 ),
2078
+ Generators : map [string ]generators.Generator {},
2079
+ ArgoDB : & argoDBMock ,
2080
+ ArgoCDNamespace : "namespace" ,
2081
+ KubeClientset : kubeclientset ,
2082
+ Metrics : metrics ,
2112
2083
}
2113
2084
2114
2085
appSetInfo := v1alpha1.ApplicationSet {}
@@ -2150,8 +2121,6 @@ func TestReconcilerValidationProjectErrorBehaviour(t *testing.T) {
2150
2121
scheme := runtime .NewScheme ()
2151
2122
err := v1alpha1 .AddToScheme (scheme )
2152
2123
require .NoError (t , err )
2153
- err = v1alpha1 .AddToScheme (scheme )
2154
- require .NoError (t , err )
2155
2124
2156
2125
project := v1alpha1.AppProject {
2157
2126
ObjectMeta : metav1.ObjectMeta {Name : "good-project" , Namespace : "argocd" },
@@ -2190,9 +2159,8 @@ func TestReconcilerValidationProjectErrorBehaviour(t *testing.T) {
2190
2159
2191
2160
kubeclientset := kubefake .NewSimpleClientset ()
2192
2161
argoDBMock := dbmocks.ArgoDB {}
2193
- argoObjs := []runtime.Object {& project }
2194
2162
2195
- client := fake .NewClientBuilder ().WithScheme (scheme ).WithObjects (& appSet ).WithStatusSubresource (& appSet ).WithIndex (& v1alpha1.Application {}, ".metadata.controller" , appControllerIndexer ).Build ()
2163
+ client := fake .NewClientBuilder ().WithScheme (scheme ).WithObjects (& appSet , & project ).WithStatusSubresource (& appSet ).WithIndex (& v1alpha1.Application {}, ".metadata.controller" , appControllerIndexer ).Build ()
2196
2164
metrics := appsetmetrics .NewFakeAppsetMetrics (client )
2197
2165
goodCluster := v1alpha1.Cluster {Server : "https://good-cluster" , Name : "good-cluster" }
2198
2166
badCluster := v1alpha1.Cluster {Server : "https://bad-cluster" , Name : "bad-cluster" }
@@ -2210,12 +2178,11 @@ func TestReconcilerValidationProjectErrorBehaviour(t *testing.T) {
2210
2178
Generators : map [string ]generators.Generator {
2211
2179
"List" : generators .NewListGenerator (),
2212
2180
},
2213
- ArgoDB : & argoDBMock ,
2214
- ArgoAppClientset : appclientset .NewSimpleClientset (argoObjs ... ),
2215
- KubeClientset : kubeclientset ,
2216
- Policy : v1alpha1 .ApplicationsSyncPolicySync ,
2217
- ArgoCDNamespace : "argocd" ,
2218
- Metrics : metrics ,
2181
+ ArgoDB : & argoDBMock ,
2182
+ KubeClientset : kubeclientset ,
2183
+ Policy : v1alpha1 .ApplicationsSyncPolicySync ,
2184
+ ArgoCDNamespace : "argocd" ,
2185
+ Metrics : metrics ,
2219
2186
}
2220
2187
2221
2188
req := ctrl.Request {
@@ -2246,8 +2213,6 @@ func TestSetApplicationSetStatusCondition(t *testing.T) {
2246
2213
scheme := runtime .NewScheme ()
2247
2214
err := v1alpha1 .AddToScheme (scheme )
2248
2215
require .NoError (t , err )
2249
- err = v1alpha1 .AddToScheme (scheme )
2250
- require .NoError (t , err )
2251
2216
2252
2217
testCases := []struct {
2253
2218
appset v1alpha1.ApplicationSet
@@ -2395,7 +2360,6 @@ func TestSetApplicationSetStatusCondition(t *testing.T) {
2395
2360
2396
2361
kubeclientset := kubefake .NewSimpleClientset ([]runtime.Object {}... )
2397
2362
argoDBMock := dbmocks.ArgoDB {}
2398
- argoObjs := []runtime.Object {}
2399
2363
2400
2364
for _ , testCase := range testCases {
2401
2365
client := fake .NewClientBuilder ().WithScheme (scheme ).WithObjects (& testCase .appset ).WithIndex (& v1alpha1.Application {}, ".metadata.controller" , appControllerIndexer ).WithStatusSubresource (& testCase .appset ).Build ()
@@ -2409,10 +2373,9 @@ func TestSetApplicationSetStatusCondition(t *testing.T) {
2409
2373
Generators : map [string ]generators.Generator {
2410
2374
"List" : generators .NewListGenerator (),
2411
2375
},
2412
- ArgoDB : & argoDBMock ,
2413
- ArgoAppClientset : appclientset .NewSimpleClientset (argoObjs ... ),
2414
- KubeClientset : kubeclientset ,
2415
- Metrics : metrics ,
2376
+ ArgoDB : & argoDBMock ,
2377
+ KubeClientset : kubeclientset ,
2378
+ Metrics : metrics ,
2416
2379
}
2417
2380
2418
2381
for _ , condition := range testCase .conditions {
@@ -2428,8 +2391,6 @@ func applicationsUpdateSyncPolicyTest(t *testing.T, applicationsSyncPolicy v1alp
2428
2391
scheme := runtime .NewScheme ()
2429
2392
err := v1alpha1 .AddToScheme (scheme )
2430
2393
require .NoError (t , err )
2431
- err = v1alpha1 .AddToScheme (scheme )
2432
- require .NoError (t , err )
2433
2394
2434
2395
defaultProject := v1alpha1.AppProject {
2435
2396
ObjectMeta : metav1.ObjectMeta {Name : "default" , Namespace : "argocd" },
@@ -2469,9 +2430,8 @@ func applicationsUpdateSyncPolicyTest(t *testing.T, applicationsSyncPolicy v1alp
2469
2430
2470
2431
kubeclientset := kubefake .NewSimpleClientset ()
2471
2432
argoDBMock := dbmocks.ArgoDB {}
2472
- argoObjs := []runtime.Object {& defaultProject }
2473
2433
2474
- client := fake .NewClientBuilder ().WithScheme (scheme ).WithObjects (& appSet ).WithStatusSubresource (& appSet ).WithIndex (& v1alpha1.Application {}, ".metadata.controller" , appControllerIndexer ).Build ()
2434
+ client := fake .NewClientBuilder ().WithScheme (scheme ).WithObjects (& appSet , & defaultProject ).WithStatusSubresource (& appSet ).WithIndex (& v1alpha1.Application {}, ".metadata.controller" , appControllerIndexer ).Build ()
2475
2435
metrics := appsetmetrics .NewFakeAppsetMetrics (client )
2476
2436
goodCluster := v1alpha1.Cluster {Server : "https://good-cluster" , Name : "good-cluster" }
2477
2437
argoDBMock .On ("GetCluster" , mock .Anything , "https://good-cluster" ).Return (& goodCluster , nil )
@@ -2489,7 +2449,6 @@ func applicationsUpdateSyncPolicyTest(t *testing.T, applicationsSyncPolicy v1alp
2489
2449
},
2490
2450
ArgoDB : & argoDBMock ,
2491
2451
ArgoCDNamespace : "argocd" ,
2492
- ArgoAppClientset : appclientset .NewSimpleClientset (argoObjs ... ),
2493
2452
KubeClientset : kubeclientset ,
2494
2453
Policy : v1alpha1 .ApplicationsSyncPolicySync ,
2495
2454
EnablePolicyOverride : allowPolicyOverride ,
@@ -2593,8 +2552,6 @@ func applicationsDeleteSyncPolicyTest(t *testing.T, applicationsSyncPolicy v1alp
2593
2552
scheme := runtime .NewScheme ()
2594
2553
err := v1alpha1 .AddToScheme (scheme )
2595
2554
require .NoError (t , err )
2596
- err = v1alpha1 .AddToScheme (scheme )
2597
- require .NoError (t , err )
2598
2555
2599
2556
defaultProject := v1alpha1.AppProject {
2600
2557
ObjectMeta : metav1.ObjectMeta {Name : "default" , Namespace : "argocd" },
@@ -2634,9 +2591,8 @@ func applicationsDeleteSyncPolicyTest(t *testing.T, applicationsSyncPolicy v1alp
2634
2591
2635
2592
kubeclientset := kubefake .NewSimpleClientset ()
2636
2593
argoDBMock := dbmocks.ArgoDB {}
2637
- argoObjs := []runtime.Object {& defaultProject }
2638
2594
2639
- client := fake .NewClientBuilder ().WithScheme (scheme ).WithObjects (& appSet ).WithStatusSubresource (& appSet ).WithIndex (& v1alpha1.Application {}, ".metadata.controller" , appControllerIndexer ).Build ()
2595
+ client := fake .NewClientBuilder ().WithScheme (scheme ).WithObjects (& appSet , & defaultProject ).WithStatusSubresource (& appSet ).WithIndex (& v1alpha1.Application {}, ".metadata.controller" , appControllerIndexer ).Build ()
2640
2596
metrics := appsetmetrics .NewFakeAppsetMetrics (client )
2641
2597
goodCluster := v1alpha1.Cluster {Server : "https://good-cluster" , Name : "good-cluster" }
2642
2598
argoDBMock .On ("GetCluster" , mock .Anything , "https://good-cluster" ).Return (& goodCluster , nil )
@@ -2654,7 +2610,6 @@ func applicationsDeleteSyncPolicyTest(t *testing.T, applicationsSyncPolicy v1alp
2654
2610
},
2655
2611
ArgoDB : & argoDBMock ,
2656
2612
ArgoCDNamespace : "argocd" ,
2657
- ArgoAppClientset : appclientset .NewSimpleClientset (argoObjs ... ),
2658
2613
KubeClientset : kubeclientset ,
2659
2614
Policy : v1alpha1 .ApplicationsSyncPolicySync ,
2660
2615
EnablePolicyOverride : allowPolicyOverride ,
@@ -2752,9 +2707,6 @@ func TestPolicies(t *testing.T) {
2752
2707
err := v1alpha1 .AddToScheme (scheme )
2753
2708
require .NoError (t , err )
2754
2709
2755
- err = v1alpha1 .AddToScheme (scheme )
2756
- require .NoError (t , err )
2757
-
2758
2710
defaultProject := v1alpha1.AppProject {
2759
2711
ObjectMeta : metav1.ObjectMeta {Name : "default" , Namespace : "argocd" },
2760
2712
Spec : v1alpha1.AppProjectSpec {SourceRepos : []string {"*" }, Destinations : []v1alpha1.ApplicationDestination {{Namespace : "*" , Server : "https://kubernetes.default.svc" }}},
@@ -2767,7 +2719,6 @@ func TestPolicies(t *testing.T) {
2767
2719
kubeclientset := kubefake .NewSimpleClientset ()
2768
2720
argoDBMock := dbmocks.ArgoDB {}
2769
2721
argoDBMock .On ("GetCluster" , mock .Anything , "https://kubernetes.default.svc" ).Return (& myCluster , nil )
2770
- argoObjs := []runtime.Object {& defaultProject }
2771
2722
2772
2723
for _ , c := range []struct {
2773
2724
name string
@@ -2839,7 +2790,7 @@ func TestPolicies(t *testing.T) {
2839
2790
},
2840
2791
}
2841
2792
2842
- client := fake .NewClientBuilder ().WithScheme (scheme ).WithObjects (& appSet ).WithStatusSubresource (& appSet ).WithIndex (& v1alpha1.Application {}, ".metadata.controller" , appControllerIndexer ).Build ()
2793
+ client := fake .NewClientBuilder ().WithScheme (scheme ).WithObjects (& appSet , & defaultProject ).WithStatusSubresource (& appSet ).WithIndex (& v1alpha1.Application {}, ".metadata.controller" , appControllerIndexer ).Build ()
2843
2794
metrics := appsetmetrics .NewFakeAppsetMetrics (client )
2844
2795
2845
2796
r := ApplicationSetReconciler {
@@ -2850,12 +2801,11 @@ func TestPolicies(t *testing.T) {
2850
2801
Generators : map [string ]generators.Generator {
2851
2802
"List" : generators .NewListGenerator (),
2852
2803
},
2853
- ArgoDB : & argoDBMock ,
2854
- ArgoCDNamespace : "argocd" ,
2855
- ArgoAppClientset : appclientset .NewSimpleClientset (argoObjs ... ),
2856
- KubeClientset : kubeclientset ,
2857
- Policy : policy ,
2858
- Metrics : metrics ,
2804
+ ArgoDB : & argoDBMock ,
2805
+ ArgoCDNamespace : "argocd" ,
2806
+ KubeClientset : kubeclientset ,
2807
+ Policy : policy ,
2808
+ Metrics : metrics ,
2859
2809
}
2860
2810
2861
2811
req := ctrl.Request {
@@ -2923,12 +2873,9 @@ func TestSetApplicationSetApplicationStatus(t *testing.T) {
2923
2873
scheme := runtime .NewScheme ()
2924
2874
err := v1alpha1 .AddToScheme (scheme )
2925
2875
require .NoError (t , err )
2926
- err = v1alpha1 .AddToScheme (scheme )
2927
- require .NoError (t , err )
2928
2876
2929
2877
kubeclientset := kubefake .NewSimpleClientset ([]runtime.Object {}... )
2930
2878
argoDBMock := dbmocks.ArgoDB {}
2931
- argoObjs := []runtime.Object {}
2932
2879
2933
2880
for _ , cc := range []struct {
2934
2881
name string
@@ -3012,10 +2959,9 @@ func TestSetApplicationSetApplicationStatus(t *testing.T) {
3012
2959
Generators : map [string ]generators.Generator {
3013
2960
"List" : generators .NewListGenerator (),
3014
2961
},
3015
- ArgoDB : & argoDBMock ,
3016
- ArgoAppClientset : appclientset .NewSimpleClientset (argoObjs ... ),
3017
- KubeClientset : kubeclientset ,
3018
- Metrics : metrics ,
2962
+ ArgoDB : & argoDBMock ,
2963
+ KubeClientset : kubeclientset ,
2964
+ Metrics : metrics ,
3019
2965
}
3020
2966
3021
2967
err = r .setAppSetApplicationStatus (context .TODO (), log .NewEntry (log .StandardLogger ()), & cc .appSet , cc .appStatuses )
@@ -3031,9 +2977,6 @@ func TestBuildAppDependencyList(t *testing.T) {
3031
2977
err := v1alpha1 .AddToScheme (scheme )
3032
2978
require .NoError (t , err )
3033
2979
3034
- err = v1alpha1 .AddToScheme (scheme )
3035
- require .NoError (t , err )
3036
-
3037
2980
client := fake .NewClientBuilder ().WithScheme (scheme ).Build ()
3038
2981
metrics := appsetmetrics .NewFakeAppsetMetrics (client )
3039
2982
@@ -3766,17 +3709,15 @@ func TestBuildAppDependencyList(t *testing.T) {
3766
3709
t .Run (cc .name , func (t * testing.T ) {
3767
3710
kubeclientset := kubefake .NewSimpleClientset ([]runtime.Object {}... )
3768
3711
argoDBMock := dbmocks.ArgoDB {}
3769
- argoObjs := []runtime.Object {}
3770
3712
3771
3713
r := ApplicationSetReconciler {
3772
- Client : client ,
3773
- Scheme : scheme ,
3774
- Recorder : record .NewFakeRecorder (1 ),
3775
- Generators : map [string ]generators.Generator {},
3776
- ArgoDB : & argoDBMock ,
3777
- ArgoAppClientset : appclientset .NewSimpleClientset (argoObjs ... ),
3778
- KubeClientset : kubeclientset ,
3779
- Metrics : metrics ,
3714
+ Client : client ,
3715
+ Scheme : scheme ,
3716
+ Recorder : record .NewFakeRecorder (1 ),
3717
+ Generators : map [string ]generators.Generator {},
3718
+ ArgoDB : & argoDBMock ,
3719
+ KubeClientset : kubeclientset ,
3720
+ Metrics : metrics ,
3780
3721
}
3781
3722
3782
3723
appDependencyList , appStepMap := r .buildAppDependencyList (log .NewEntry (log .StandardLogger ()), cc .appSet , cc .apps )
@@ -3791,9 +3732,6 @@ func TestBuildAppSyncMap(t *testing.T) {
3791
3732
err := v1alpha1 .AddToScheme (scheme )
3792
3733
require .NoError (t , err )
3793
3734
3794
- err = v1alpha1 .AddToScheme (scheme )
3795
- require .NoError (t , err )
3796
-
3797
3735
client := fake .NewClientBuilder ().WithScheme (scheme ).Build ()
3798
3736
metrics := appsetmetrics .NewFakeAppsetMetrics (client )
3799
3737
@@ -4357,17 +4295,15 @@ func TestBuildAppSyncMap(t *testing.T) {
4357
4295
t .Run (cc .name , func (t * testing.T ) {
4358
4296
kubeclientset := kubefake .NewSimpleClientset ([]runtime.Object {}... )
4359
4297
argoDBMock := dbmocks.ArgoDB {}
4360
- argoObjs := []runtime.Object {}
4361
4298
4362
4299
r := ApplicationSetReconciler {
4363
- Client : client ,
4364
- Scheme : scheme ,
4365
- Recorder : record .NewFakeRecorder (1 ),
4366
- Generators : map [string ]generators.Generator {},
4367
- ArgoDB : & argoDBMock ,
4368
- ArgoAppClientset : appclientset .NewSimpleClientset (argoObjs ... ),
4369
- KubeClientset : kubeclientset ,
4370
- Metrics : metrics ,
4300
+ Client : client ,
4301
+ Scheme : scheme ,
4302
+ Recorder : record .NewFakeRecorder (1 ),
4303
+ Generators : map [string ]generators.Generator {},
4304
+ ArgoDB : & argoDBMock ,
4305
+ KubeClientset : kubeclientset ,
4306
+ Metrics : metrics ,
4371
4307
}
4372
4308
4373
4309
appSyncMap := r .buildAppSyncMap (cc .appSet , cc .appDependencyList , cc .appMap )
@@ -4381,9 +4317,6 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
4381
4317
err := v1alpha1 .AddToScheme (scheme )
4382
4318
require .NoError (t , err )
4383
4319
4384
- err = v1alpha1 .AddToScheme (scheme )
4385
- require .NoError (t , err )
4386
-
4387
4320
for _ , cc := range []struct {
4388
4321
name string
4389
4322
appSet v1alpha1.ApplicationSet
@@ -5144,20 +5077,18 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
5144
5077
t .Run (cc .name , func (t * testing.T ) {
5145
5078
kubeclientset := kubefake .NewSimpleClientset ([]runtime.Object {}... )
5146
5079
argoDBMock := dbmocks.ArgoDB {}
5147
- argoObjs := []runtime.Object {}
5148
5080
5149
5081
client := fake .NewClientBuilder ().WithScheme (scheme ).WithObjects (& cc .appSet ).WithStatusSubresource (& cc .appSet ).Build ()
5150
5082
metrics := appsetmetrics .NewFakeAppsetMetrics (client )
5151
5083
5152
5084
r := ApplicationSetReconciler {
5153
- Client : client ,
5154
- Scheme : scheme ,
5155
- Recorder : record .NewFakeRecorder (1 ),
5156
- Generators : map [string ]generators.Generator {},
5157
- ArgoDB : & argoDBMock ,
5158
- ArgoAppClientset : appclientset .NewSimpleClientset (argoObjs ... ),
5159
- KubeClientset : kubeclientset ,
5160
- Metrics : metrics ,
5085
+ Client : client ,
5086
+ Scheme : scheme ,
5087
+ Recorder : record .NewFakeRecorder (1 ),
5088
+ Generators : map [string ]generators.Generator {},
5089
+ ArgoDB : & argoDBMock ,
5090
+ KubeClientset : kubeclientset ,
5091
+ Metrics : metrics ,
5161
5092
}
5162
5093
5163
5094
appStatuses , err := r .updateApplicationSetApplicationStatus (context .TODO (), log .NewEntry (log .StandardLogger ()), & cc .appSet , cc .apps , cc .appStepMap )
@@ -5178,9 +5109,6 @@ func TestUpdateApplicationSetApplicationStatusProgress(t *testing.T) {
5178
5109
err := v1alpha1 .AddToScheme (scheme )
5179
5110
require .NoError (t , err )
5180
5111
5181
- err = v1alpha1 .AddToScheme (scheme )
5182
- require .NoError (t , err )
5183
-
5184
5112
for _ , cc := range []struct {
5185
5113
name string
5186
5114
appSet v1alpha1.ApplicationSet
@@ -5898,20 +5826,18 @@ func TestUpdateApplicationSetApplicationStatusProgress(t *testing.T) {
5898
5826
t .Run (cc .name , func (t * testing.T ) {
5899
5827
kubeclientset := kubefake .NewSimpleClientset ([]runtime.Object {}... )
5900
5828
argoDBMock := dbmocks.ArgoDB {}
5901
- argoObjs := []runtime.Object {}
5902
5829
5903
5830
client := fake .NewClientBuilder ().WithScheme (scheme ).WithObjects (& cc .appSet ).WithStatusSubresource (& cc .appSet ).Build ()
5904
5831
metrics := appsetmetrics .NewFakeAppsetMetrics (client )
5905
5832
5906
5833
r := ApplicationSetReconciler {
5907
- Client : client ,
5908
- Scheme : scheme ,
5909
- Recorder : record .NewFakeRecorder (1 ),
5910
- Generators : map [string ]generators.Generator {},
5911
- ArgoDB : & argoDBMock ,
5912
- ArgoAppClientset : appclientset .NewSimpleClientset (argoObjs ... ),
5913
- KubeClientset : kubeclientset ,
5914
- Metrics : metrics ,
5834
+ Client : client ,
5835
+ Scheme : scheme ,
5836
+ Recorder : record .NewFakeRecorder (1 ),
5837
+ Generators : map [string ]generators.Generator {},
5838
+ ArgoDB : & argoDBMock ,
5839
+ KubeClientset : kubeclientset ,
5840
+ Metrics : metrics ,
5915
5841
}
5916
5842
5917
5843
appStatuses , err := r .updateApplicationSetApplicationStatusProgress (context .TODO (), log .NewEntry (log .StandardLogger ()), & cc .appSet , cc .appSyncMap , cc .appStepMap )
@@ -5932,9 +5858,6 @@ func TestUpdateResourceStatus(t *testing.T) {
5932
5858
err := v1alpha1 .AddToScheme (scheme )
5933
5859
require .NoError (t , err )
5934
5860
5935
- err = v1alpha1 .AddToScheme (scheme )
5936
- require .NoError (t , err )
5937
-
5938
5861
for _ , cc := range []struct {
5939
5862
name string
5940
5863
appSet v1alpha1.ApplicationSet
@@ -6114,20 +6037,18 @@ func TestUpdateResourceStatus(t *testing.T) {
6114
6037
t .Run (cc .name , func (t * testing.T ) {
6115
6038
kubeclientset := kubefake .NewSimpleClientset ([]runtime.Object {}... )
6116
6039
argoDBMock := dbmocks.ArgoDB {}
6117
- argoObjs := []runtime.Object {}
6118
6040
6119
6041
client := fake .NewClientBuilder ().WithScheme (scheme ).WithStatusSubresource (& cc .appSet ).WithObjects (& cc .appSet ).Build ()
6120
6042
metrics := appsetmetrics .NewFakeAppsetMetrics (client )
6121
6043
6122
6044
r := ApplicationSetReconciler {
6123
- Client : client ,
6124
- Scheme : scheme ,
6125
- Recorder : record .NewFakeRecorder (1 ),
6126
- Generators : map [string ]generators.Generator {},
6127
- ArgoDB : & argoDBMock ,
6128
- ArgoAppClientset : appclientset .NewSimpleClientset (argoObjs ... ),
6129
- KubeClientset : kubeclientset ,
6130
- Metrics : metrics ,
6045
+ Client : client ,
6046
+ Scheme : scheme ,
6047
+ Recorder : record .NewFakeRecorder (1 ),
6048
+ Generators : map [string ]generators.Generator {},
6049
+ ArgoDB : & argoDBMock ,
6050
+ KubeClientset : kubeclientset ,
6051
+ Metrics : metrics ,
6131
6052
}
6132
6053
6133
6054
err := r .updateResourcesStatus (context .TODO (), log .NewEntry (log .StandardLogger ()), & cc .appSet , cc .apps )
@@ -6206,20 +6127,18 @@ func TestResourceStatusAreOrdered(t *testing.T) {
6206
6127
t .Run (cc .name , func (t * testing.T ) {
6207
6128
kubeclientset := kubefake .NewSimpleClientset ([]runtime.Object {}... )
6208
6129
argoDBMock := dbmocks.ArgoDB {}
6209
- argoObjs := []runtime.Object {}
6210
6130
6211
6131
client := fake .NewClientBuilder ().WithScheme (scheme ).WithStatusSubresource (& cc .appSet ).WithObjects (& cc .appSet ).Build ()
6212
6132
metrics := appsetmetrics .NewFakeAppsetMetrics (client )
6213
6133
6214
6134
r := ApplicationSetReconciler {
6215
- Client : client ,
6216
- Scheme : scheme ,
6217
- Recorder : record .NewFakeRecorder (1 ),
6218
- Generators : map [string ]generators.Generator {},
6219
- ArgoDB : & argoDBMock ,
6220
- ArgoAppClientset : appclientset .NewSimpleClientset (argoObjs ... ),
6221
- KubeClientset : kubeclientset ,
6222
- Metrics : metrics ,
6135
+ Client : client ,
6136
+ Scheme : scheme ,
6137
+ Recorder : record .NewFakeRecorder (1 ),
6138
+ Generators : map [string ]generators.Generator {},
6139
+ ArgoDB : & argoDBMock ,
6140
+ KubeClientset : kubeclientset ,
6141
+ Metrics : metrics ,
6223
6142
}
6224
6143
6225
6144
err := r .updateResourcesStatus (context .TODO (), log .NewEntry (log .StandardLogger ()), & cc .appSet , cc .apps )
0 commit comments