Skip to content

Commit 68118e1

Browse files
committed
Update
1 parent 97bf68d commit 68118e1

2 files changed

Lines changed: 12 additions & 25 deletions

File tree

internal/pkg/handler/upgrade.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ func doRollingUpgrade(config util.Config, collectors metrics.Collectors, recorde
205205
}
206206

207207
func rollingUpgrade(clients kube.Clients, config util.Config, upgradeFuncs callbacks.RollingUpgradeFuncs, collectors metrics.Collectors, recorder record.EventRecorder, strategy invokeStrategy) error {
208-
209208
err := PerformAction(clients, config, upgradeFuncs, collectors, recorder, strategy)
210209
if err != nil {
211210
logrus.Errorf("Rolling upgrade for '%s' failed with error = %v", config.ResourceName, err)

internal/pkg/handler/upgrade_test.go

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,18 +1441,16 @@ func TestRollingUpgradeForDeploymentWithConfigmapUsingArs(t *testing.T) {
14411441
deploymentFuncs := GetDeploymentRollingUpgradeFuncs()
14421442
collectors := getCollectors()
14431443

1444-
orgItemFunc := deploymentFuncs.ItemFunc
1445-
orgItemsFunc := deploymentFuncs.ItemsFunc
14461444
itemCalled := 0
14471445
itemsCalled := 0
14481446

14491447
deploymentFuncs.ItemFunc = func(client kube.Clients, namespace string, name string) (runtime.Object, error) {
14501448
itemCalled++
1451-
return orgItemFunc(client, namespace, name)
1449+
return callbacks.GetDeploymentItem(client, namespace, name)
14521450
}
14531451
deploymentFuncs.ItemsFunc = func(client kube.Clients, namespace string) []runtime.Object {
14541452
itemsCalled++
1455-
return orgItemsFunc(client, namespace)
1453+
return callbacks.GetDeploymentItems(client, namespace)
14561454
}
14571455

14581456
err := PerformAction(clients, config, deploymentFuncs, collectors, nil, invokeReloadStrategy)
@@ -1492,18 +1490,16 @@ func TestRollingUpgradeForDeploymentWithPatchAndRetryUsingArs(t *testing.T) {
14921490
assert.True(t, deploymentFuncs.SupportsPatch)
14931491
assert.NotEmpty(t, deploymentFuncs.PatchTemplatesFunc().AnnotationTemplate)
14941492

1495-
orgItemFunc := deploymentFuncs.ItemFunc
1496-
orgItemsFunc := deploymentFuncs.ItemsFunc
14971493
itemCalled := 0
14981494
itemsCalled := 0
14991495

15001496
deploymentFuncs.ItemFunc = func(client kube.Clients, namespace string, name string) (runtime.Object, error) {
15011497
itemCalled++
1502-
return orgItemFunc(client, namespace, name)
1498+
return callbacks.GetDeploymentItem(client, namespace, name)
15031499
}
15041500
deploymentFuncs.ItemsFunc = func(client kube.Clients, namespace string) []runtime.Object {
15051501
itemsCalled++
1506-
return orgItemsFunc(client, namespace)
1502+
return callbacks.GetDeploymentItems(client, namespace)
15071503
}
15081504

15091505
patchCalled := 0
@@ -2238,18 +2234,16 @@ func TestRollingUpgradeForDaemonSetWithConfigmapUsingArs(t *testing.T) {
22382234
daemonSetFuncs := GetDaemonSetRollingUpgradeFuncs()
22392235
collectors := getCollectors()
22402236

2241-
orgItemFunc := daemonSetFuncs.ItemFunc
2242-
orgItemsFunc := daemonSetFuncs.ItemsFunc
22432237
itemCalled := 0
22442238
itemsCalled := 0
22452239

22462240
daemonSetFuncs.ItemFunc = func(client kube.Clients, namespace string, name string) (runtime.Object, error) {
22472241
itemCalled++
2248-
return orgItemFunc(client, namespace, name)
2242+
return callbacks.GetDaemonSetItem(client, namespace, name)
22492243
}
22502244
daemonSetFuncs.ItemsFunc = func(client kube.Clients, namespace string) []runtime.Object {
22512245
itemsCalled++
2252-
return orgItemsFunc(client, namespace)
2246+
return callbacks.GetDaemonSetItems(client, namespace)
22532247
}
22542248

22552249
err := PerformAction(clients, config, daemonSetFuncs, collectors, nil, invokeReloadStrategy)
@@ -2286,18 +2280,16 @@ func TestRollingUpgradeForDaemonSetWithPatchAndRetryUsingArs(t *testing.T) {
22862280
config := getConfigWithAnnotations(envVarPostfix, arsConfigmapName, shaData, options.ConfigmapUpdateOnChangeAnnotation, options.ConfigmapReloaderAutoAnnotation)
22872281
daemonSetFuncs := GetDaemonSetRollingUpgradeFuncs()
22882282

2289-
orgItemFunc := daemonSetFuncs.ItemFunc
2290-
orgItemsFunc := daemonSetFuncs.ItemsFunc
22912283
itemCalled := 0
22922284
itemsCalled := 0
22932285

22942286
daemonSetFuncs.ItemFunc = func(client kube.Clients, namespace string, name string) (runtime.Object, error) {
22952287
itemCalled++
2296-
return orgItemFunc(client, namespace, name)
2288+
return callbacks.GetDaemonSetItem(client, namespace, name)
22972289
}
22982290
daemonSetFuncs.ItemsFunc = func(client kube.Clients, namespace string) []runtime.Object {
22992291
itemsCalled++
2300-
return orgItemsFunc(client, namespace)
2292+
return callbacks.GetDaemonSetItems(client, namespace)
23012293
}
23022294

23032295
assert.True(t, daemonSetFuncs.SupportsPatch)
@@ -2473,18 +2465,16 @@ func TestRollingUpgradeForStatefulSetWithConfigmapUsingArs(t *testing.T) {
24732465
statefulSetFuncs := GetStatefulSetRollingUpgradeFuncs()
24742466
collectors := getCollectors()
24752467

2476-
orgItemFunc := statefulSetFuncs.ItemFunc
2477-
orgItemsFunc := statefulSetFuncs.ItemsFunc
24782468
itemCalled := 0
24792469
itemsCalled := 0
24802470

24812471
statefulSetFuncs.ItemFunc = func(client kube.Clients, namespace string, name string) (runtime.Object, error) {
24822472
itemCalled++
2483-
return orgItemFunc(client, namespace, name)
2473+
return callbacks.GetStatefulSetItem(client, namespace, name)
24842474
}
24852475
statefulSetFuncs.ItemsFunc = func(client kube.Clients, namespace string) []runtime.Object {
24862476
itemsCalled++
2487-
return orgItemsFunc(client, namespace)
2477+
return callbacks.GetStatefulSetItems(client, namespace)
24882478
}
24892479

24902480
err := PerformAction(clients, config, statefulSetFuncs, collectors, nil, invokeReloadStrategy)
@@ -2521,18 +2511,16 @@ func TestRollingUpgradeForStatefulSetWithPatchAndRetryUsingArs(t *testing.T) {
25212511
config := getConfigWithAnnotations(envVarPostfix, arsConfigmapName, shaData, options.ConfigmapUpdateOnChangeAnnotation, options.ConfigmapReloaderAutoAnnotation)
25222512
statefulSetFuncs := GetStatefulSetRollingUpgradeFuncs()
25232513

2524-
orgItemFunc := statefulSetFuncs.ItemFunc
2525-
orgItemsFunc := statefulSetFuncs.ItemsFunc
25262514
itemCalled := 0
25272515
itemsCalled := 0
25282516

25292517
statefulSetFuncs.ItemFunc = func(client kube.Clients, namespace string, name string) (runtime.Object, error) {
25302518
itemCalled++
2531-
return orgItemFunc(client, namespace, name)
2519+
return callbacks.GetStatefulSetItem(client, namespace, name)
25322520
}
25332521
statefulSetFuncs.ItemsFunc = func(client kube.Clients, namespace string) []runtime.Object {
25342522
itemsCalled++
2535-
return orgItemsFunc(client, namespace)
2523+
return callbacks.GetStatefulSetItems(client, namespace)
25362524
}
25372525

25382526
assert.True(t, statefulSetFuncs.SupportsPatch)

0 commit comments

Comments
 (0)