@@ -6,6 +6,8 @@ package postgrescluster
66
77import (
88 "context"
9+ "os"
10+ "strings"
911 "testing"
1012 "time"
1113
@@ -190,6 +192,9 @@ func TestReconcileVolumeSnapshots(t *testing.T) {
190192 })
191193
192194 t .Run ("SnapshotsEnabledReadySnapshotsExist" , func (t * testing.T ) {
195+ if strings .EqualFold (os .Getenv ("USE_EXISTING_CLUSTER" ), "true" ) {
196+ t .Skip ("requires mocking of Job conditions" )
197+ }
193198 // Create a volume snapshot class
194199 volumeSnapshotClassName := "my-snapshotclass"
195200 volumeSnapshotClass := & volumesnapshotv1.VolumeSnapshotClass {
@@ -481,6 +486,9 @@ func TestReconcileDedicatedSnapshotVolume(t *testing.T) {
481486 })
482487
483488 t .Run ("SnapshotsEnabledBackupExistsCreateRestore" , func (t * testing.T ) {
489+ if strings .EqualFold (os .Getenv ("USE_EXISTING_CLUSTER" ), "true" ) {
490+ t .Skip ("requires mocking of Job conditions" )
491+ }
484492 // Create cluster with snapshots enabled
485493 ns := setupNamespace (t , cc )
486494 cluster := testCluster ()
@@ -529,6 +537,9 @@ func TestReconcileDedicatedSnapshotVolume(t *testing.T) {
529537 })
530538
531539 t .Run ("SnapshotsEnabledSuccessfulRestoreExists" , func (t * testing.T ) {
540+ if strings .EqualFold (os .Getenv ("USE_EXISTING_CLUSTER" ), "true" ) {
541+ t .Skip ("requires mocking of Job conditions" )
542+ }
532543 // Create cluster with snapshots enabled
533544 ns := setupNamespace (t , cc )
534545 cluster := testCluster ()
@@ -596,6 +607,9 @@ func TestReconcileDedicatedSnapshotVolume(t *testing.T) {
596607 })
597608
598609 t .Run ("SnapshotsEnabledFailedRestoreExists" , func (t * testing.T ) {
610+ if strings .EqualFold (os .Getenv ("USE_EXISTING_CLUSTER" ), "true" ) {
611+ t .Skip ("requires mocking of Job conditions" )
612+ }
599613 // Create cluster with snapshots enabled
600614 ns := setupNamespace (t , cc )
601615 cluster := testCluster ()
@@ -881,6 +895,9 @@ func TestGetLatestCompleteBackupJob(t *testing.T) {
881895 })
882896
883897 t .Run ("OneCompleteBackupJob" , func (t * testing.T ) {
898+ if strings .EqualFold (os .Getenv ("USE_EXISTING_CLUSTER" ), "true" ) {
899+ t .Skip ("requires mocking of Job conditions" )
900+ }
884901 currentTime := metav1 .Now ()
885902 currentStartTime := metav1 .NewTime (currentTime .AddDate (0 , 0 , - 1 ))
886903
@@ -910,6 +927,9 @@ func TestGetLatestCompleteBackupJob(t *testing.T) {
910927 })
911928
912929 t .Run ("TwoCompleteBackupJobs" , func (t * testing.T ) {
930+ if strings .EqualFold (os .Getenv ("USE_EXISTING_CLUSTER" ), "true" ) {
931+ t .Skip ("requires mocking of Job conditions" )
932+ }
913933 currentTime := metav1 .Now ()
914934 currentStartTime := metav1 .NewTime (currentTime .AddDate (0 , 0 , - 1 ))
915935 earlierTime := metav1 .NewTime (currentTime .AddDate (- 1 , 0 , 0 ))
0 commit comments