Skip to content

Commit

Permalink
fix envtest
Browse files Browse the repository at this point in the history
  • Loading branch information
egegunes committed Oct 1, 2024
1 parent 031a6d4 commit e413d3a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
17 changes: 16 additions & 1 deletion internal/controller/postgrescluster/pgbackrest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2683,7 +2683,13 @@ func TestGenerateRestoreJobIntent(t *testing.T) {
}

t.Run("empty", func(t *testing.T) {
err := r.generateRestoreJobIntent(&v1beta1.PostgresCluster{}, "", "",
err := r.generateRestoreJobIntent(&v1beta1.PostgresCluster{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
naming.LabelVersion: "2.5.0",
},
},
}, "", "",
[]string{}, []corev1.VolumeMount{}, []corev1.Volume{},
&v1beta1.PostgresClusterDataSource{}, &batchv1.Job{})
assert.NilError(t, err)
Expand Down Expand Up @@ -2727,6 +2733,9 @@ func TestGenerateRestoreJobIntent(t *testing.T) {
cluster := &v1beta1.PostgresCluster{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
Labels: map[string]string{
naming.LabelVersion: "2.5.0",
},
},
Spec: v1beta1.PostgresClusterSpec{
Metadata: &v1beta1.Metadata{
Expand Down Expand Up @@ -2893,6 +2902,9 @@ func TestObserveRestoreEnv(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{
Name: clusterName,
Namespace: namespace,
Labels: map[string]string{
naming.LabelVersion: "2.5.0",
},
},
}
meta := naming.PGBackRestRestoreJob(cluster)
Expand Down Expand Up @@ -3107,6 +3119,9 @@ func TestPrepareForRestore(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{
Name: clusterName,
Namespace: namespace,
Labels: map[string]string{
naming.LabelVersion: "2.5.0",
},
},
}
meta := naming.PGBackRestRestoreJob(cluster)
Expand Down
8 changes: 7 additions & 1 deletion internal/controller/postgrescluster/volumes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func TestHandlePersistentVolumeClaimError(t *testing.T) {
cluster := new(v1beta1.PostgresCluster)
cluster.Namespace = "ns1"
cluster.Name = "pg2"
cluster.SetLabels(map[string]string{
naming.LabelVersion: "2.5.0",
})

reset := func() {
cluster.Status.Conditions = cluster.Status.Conditions[:0]
Expand Down Expand Up @@ -395,7 +398,7 @@ func TestReconcileConfigureExistingPVCs(t *testing.T) {
Name: "testcluster",
Namespace: ns.GetName(),
Labels: map[string]string{
naming.LabelVersion: "2.3.0",
naming.LabelVersion: "2.5.0",
},
},
Spec: v1beta1.PostgresClusterSpec{
Expand Down Expand Up @@ -657,6 +660,9 @@ func TestReconcileMoveDirectories(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{
Name: "testcluster",
Namespace: ns.GetName(),
Labels: map[string]string{
naming.LabelVersion: "2.5.0",
},
},
Spec: v1beta1.PostgresClusterSpec{
PostgresVersion: 13,
Expand Down

0 comments on commit e413d3a

Please sign in to comment.