forked from submariner-io/submariner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add third gateway fail-over E2E scenario test (submariner-io#264)
Two gateway nodes configured with 2 submariner engine replicas. This tests the leader election fail-over. Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
- Loading branch information
Showing
5 changed files
with
135 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package framework | ||
|
||
import ( | ||
"fmt" | ||
|
||
. "github.com/onsi/gomega" | ||
appsv1 "k8s.io/api/apps/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
) | ||
|
||
func (f *Framework) FindDeployment(cluster ClusterIndex, appName string, namespace string) *appsv1.Deployment { | ||
deployments := AwaitUntil("list deployments", func() (interface{}, error) { | ||
return f.ClusterClients[cluster].AppsV1().Deployments(namespace).List(metav1.ListOptions{ | ||
LabelSelector: "app=" + appName, | ||
}) | ||
}, NoopCheckResult).(*appsv1.DeploymentList) | ||
Expect(deployments.Items).To(HaveLen(1), fmt.Sprintf("Expected one %q deployment on %q", | ||
appName, TestContext.KubeContexts[cluster])) | ||
|
||
return &deployments.Items[0] | ||
} | ||
|
||
func (f *Framework) FindSubmarinerEngineDeployment(cluster ClusterIndex) *appsv1.Deployment { | ||
return f.FindDeployment(cluster, SubmarinerEngine, TestContext.SubmarinerNamespace) | ||
} | ||
|
||
func (f *Framework) SetReplicas(cluster ClusterIndex, deployment *appsv1.Deployment, replicas uint32) { | ||
PatchInt("/spec/replicas", replicas, | ||
func(pt types.PatchType, payload []byte) error { | ||
_, err := f.ClusterClients[cluster].AppsV1().Deployments(deployment.Namespace).Patch(deployment.Name, pt, payload) | ||
return err | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters