Skip to content

Commit 50fc47a

Browse files
rebase and fix unit tests
1 parent a716e1b commit 50fc47a

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

controllers/registry_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1938,7 +1938,7 @@ func Test_replaceCarriageReturn(t *testing.T) {
19381938
{
19391939
name: "Given secret data with carriage return, carriage return is replaced with new line",
19401940
args: args{
1941-
data: secretDataWithCarriageReturnInSecret,
1941+
data: secretDataWithCarriageReturnInSecret,
19421942
logger: logr.FromContextOrDiscard(context.TODO()),
19431943
},
19441944
want: secretDataWithEqualInSecret,

controllers/velero_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) {
646646
"app.kubernetes.io/managed-by": common.OADPOperator,
647647
"app.kubernetes.io/component": Server,
648648
oadpv1alpha1.OadpOperatorLabel: "True",
649+
"component": "velero",
649650
},
650651
},
651652
},
@@ -693,6 +694,7 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) {
693694
"app.kubernetes.io/managed-by": common.OADPOperator,
694695
"app.kubernetes.io/component": Server,
695696
oadpv1alpha1.OadpOperatorLabel: "True",
697+
"component": "velero",
696698
},
697699
},
698700
TypeMeta: metav1.TypeMeta{
@@ -707,6 +709,7 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) {
707709
"app.kubernetes.io/managed-by": common.OADPOperator,
708710
"app.kubernetes.io/component": Server,
709711
oadpv1alpha1.OadpOperatorLabel: "True",
712+
"component": "velero",
710713
},
711714
},
712715
Replicas: pointer.Int32(1),
@@ -718,6 +721,7 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) {
718721
"app.kubernetes.io/managed-by": common.OADPOperator,
719722
"app.kubernetes.io/component": Server,
720723
oadpv1alpha1.OadpOperatorLabel: "True",
724+
"component": "velero",
721725
},
722726
Annotations: map[string]string{
723727
"prometheus.io/scrape": "true",
@@ -841,6 +845,7 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) {
841845
"app.kubernetes.io/managed-by": common.OADPOperator,
842846
"app.kubernetes.io/component": Server,
843847
oadpv1alpha1.OadpOperatorLabel: "True",
848+
"component": "velero",
844849
},
845850
},
846851
},
@@ -883,6 +888,7 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) {
883888
"app.kubernetes.io/managed-by": common.OADPOperator,
884889
"app.kubernetes.io/component": Server,
885890
oadpv1alpha1.OadpOperatorLabel: "True",
891+
"component": "velero",
886892
},
887893
},
888894
TypeMeta: metav1.TypeMeta{
@@ -897,6 +903,7 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) {
897903
"app.kubernetes.io/managed-by": common.OADPOperator,
898904
"app.kubernetes.io/component": Server,
899905
oadpv1alpha1.OadpOperatorLabel: "True",
906+
"component": "velero",
900907
},
901908
},
902909
Replicas: pointer.Int32(1),
@@ -908,6 +915,7 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) {
908915
"app.kubernetes.io/managed-by": common.OADPOperator,
909916
"app.kubernetes.io/component": Server,
910917
oadpv1alpha1.OadpOperatorLabel: "True",
918+
"component": "velero",
911919
},
912920
Annotations: map[string]string{
913921
"prometheus.io/scrape": "true",

tests/e2e/dpa_deployment_suite_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() {
2323
bslConfig := Dpa.Spec.BackupLocations[0].Velero.Config
2424

2525
type InstallCase struct {
26-
Name string
27-
BRestoreType BackupRestoreType
28-
DpaSpec *oadpv1alpha1.DataProtectionApplicationSpec
26+
Name string
27+
BRestoreType BackupRestoreType
28+
DpaSpec *oadpv1alpha1.DataProtectionApplicationSpec
2929
TestCarriageReturn bool
30-
WantError bool
30+
WantError bool
3131
}
3232

3333
genericTests := []TableEntry{
@@ -64,8 +64,8 @@ var _ = Describe("Configuration testing for DPA Custom Resource", func() {
6464
WantError: false,
6565
}, nil),
6666
Entry("Default velero CR, test carriage return", InstallCase{
67-
Name: "default-cr",
68-
BRestoreType: RESTIC,
67+
Name: "default-cr",
68+
BRestoreType: RESTIC,
6969
TestCarriageReturn: true,
7070
DpaSpec: &oadpv1alpha1.DataProtectionApplicationSpec{
7171
Configuration: &oadpv1alpha1.ApplicationConfig{

tests/e2e/lib/dpa_helpers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (v *DpaCustomResource) CreateOrUpdate(spec *oadpv1alpha1.DataProtectionAppl
148148
func (v *DpaCustomResource) CreateOrUpdateWithRetries(spec *oadpv1alpha1.DataProtectionApplicationSpec, retries int) error {
149149
var (
150150
err error
151-
cr *oadpv1alpha1.DataProtectionApplication
151+
cr *oadpv1alpha1.DataProtectionApplication
152152
)
153153
for i := 0; i < retries; i++ {
154154
if cr, err = v.Get(); apierrors.IsNotFound(err) {
@@ -159,9 +159,9 @@ func (v *DpaCustomResource) CreateOrUpdateWithRetries(spec *oadpv1alpha1.DataPro
159159
return err
160160
}
161161
cr.Spec = *spec
162-
if err = v.Client.Update(context.Background(), cr); err != nil{
162+
if err = v.Client.Update(context.Background(), cr); err != nil {
163163
if apierrors.IsConflict(err) && i < retries-1 {
164-
log.Println("conflict detected during DPA CreateOrUpdate, retrying for ", retries - i - 1 , " more times")
164+
log.Println("conflict detected during DPA CreateOrUpdate, retrying for ", retries-i-1, " more times")
165165
time.Sleep(time.Second * 2)
166166
continue
167167
}

0 commit comments

Comments
 (0)