-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a16d0c
commit 8fd9033
Showing
9 changed files
with
234 additions
and
13 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
Copyright (c) Microsoft Corporation. | ||
Licensed under the MIT license. | ||
*/ | ||
package e2e | ||
|
||
import ( | ||
"os" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"k8s.io/apimachinery/pkg/types" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
fleetnetv1alpha1 "go.goms.io/fleet-networking/api/v1alpha1" | ||
"go.goms.io/fleet-networking/test/common/trafficmanager/validator" | ||
"go.goms.io/fleet-networking/test/e2e/framework" | ||
) | ||
|
||
var ( | ||
enabled = os.Getenv("ENABLE_TRAFFIC_MANAGER") == "true" | ||
) | ||
|
||
var _ = Describe("Test exporting service via Azure traffic manager", func() { | ||
var wm *framework.WorkloadManager | ||
var profile fleetnetv1alpha1.TrafficManagerProfile | ||
var hubClient client.Client | ||
//var dnsName string | ||
|
||
BeforeEach(func() { | ||
if !enabled { | ||
Skip("Skipping setting up when traffic manager is not enabled") | ||
} | ||
|
||
wm = framework.NewWorkloadManager(fleet) | ||
hubClient = wm.Fleet.HubCluster().Client() | ||
|
||
By("Deploying workload") | ||
Expect(wm.DeployWorkload(ctx)).Should(Succeed(), "Failed to deploy workloads") | ||
|
||
By("Creating trafficManagerProfile") | ||
profile = wm.TrafficManagerProfile() | ||
Expect(hubClient.Create(ctx, &profile)).Should(Succeed(), "Failed to creat the trafficManagerProfile") | ||
|
||
By("Validating the trafficManagerProfile status") | ||
validator.ValidateIfTrafficManagerProfileIsProgrammed(ctx, hubClient, types.NamespacedName{Namespace: profile.Namespace, Name: profile.Name}) | ||
}) | ||
|
||
AfterEach(func() { | ||
if !enabled { | ||
Skip("Skipping deleting when traffic manager is not enabled") | ||
} | ||
|
||
By("Removing workload") | ||
Expect(wm.RemoveWorkload(ctx)).Should(Succeed()) | ||
|
||
By("Deleting trafficManagerProfile") | ||
Expect(hubClient.Delete(ctx, &profile)).Should(Succeed(), "Failed to delete the trafficManagerProfile") | ||
|
||
By("Validating trafficManagerProfile is deleted") | ||
validator.IsTrafficManagerProfileDeleted(ctx, hubClient, types.NamespacedName{Namespace: profile.Namespace, Name: profile.Name}) | ||
}) | ||
|
||
Context("Test invalid trafficManagerBackend (invalid serviceImport)", Ordered, func() { | ||
var backend fleetnetv1alpha1.TrafficManagerBackend | ||
var name types.NamespacedName | ||
BeforeAll(func() { | ||
By("Creating trafficManagerBackend") | ||
backend = wm.TrafficManagerBackend() | ||
name = types.NamespacedName{Namespace: backend.Namespace, Name: backend.Name} | ||
Expect(hubClient.Create(ctx, &backend)).Should(Succeed(), "Failed to create the trafficManagerBackend") | ||
}) | ||
|
||
AfterAll(func() { | ||
By("Deleting trafficManagerBackend") | ||
Expect(hubClient.Delete(ctx, &backend)).Should(Succeed(), "Failed to delete the trafficManagerBackend") | ||
validator.IsTrafficManagerBackendDeleted(ctx, hubClient, name) | ||
}) | ||
|
||
It("Validating the trafficManagerBackend status", func() { | ||
status := validator.ValidateTrafficManagerBackendIfAcceptedAndIgnoringEndpointName(ctx, hubClient, name, nil) | ||
validator.ValidateTrafficManagerBackendStatusAndIgnoringEndpointNameConsistently(ctx, hubClient, name, status) | ||
}) | ||
}) | ||
}) |