Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Lower Consistently() duration from 10s to 1s #5

Merged
merged 1 commit into from
Jun 10, 2024
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
2 changes: 1 addition & 1 deletion controllers/drcluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func drclusterConditionExpect(
case false:
Eventually(testFunc, timeout, interval).Should(matchElements)
case true:
Consistently(testFunc, timeout, interval).Should(matchElements)
Consistently(testFunc).Should(matchElements)
}

// TODO: Validate finaliziers and labels
Expand Down
4 changes: 2 additions & 2 deletions controllers/drplacementcontrol_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ func ensureDRPolicyIsNotDeleted(drpc *rmn.DRPlacementControl) {
err := apiReader.Get(context.TODO(), types.NamespacedName{Name: name}, drpolicy)
// TODO: Technically we need to Expect deletion TS is non-zero as well here!
return err == nil
}, timeout, interval).Should(BeTrue(), "DRPolicy deleted prematurely, with active DRPC references")
}).Should(BeTrue(), "DRPolicy deleted prematurely, with active DRPC references")
}

func ensureDRPolicyIsDeleted(drpolicyName string) {
Expand Down Expand Up @@ -1326,7 +1326,7 @@ func verifyUserPlacementRuleDecisionUnchanged(name, namespace, homeCluster strin
placementObj = usrPlRule

return err == nil && usrPlRule.Status.Decisions[0].ClusterName == homeCluster
}, timeout, interval).Should(BeTrue())
}).Should(BeTrue())

Expect(placementObj.GetAnnotations()[controllers.DRPCNameAnnotation]).Should(Equal(DRPCCommonName))
Expect(placementObj.GetAnnotations()[controllers.DRPCNamespaceAnnotation]).Should(Equal(namespace))
Expand Down
1 change: 1 addition & 0 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func createOperatorNamespace(ramenNamespace string) {
var _ = BeforeSuite(func() {
// onsi.github.io/gomega/#adjusting-output
format.MaxLength = 0
SetDefaultConsistentlyDuration(1 * time.Second)
testLogger = zap.New(zap.UseFlagOptions(&zap.Options{
Development: true,
DestWriter: GinkgoWriter,
Expand Down
3 changes: 3 additions & 0 deletions controllers/volsync/volsync_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"path/filepath"
"testing"
"time"

"github.com/go-logr/logr"
. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -64,6 +65,8 @@ func TestVolsync(t *testing.T) {
}

var _ = BeforeSuite(func() {
SetDefaultConsistentlyDuration(1 * time.Second)
SetDefaultConsistentlyPollingInterval(250 * time.Millisecond)
logger = zap.New(zap.UseFlagOptions(&zap.Options{
Development: true,
DestWriter: GinkgoWriter,
Expand Down
10 changes: 5 additions & 5 deletions controllers/volsync/vshandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ var _ = Describe("VolSync_Handler", func() {
Consistently(func() error {
return k8sClient.Get(ctx,
types.NamespacedName{Name: rdSpec.ProtectedPVC.Name, Namespace: testNamespace.GetName()}, createdRD)
}, 1*time.Second, interval).ShouldNot(BeNil())
}).ShouldNot(BeNil())
})
})

Expand Down Expand Up @@ -719,7 +719,7 @@ var _ = Describe("VolSync_Handler", func() {
Consistently(func() error {
return k8sClient.Get(ctx,
types.NamespacedName{Name: rsSpec.ProtectedPVC.Name, Namespace: testNamespace.GetName()}, createdRS)
}, 1*time.Second, interval).ShouldNot(BeNil())
}).ShouldNot(BeNil())
})
})

Expand Down Expand Up @@ -759,7 +759,7 @@ var _ = Describe("VolSync_Handler", func() {
Consistently(func() error {
return k8sClient.Get(ctx,
types.NamespacedName{Name: rsSpec.ProtectedPVC.Name, Namespace: testNamespace.GetName()}, createdRS)
}, 1*time.Second, interval).ShouldNot(BeNil())
}).ShouldNot(BeNil())
})
})

Expand All @@ -781,7 +781,7 @@ var _ = Describe("VolSync_Handler", func() {
Consistently(func() error {
return k8sClient.Get(ctx,
types.NamespacedName{Name: rsSpec.ProtectedPVC.Name, Namespace: testNamespace.GetName()}, createdRS)
}, 1*time.Second, interval).ShouldNot(BeNil())
}).ShouldNot(BeNil())
})
})

Expand All @@ -804,7 +804,7 @@ var _ = Describe("VolSync_Handler", func() {
Consistently(func() error {
return k8sClient.Get(ctx,
types.NamespacedName{Name: rsSpec.ProtectedPVC.Name, Namespace: testNamespace.GetName()}, createdRS)
}, 1*time.Second, interval).ShouldNot(BeNil())
}).ShouldNot(BeNil())
})
})

Expand Down
2 changes: 1 addition & 1 deletion controllers/vrg_volrep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,7 @@ func (v *vrgTest) verifyVRGStatusCondition(conditionName string, expectedStatus
Eventually(testFunc, vrgtimeout, vrginterval).Should(BeTrue(),
"while waiting for VRG %s TRUE condition %s/%s", conditionName, v.vrgName, v.namespace)
default: // false
Consistently(testFunc, vrgtimeout, vrginterval).Should(BeTrue(),
Consistently(testFunc).Should(BeTrue(),
"while waiting for VRG %s FALSE condition %s/%s", conditionName, v.vrgName, v.namespace)
}
}
Expand Down
Loading