Skip to content
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
33 changes: 33 additions & 0 deletions e2e/internal/qa/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,39 @@ func (c *Client) WaitForStatusUp(ctx context.Context) error {
return nil
}

// WaitForUnicastStatusUp polls until a Unicast (IBRL) status entry exists and
// its session is up. Prefer this over WaitForStatusUp in multi-tunnel contexts
// where other tunnel types may already be present.
func (c *Client) WaitForUnicastStatusUp(ctx context.Context) error {
return c.waitForUserTypeStatusUp(ctx, "IBRL", FindIBRLStatus)
}

// WaitForMulticastStatusUp polls until a Multicast status entry exists and
// its session is up. Prefer this over WaitForStatusUp in multi-tunnel contexts
// where other tunnel types may already be present.
func (c *Client) WaitForMulticastStatusUp(ctx context.Context) error {
return c.waitForUserTypeStatusUp(ctx, "Multicast", FindMulticastStatus)
}

// waitForUserTypeStatusUp polls until find returns a non-nil status whose
// session is up. userType is used only for log context.
func (c *Client) waitForUserTypeStatusUp(ctx context.Context, userType string, find func([]*pb.Status) *pb.Status) error {
c.log.Debug("Waiting for status to be up", "host", c.Host, "userType", userType)
err := poll.Until(ctx, func() (bool, error) {
resp, err := c.grpcClient.GetStatus(ctx, &emptypb.Empty{})
if err != nil {
return false, err
}
s := find(resp.Status)
return s != nil && IsStatusUp(s.SessionStatus), nil
}, waitForStatusUpTimeout, waitInterval)
if err != nil {
return fmt.Errorf("failed to wait for %s status to be up on host %s: %w", userType, c.Host, err)
}
c.log.Debug("Confirmed status is up", "host", c.Host, "userType", userType)
return nil
}

// WaitForAllStatusesUp polls until all tunnel statuses are up and at least
// minExpected statuses exist. Sets doubleZeroIP from the IBRL status preferentially.
func (c *Client) WaitForAllStatusesUp(ctx context.Context, minExpected int) error {
Expand Down
4 changes: 2 additions & 2 deletions e2e/qa_multicast_settlement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ func TestQA_MulticastSettlement(t *testing.T) {
}

if !t.Run("validate_tunnel_up", func(t *testing.T) {
err := client.WaitForStatusUp(ctx)
require.NoError(t, err, "tunnel did not come up after seat payment")
err := client.WaitForMulticastStatusUp(ctx)
require.NoError(t, err, "multicast tunnel did not come up after seat payment")
}) {
return
}
Expand Down
Loading