Skip to content
Open
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion internal/controller/vrg_recipe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package controllers_test
import (
"context"
"strings"
"time"

volrep "github.com/csi-addons/kubernetes-csi-addons/api/replication.storage/v1alpha1"
. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -249,7 +250,7 @@ var _ = Describe("VolumeReplicationGroupRecipe", func() {
}
vrgDelete := func() {
Expect(k8sClient.Delete(ctx, vrg)).To(Succeed())
Eventually(vrgGet).Should(MatchError(k8serrors.NewNotFound(
Eventually(vrgGet, time.Second*10, time.Millisecond*100).Should(MatchError(k8serrors.NewNotFound(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may work but it is not clear based on the the function signature:

Eventually(actualOrCtx any, args ...any) AsyncAssertion

We should use:

Eventually(vrgGet).WithTimeout(10*time.Second).Should(MatchError(k8serrors.NewNotFound(

Also it will help to add a comment explaining why we need larger timeout for this test.

I would not bother with the polling interval to keep the code simpler.

Can you share tests results with this timeout, proving that the flakiness is caused by short timeout?

A good example would be to run this test 100 times with this timeout and measure how much time we waited (min, max, avg).

We have lot of falky tests, I wonder this delete timeout within 1 second is not causing other tests to fail. We can increate the default timeout to test this:
https://pkg.go.dev/github.com/onsi/gomega#SetDefaultEventuallyTimeout

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will run some tests to verify the behavior and have more info on the deletion time interval.
I encountered additional tests that are flaky due to timeout, e.g. #2235

schema.GroupResource{
Group: ramen.GroupVersion.Group,
Resource: "volumereplicationgroups",
Expand Down