-
Notifications
You must be signed in to change notification settings - Fork 20
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
Showing
4 changed files
with
76 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: nsx.vmware.com/v1alpha2 | ||
kind: StaticRoute | ||
metadata: | ||
name: guestcluster-staticroute-2 | ||
spec: | ||
network: 45.1.2.0/24 | ||
nextHops: | ||
- ipAddress: 172.10.0.2 |
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,45 @@ | ||
// This file is for e2e StaticRoute tests. | ||
|
||
package e2e | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/vmware-tanzu/nsx-operator/pkg/nsx/services/common" | ||
) | ||
|
||
const ( | ||
StaticRoute = "StaticRoute" | ||
) | ||
|
||
// TestStaticRouteBasic verifies that it could successfully realize StaticRoute. | ||
func TestStaticRouteBasic(t *testing.T) { | ||
ns := "sc-a" | ||
name := "guestcluster-staticroute-2" | ||
setupTest(t, ns) | ||
defer teardownTest(t, ns) | ||
|
||
// Create StaticRoute | ||
StaticRoutePath, _ := filepath.Abs("./manifest/testStaticRoute/staticroute.yaml") | ||
err := applyYAML(StaticRoutePath, ns) | ||
if err != nil { | ||
t.Fatalf("Failed to apply StaticRoute YAML file: %v", err) | ||
assert_nil(t, err) | ||
} | ||
|
||
// Check StaticRoute status | ||
err = testData.waitForCRReadyOrDeleted(defaultTimeout, StaticRoute, ns, name, Ready) | ||
assert_nil(t, err, "Error when waiting for Static Route %s", name) | ||
|
||
// Check nsx-t resource existing | ||
err = testData.waitForResourceExistOrNot(ns, common.ResourceTypeStaticRoute, name, true) | ||
assert_nil(t, err) | ||
|
||
// Delete StaticRoute | ||
_ = deleteYAML(StaticRoutePath, ns) | ||
|
||
// Check nsx-t resource not existing | ||
err = testData.waitForResourceExistOrNot(ns, common.ResourceTypeStaticRoute, name, false) | ||
assert_nil(t, err) | ||
} |