39
39
reclaimPolicyDelete = corev1 .PersistentVolumeReclaimDelete
40
40
secrets = crutils .GetImagePullSecrets (ibmObjectCSICR .Spec .ImagePullSecrets )
41
41
42
+ operatorDeploymnet = & appsv1.Deployment {
43
+ ObjectMeta : metav1.ObjectMeta {
44
+ Name : constants .DeploymentName ,
45
+ Namespace : constants .CSIOperatorNamespace ,
46
+ },
47
+ }
48
+
42
49
ibmObjectCSIReconcileRequest = reconcile.Request {
43
50
NamespacedName : types.NamespacedName {
44
51
Name : ibmObjectCSICRName ,
@@ -503,6 +510,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
503
510
{
504
511
testCaseName : "Positive: Successful" ,
505
512
objects : []runtime.Object {
513
+ operatorDeploymnet ,
506
514
ibmObjectCSICR ,
507
515
addonConfigMap ,
508
516
csiNode ,
@@ -528,6 +536,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
528
536
{
529
537
testCaseName : "Positive: Sync controller deployment & pod containers and update status in IBMObjectCSI CR" ,
530
538
objects : []runtime.Object {
539
+ operatorDeploymnet ,
531
540
ibmObjectCSICRWithAWSProvider ,
532
541
addonConfigMap ,
533
542
csiNode ,
@@ -557,6 +566,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
557
566
{
558
567
testCaseName : "Positive: Successfully updated status in IBMObjectCSI CR after validating if pod images are in sync" ,
559
568
objects : []runtime.Object {
569
+ operatorDeploymnet ,
560
570
ibmObjectCSICR ,
561
571
addonConfigMap ,
562
572
controllerSA ,
@@ -599,6 +609,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
599
609
{
600
610
testCaseName : "Positive: Successfully removed finaliser from IBMObjectCSI CR" ,
601
611
objects : []runtime.Object {
612
+ operatorDeploymnet ,
602
613
ibmObjectCSICRWithDeletionTS ,
603
614
},
604
615
clientFunc : func (objs []runtime.Object ) client.WithWatch {
@@ -619,6 +630,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
619
630
{
620
631
testCaseName : "Negative: Failed to Add Finalizer in IBMObjectCSI CR" ,
621
632
objects : []runtime.Object {
633
+ operatorDeploymnet ,
622
634
ibmObjectCSICR ,
623
635
},
624
636
clientFunc : func (objs []runtime.Object ) client.WithWatch {
@@ -642,6 +654,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
642
654
{
643
655
testCaseName : "Negative: configmap not found" ,
644
656
objects : []runtime.Object {
657
+ operatorDeploymnet ,
645
658
ibmObjectCSICR ,
646
659
},
647
660
clientFunc : func (objs []runtime.Object ) client.WithWatch {
@@ -653,6 +666,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
653
666
{
654
667
testCaseName : "Negative: Failed to update IBMObjectCSI CR as per updated configmap data" ,
655
668
objects : []runtime.Object {
669
+ operatorDeploymnet ,
656
670
ibmObjectCSICR ,
657
671
addonConfigMapWithUpdatedData ,
658
672
},
@@ -665,6 +679,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
665
679
{
666
680
testCaseName : "Positive: IBMObjectCSI CR updated as per updated configmap data" ,
667
681
objects : []runtime.Object {
682
+ operatorDeploymnet ,
668
683
ibmObjectCSICR ,
669
684
addonConfigMapWithUpdatedData ,
670
685
},
@@ -677,6 +692,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
677
692
{
678
693
testCaseName : "Negative: Failed to create CSI driver while reconciling" ,
679
694
objects : []runtime.Object {
695
+ operatorDeploymnet ,
680
696
ibmObjectCSICR ,
681
697
addonConfigMap ,
682
698
},
@@ -689,6 +705,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
689
705
{
690
706
testCaseName : "Negative: Failed to get CSI driver while reconciling" ,
691
707
objects : []runtime.Object {
708
+ operatorDeploymnet ,
692
709
ibmObjectCSICR ,
693
710
addonConfigMap ,
694
711
},
@@ -701,6 +718,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
701
718
{
702
719
testCaseName : "Negative: Failed to create service account while reconciling" ,
703
720
objects : []runtime.Object {
721
+ operatorDeploymnet ,
704
722
ibmObjectCSICR ,
705
723
addonConfigMap ,
706
724
csiDriver ,
@@ -739,6 +757,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
739
757
{
740
758
testCaseName : "Negative: Failed to restart node while reconciling" ,
741
759
objects : []runtime.Object {
760
+ operatorDeploymnet ,
742
761
ibmObjectCSICRWithFinaliser ,
743
762
addonConfigMap ,
744
763
csiNode ,
@@ -754,6 +773,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
754
773
{
755
774
testCaseName : "Failed to get service account while reconciling" ,
756
775
objects : []runtime.Object {
776
+ operatorDeploymnet ,
757
777
ibmObjectCSICR ,
758
778
addonConfigMap ,
759
779
},
@@ -766,6 +786,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
766
786
{
767
787
testCaseName : "Negative: Failed to get controller pod while reconciling" ,
768
788
objects : []runtime.Object {
789
+ operatorDeploymnet ,
769
790
ibmObjectCSICRWithFinaliser ,
770
791
addonConfigMap ,
771
792
csiNode ,
@@ -794,6 +815,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
794
815
{
795
816
testCaseName : "Negative: Failed to sync CSI Controller" ,
796
817
objects : []runtime.Object {
818
+ operatorDeploymnet ,
797
819
ibmObjectCSICRWithFinaliser ,
798
820
addonConfigMap ,
799
821
controllerSA ,
@@ -816,6 +838,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
816
838
{
817
839
testCaseName : "Negative: Failed to sync CSI Node" ,
818
840
objects : []runtime.Object {
841
+ operatorDeploymnet ,
819
842
ibmObjectCSICRWithFinaliser ,
820
843
addonConfigMap ,
821
844
controllerSA ,
@@ -831,6 +854,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
831
854
{
832
855
testCaseName : "Negative: Failed to create storage class while reconciling" ,
833
856
objects : []runtime.Object {
857
+ operatorDeploymnet ,
834
858
ibmObjectCSICRWithAWSProvider ,
835
859
addonConfigMap ,
836
860
csiNode ,
@@ -846,6 +870,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
846
870
{
847
871
testCaseName : "Negative: Failed to update status in IBMObjectCSI CR" ,
848
872
objects : []runtime.Object {
873
+ operatorDeploymnet ,
849
874
ibmObjectCSICRWithFinaliser ,
850
875
addonConfigMap ,
851
876
controllerSA ,
@@ -885,6 +910,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
885
910
{
886
911
testCaseName : "Negative: IBMObjectCSI CR is deleted and failed to delete cluster role binding" ,
887
912
objects : []runtime.Object {
913
+ operatorDeploymnet ,
888
914
ibmObjectCSICRWithDeletionTS ,
889
915
externalProvisionerCRB ,
890
916
controllerSCCCRB ,
@@ -899,6 +925,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
899
925
{
900
926
testCaseName : "Negative: IBMObjectCSI CR is deleted and failed to delete cluster role" ,
901
927
objects : []runtime.Object {
928
+ operatorDeploymnet ,
902
929
ibmObjectCSICRWithDeletionTS ,
903
930
externalProvisionerCR ,
904
931
controllerSCCCR ,
@@ -913,6 +940,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
913
940
{
914
941
testCaseName : "Negative: IBMObjectCSI CR is deleted and failed to delete storage class" ,
915
942
objects : []runtime.Object {
943
+ operatorDeploymnet ,
916
944
ibmObjectCSICRWithDeletionTS ,
917
945
rCloneSC ,
918
946
rCloneRetainSC ,
@@ -928,6 +956,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
928
956
{
929
957
testCaseName : "Negative: IBMObjectCSI CR is deleted and failed to delete CSI driver" ,
930
958
objects : []runtime.Object {
959
+ operatorDeploymnet ,
931
960
ibmObjectCSICRWithDeletionTS ,
932
961
csiDriver ,
933
962
},
@@ -940,6 +969,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
940
969
{
941
970
testCaseName : "Negative: Failed to get CSI driver while deleting" ,
942
971
objects : []runtime.Object {
972
+ operatorDeploymnet ,
943
973
& v1alpha1.IBMObjectCSI {
944
974
ObjectMeta : ibmObjectCSICRWithDeletionTS .ObjectMeta ,
945
975
Spec : ibmObjectCSICR .Spec ,
@@ -954,6 +984,7 @@ func TestIBMObjectCSIReconcile(t *testing.T) {
954
984
{
955
985
testCaseName : "Negative: Failed to remove finaliser from IBMObjectCSI CR" ,
956
986
objects : []runtime.Object {
987
+ operatorDeploymnet ,
957
988
& v1alpha1.IBMObjectCSI {
958
989
ObjectMeta : ibmObjectCSICRWithDeletionTS .ObjectMeta ,
959
990
Spec : ibmObjectCSICR .Spec ,
0 commit comments