Skip to content

Commit

Permalink
Update multiple GWs failover test to support ROKS as well
Browse files Browse the repository at this point in the history
Submariner endpoint and gateway names are based on the
node's OS.Hostname().
For ROKS the node names are not equal to os.Hostname(),

Now that we are going to support multiple gateways for ROKS as well,
the name parameter used for searching gateway CR needs to be updated
to endpoint.spec.hostname instead of gwpod.spec.nodeName.

Signed-off-by: Yossi Boaron <yboaron@redhat.com>
  • Loading branch information
yboaron authored and tpantelis committed Aug 22, 2024
1 parent 86b55ce commit 5ccd58e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/e2e/redundancy/gateway_failover.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,14 @@ func testGatewayFailOverScenario(f *subFramework.Framework) {
Expect(initialGWPod).ToNot(BeNil(), "Did not find an active gateway pod")

framework.By(fmt.Sprintf("Ensure active gateway node %q has established connections", initialGWPod.Name))
gwConnection := f.AwaitGatewayWithStatus(framework.ClusterIndex(primaryCluster), initialGWPod.Spec.NodeName, subv1.HAStatusActive)
Expect(gwConnection.Status.Connections).NotTo(BeEmpty(), "The active gateway must have established connections")

submEndpoint := f.AwaitSubmarinerEndpoint(framework.ClusterIndex(primaryCluster), subFramework.NoopCheckEndpoint)
framework.By(fmt.Sprintf("Found submariner endpoint for %q: %#v", clusterAName, submEndpoint))

gwConnection := f.AwaitGatewayWithStatus(framework.ClusterIndex(primaryCluster),
resource.EnsureValidName(submEndpoint.Spec.Hostname), subv1.HAStatusActive)
Expect(gwConnection.Status.Connections).NotTo(BeEmpty(), "The active gateway must have established connections")

framework.By("Performing fail-over to passive gateway")
f.DoFailover(context.TODO(), framework.ClusterIndex(primaryCluster), initialGWPod.Spec.NodeName, initialGWPod.Name)

Expand All @@ -199,14 +201,15 @@ func testGatewayFailOverScenario(f *subFramework.Framework) {
Expect(newGWPod).ToNot(BeNil(), "Did not find a new active gateway pod running on a different node")
framework.By(fmt.Sprintf("Found new submariner gateway pod %q", newGWPod.Name))

framework.By(fmt.Sprintf("Waiting for the new pod %q to report as fully connected", newGWPod.Name))
f.AwaitGatewayFullyConnected(framework.ClusterIndex(primaryCluster), resource.EnsureValidName(newGWPod.Spec.NodeName))

// Verify a new Endpoint instance is created by the new gateway instance. This is a bit whitebox but it's a sanity check
// and also gives it a bit more of a cushion to avoid premature timeout in the connectivity test.
newSubmEndpoint := f.AwaitNewSubmarinerEndpoint(framework.ClusterIndex(primaryCluster), submEndpoint.ObjectMeta.UID)
framework.By(fmt.Sprintf("Found new submariner endpoint for %q: %#v", clusterAName, newSubmEndpoint))

framework.By(fmt.Sprintf("Waiting for the new pod %q to report as fully connected", newGWPod.Name))
f.AwaitGatewayFullyConnected(framework.ClusterIndex(primaryCluster),
resource.EnsureValidName(resource.EnsureValidName(newSubmEndpoint.Spec.Hostname)))

framework.By(fmt.Sprintf("Waiting for the previous submariner endpoint %q to be removed on %q", newGWPod.Name, clusterBName))
f.AwaitSubmarinerEndpointRemoved(framework.ClusterIndex(secondaryCluster), submEndpoint.Name)

Expand Down

0 comments on commit 5ccd58e

Please sign in to comment.