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 committed Aug 21, 2024
1 parent d2fcc48 commit 9d7f1b2
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 @@ -181,12 +181,14 @@ func testGatewayFailOverScenario(f *subFramework.Framework) {
Expect(initialGWPod).ToNot(BeNil(), "Did not find an active gateway pod")

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)
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")

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

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

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)
By(fmt.Sprintf("Found new submariner endpoint for %q: %#v", clusterAName, newSubmEndpoint))

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)))

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 9d7f1b2

Please sign in to comment.