Skip to content

Commit dbf361c

Browse files
fix unit test
1 parent 7d2dfa1 commit dbf361c

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook_test.go

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
467467
kcp: validUpdate,
468468
},
469469
{
470-
name: "should return error when trying to mutate the kubeadmconfigspec initconfiguration",
471-
expectErr: true,
470+
name: "should not return error when trying to mutate the kubeadmconfigspec initconfiguration",
471+
expectErr: false,
472472
before: before,
473473
kcp: invalidUpdateKubeadmConfigInit,
474474
},
@@ -479,14 +479,14 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
479479
kcp: validUpdateKubeadmConfigInit,
480480
},
481481
{
482-
name: "should return error when trying to mutate the kubeadmconfigspec clusterconfiguration",
483-
expectErr: true,
482+
name: "should not return error when trying to mutate the kubeadmconfigspec clusterconfiguration",
483+
expectErr: false,
484484
before: before,
485485
kcp: invalidUpdateKubeadmConfigCluster,
486486
},
487487
{
488-
name: "should return error when trying to mutate the kubeadmconfigspec joinconfiguration",
489-
expectErr: true,
488+
name: "should not return error when trying to mutate the kubeadmconfigspec joinconfiguration",
489+
expectErr: false,
490490
before: before,
491491
kcp: invalidUpdateKubeadmConfigJoin,
492492
},
@@ -545,38 +545,38 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
545545
kcp: etcdLocalImageInvalidTag,
546546
},
547547
{
548-
name: "should fail when making a change to the cluster config's networking struct",
549-
expectErr: true,
548+
name: "should not fail when making a change to the cluster config's networking struct",
549+
expectErr: false,
550550
before: before,
551551
kcp: networking,
552552
},
553553
{
554-
name: "should fail when making a change to the cluster config's kubernetes version",
555-
expectErr: true,
554+
name: "should not fail when making a change to the cluster config's kubernetes version",
555+
expectErr: false,
556556
before: before,
557557
kcp: kubernetesVersion,
558558
},
559559
{
560-
name: "should fail when making a change to the cluster config's controlPlaneEndpoint",
561-
expectErr: true,
560+
name: "should not fail when making a change to the cluster config's controlPlaneEndpoint",
561+
expectErr: false,
562562
before: before,
563563
kcp: controlPlaneEndpoint,
564564
},
565565
{
566-
name: "should fail when making a change to the cluster config's apiServer",
567-
expectErr: true,
566+
name: "should not fail when making a change to the cluster config's apiServer",
567+
expectErr: false,
568568
before: before,
569569
kcp: apiServer,
570570
},
571571
{
572-
name: "should fail when making a change to the cluster config's controllerManager",
573-
expectErr: true,
572+
name: "should not fail when making a change to the cluster config's controllerManager",
573+
expectErr: false,
574574
before: before,
575575
kcp: controllerManager,
576576
},
577577
{
578-
name: "should fail when making a change to the cluster config's scheduler",
579-
expectErr: true,
578+
name: "should not fail when making a change to the cluster config's scheduler",
579+
expectErr: false,
580580
before: before,
581581
kcp: scheduler,
582582
},
@@ -617,8 +617,8 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
617617
kcp: dnsInvalidCoreDNSToVersion,
618618
},
619619
{
620-
name: "should fail when making a change to the cluster config's certificatesDir",
621-
expectErr: true,
620+
name: "should not fail when making a change to the cluster config's certificatesDir",
621+
expectErr: false,
622622
before: before,
623623
kcp: certificatesDir,
624624
},
@@ -629,56 +629,56 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
629629
kcp: imageRepository,
630630
},
631631
{
632-
name: "should fail when making a change to the cluster config's useHyperKubeImage field",
633-
expectErr: true,
632+
name: "should not fail when making a change to the cluster config's useHyperKubeImage field",
633+
expectErr: false,
634634
before: before,
635635
kcp: useHyperKubeImage,
636636
},
637637
{
638-
name: "should fail when making a change to the cluster config's featureGates",
639-
expectErr: true,
638+
name: "should not fail when making a change to the cluster config's featureGates",
639+
expectErr: false,
640640
before: before,
641641
kcp: featureGates,
642642
},
643643
{
644-
name: "should fail when making a change to the cluster config's local etcd's configuration localDataDir field",
645-
expectErr: true,
644+
name: "should not fail when making a change to the cluster config's local etcd's configuration localDataDir field",
645+
expectErr: false,
646646
before: before,
647647
kcp: localDataDir,
648648
},
649649
{
650-
name: "should fail when making a change to the cluster config's local etcd's configuration localPeerCertSANs field",
651-
expectErr: true,
650+
name: "should not fail when making a change to the cluster config's local etcd's configuration localPeerCertSANs field",
651+
expectErr: false,
652652
before: before,
653653
kcp: localPeerCertSANs,
654654
},
655655
{
656-
name: "should fail when making a change to the cluster config's local etcd's configuration localServerCertSANs field",
657-
expectErr: true,
656+
name: "should not fail when making a change to the cluster config's local etcd's configuration localServerCertSANs field",
657+
expectErr: false,
658658
before: before,
659659
kcp: localServerCertSANs,
660660
},
661661
{
662-
name: "should fail when making a change to the cluster config's local etcd's configuration localExtraArgs field",
663-
expectErr: true,
662+
name: "should not fail when making a change to the cluster config's local etcd's configuration localExtraArgs field",
663+
expectErr: false,
664664
before: before,
665665
kcp: localExtraArgs,
666666
},
667667
{
668-
name: "should fail when making a change to the cluster config's external etcd's configuration",
669-
expectErr: true,
668+
name: "should not fail when making a change to the cluster config's external etcd's configuration",
669+
expectErr: false,
670670
before: before,
671671
kcp: externalEtcd,
672672
},
673673
{
674-
name: "should fail when attempting to unset the etcd local object",
675-
expectErr: true,
674+
name: "should not fail when attempting to unset the etcd local object",
675+
expectErr: false,
676676
before: etcdLocalImageTag,
677677
kcp: unsetEtcd,
678678
},
679679
{
680-
name: "should fail when modifying a field that is not the local etcd image metadata",
681-
expectErr: true,
680+
name: "should not fail when modifying a field that is not the local etcd image metadata",
681+
expectErr: false,
682682
before: localDataDir,
683683
kcp: modifyLocalDataDir,
684684
},

0 commit comments

Comments
 (0)