@@ -6,6 +6,8 @@ package postgrescluster
66
77import (
88 "context"
9+ "os"
10+ "strings"
911 "testing"
1012 "time"
1113
@@ -181,6 +183,9 @@ func TestReconcileVolumeSnapshots(t *testing.T) {
181183 })
182184
183185 t .Run ("SnapshotsEnabledReadySnapshotsExist" , func (t * testing.T ) {
186+ if strings .EqualFold (os .Getenv ("USE_EXISTING_CLUSTER" ), "true" ) {
187+ t .Skip ("requires mocking of Job conditions" )
188+ }
184189 // Create a volume snapshot class
185190 volumeSnapshotClassName := "my-snapshotclass"
186191 volumeSnapshotClass := & volumesnapshotv1.VolumeSnapshotClass {
@@ -455,6 +460,9 @@ func TestReconcileDedicatedSnapshotVolume(t *testing.T) {
455460 })
456461
457462 t .Run ("SnapshotsEnabledBackupExistsCreateRestore" , func (t * testing.T ) {
463+ if strings .EqualFold (os .Getenv ("USE_EXISTING_CLUSTER" ), "true" ) {
464+ t .Skip ("requires mocking of Job conditions" )
465+ }
458466 // Create cluster with snapshots enabled
459467 ns := setupNamespace (t , cc )
460468 cluster := testCluster ()
@@ -500,6 +508,9 @@ func TestReconcileDedicatedSnapshotVolume(t *testing.T) {
500508 })
501509
502510 t .Run ("SnapshotsEnabledSuccessfulRestoreExists" , func (t * testing.T ) {
511+ if strings .EqualFold (os .Getenv ("USE_EXISTING_CLUSTER" ), "true" ) {
512+ t .Skip ("requires mocking of Job conditions" )
513+ }
503514 // Create cluster with snapshots enabled
504515 ns := setupNamespace (t , cc )
505516 cluster := testCluster ()
@@ -562,6 +573,9 @@ func TestReconcileDedicatedSnapshotVolume(t *testing.T) {
562573 })
563574
564575 t .Run ("SnapshotsEnabledFailedRestoreExists" , func (t * testing.T ) {
576+ if strings .EqualFold (os .Getenv ("USE_EXISTING_CLUSTER" ), "true" ) {
577+ t .Skip ("requires mocking of Job conditions" )
578+ }
565579 // Create cluster with snapshots enabled
566580 ns := setupNamespace (t , cc )
567581 cluster := testCluster ()
@@ -838,6 +852,9 @@ func TestGetLatestCompleteBackupJob(t *testing.T) {
838852 })
839853
840854 t .Run ("OneCompleteBackupJob" , func (t * testing.T ) {
855+ if strings .EqualFold (os .Getenv ("USE_EXISTING_CLUSTER" ), "true" ) {
856+ t .Skip ("requires mocking of Job conditions" )
857+ }
841858 currentTime := metav1 .Now ()
842859 currentStartTime := metav1 .NewTime (currentTime .AddDate (0 , 0 , - 1 ))
843860
@@ -865,6 +882,9 @@ func TestGetLatestCompleteBackupJob(t *testing.T) {
865882 })
866883
867884 t .Run ("TwoCompleteBackupJobs" , func (t * testing.T ) {
885+ if strings .EqualFold (os .Getenv ("USE_EXISTING_CLUSTER" ), "true" ) {
886+ t .Skip ("requires mocking of Job conditions" )
887+ }
868888 currentTime := metav1 .Now ()
869889 currentStartTime := metav1 .NewTime (currentTime .AddDate (0 , 0 , - 1 ))
870890 earlierTime := metav1 .NewTime (currentTime .AddDate (- 1 , 0 , 0 ))
0 commit comments