Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions internal/controller/postgrescluster/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"errors"
"fmt"
"io"
"os"
"strings"
"testing"

"github.com/go-logr/logr/funcr"
Expand Down Expand Up @@ -526,6 +528,9 @@ volumeMode: Filesystem
})

t.Run("DataVolumeSourceClusterWithGoodSnapshot", func(t *testing.T) {
if strings.EqualFold(os.Getenv("USE_EXISTING_CLUSTER"), "true") {
t.Skip("requires mocking of Job conditions")
}
cluster := testCluster()
ns := setupNamespace(t, tClient)
cluster.Namespace = ns.Name
Expand Down
20 changes: 20 additions & 0 deletions internal/controller/postgrescluster/snapshots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package postgrescluster

import (
"context"
"os"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -180,6 +182,9 @@ func TestReconcileVolumeSnapshots(t *testing.T) {
})

t.Run("SnapshotsEnabledReadySnapshotsExist", func(t *testing.T) {
if strings.EqualFold(os.Getenv("USE_EXISTING_CLUSTER"), "true") {
t.Skip("requires mocking of Job conditions")
}
// Create a volume snapshot class
volumeSnapshotClassName := "my-snapshotclass"
volumeSnapshotClass := &volumesnapshotv1.VolumeSnapshotClass{
Expand Down Expand Up @@ -454,6 +459,9 @@ func TestReconcileDedicatedSnapshotVolume(t *testing.T) {
})

t.Run("SnapshotsEnabledBackupExistsCreateRestore", func(t *testing.T) {
if strings.EqualFold(os.Getenv("USE_EXISTING_CLUSTER"), "true") {
t.Skip("requires mocking of Job conditions")
}
// Create cluster with snapshots enabled
ns := setupNamespace(t, cc)
cluster := testCluster()
Expand Down Expand Up @@ -499,6 +507,9 @@ func TestReconcileDedicatedSnapshotVolume(t *testing.T) {
})

t.Run("SnapshotsEnabledSuccessfulRestoreExists", func(t *testing.T) {
if strings.EqualFold(os.Getenv("USE_EXISTING_CLUSTER"), "true") {
t.Skip("requires mocking of Job conditions")
}
// Create cluster with snapshots enabled
ns := setupNamespace(t, cc)
cluster := testCluster()
Expand Down Expand Up @@ -561,6 +572,9 @@ func TestReconcileDedicatedSnapshotVolume(t *testing.T) {
})

t.Run("SnapshotsEnabledFailedRestoreExists", func(t *testing.T) {
if strings.EqualFold(os.Getenv("USE_EXISTING_CLUSTER"), "true") {
t.Skip("requires mocking of Job conditions")
}
// Create cluster with snapshots enabled
ns := setupNamespace(t, cc)
cluster := testCluster()
Expand Down Expand Up @@ -837,6 +851,9 @@ func TestGetLatestCompleteBackupJob(t *testing.T) {
})

t.Run("OneCompleteBackupJob", func(t *testing.T) {
if strings.EqualFold(os.Getenv("USE_EXISTING_CLUSTER"), "true") {
t.Skip("requires mocking of Job conditions")
}
currentTime := metav1.Now()
currentStartTime := metav1.NewTime(currentTime.AddDate(0, 0, -1))

Expand Down Expand Up @@ -864,6 +881,9 @@ func TestGetLatestCompleteBackupJob(t *testing.T) {
})

t.Run("TwoCompleteBackupJobs", func(t *testing.T) {
if strings.EqualFold(os.Getenv("USE_EXISTING_CLUSTER"), "true") {
t.Skip("requires mocking of Job conditions")
}
currentTime := metav1.Now()
currentStartTime := metav1.NewTime(currentTime.AddDate(0, 0, -1))
earlierTime := metav1.NewTime(currentTime.AddDate(-1, 0, 0))
Expand Down
Loading