Skip to content

Commit

Permalink
tests/e2e/k8s: Fix race in peer status check (#585)
Browse files Browse the repository at this point in the history
This commit fixes a race where a peer status is updated after being fetched for comparison.

Signed-off-by: Or Ozeri <[email protected]>
  • Loading branch information
orozery authored May 19, 2024
1 parent 775bb85 commit 3f9e02c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/e2e/k8s/test_basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package k8s
import (
"fmt"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

Expand Down Expand Up @@ -161,6 +162,11 @@ func (s *TestSuite) TestControlplaneCRUD() {
// list peers
objects, err = client0.Peers.List()
require.Nil(s.T(), err)
if !assert.ElementsMatch(s.T(), *objects.(*[]v1alpha1.Peer), []v1alpha1.Peer{peerFromServer}) {
objects, err = client0.Peers.Get(peer.Name)
require.Nil(s.T(), err)
peerFromServer = *objects.(*v1alpha1.Peer)
}
require.ElementsMatch(s.T(), *objects.(*[]v1alpha1.Peer), []v1alpha1.Peer{peerFromServer})

// add another peer (for upcoming load-balancing test)
Expand Down

0 comments on commit 3f9e02c

Please sign in to comment.