-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
e2e: add e2e test for MergeGateways feature #2665
Merged
Merged
Changes from 21 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
1f1dedf
add e2e test for merge gateways feature
shawnh2 f7161d9
address comments
shawnh2 ae3a2d0
Merge branch 'main' of github.com:envoyproxy/gateway into merge-gatew…
shawnh2 5ea21e5
add e2e test for conflicted merge gateways case
shawnh2 4ef1232
add supportedKinds for listener status
shawnh2 893f5ee
resolve conflicts
shawnh2 f5cfbb0
Merge branch 'main' of github.com:envoyproxy/gateway into merge-gatew…
shawnh2 8df3a0d
abstract new e2e test for gateway class as a function
shawnh2 ef9baee
Merge branch 'main' into merge-gateways-e2e-test
shawnh2 8647f62
update code
shawnh2 17c1d61
resolve conflicts
shawnh2 7c93dda
Merge branch 'main' into merge-gateways-e2e-test
shawnh2 e604db2
resolve conflicts
shawnh2 16bd4dd
add a test-suite for merge-gateways
shawnh2 61b138e
Merge branch 'merge-gateways-e2e-test' of https://github.com/shawnh2/…
shawnh2 ca592b5
Merge branch 'main' of github.com:envoyproxy/gateway into merge-gatew…
shawnh2 8a86e00
fix resources cleanup
shawnh2 a55ed51
Merge branch 'main' into merge-gateways-e2e-test
shawnh2 a4fc3f1
passing necessary args for suite instead of calling Setup
shawnh2 c3df6a1
fix gateway class name arg
shawnh2 9117cd6
Merge branch 'main' into merge-gateways-e2e-test
shawnh2 e822a61
resolve conflicts
shawnh2 6a32018
address comments
shawnh2 eb7629a
sort imports for envoy_shutdown and setup suite for merge-gateways
shawnh2 a4517cc
fix lint
shawnh2 50512dc
Merge branch 'main' into merge-gateways-e2e-test
shawnh2 29e77ca
fix gen-check
shawnh2 0402ca5
Merge branch 'main' of github.com:envoyproxy/gateway into merge-gatew…
shawnh2 e97db3d
change kube.mk merge gateways path
shawnh2 3131079
Merge branch 'main' of github.com:envoyproxy/gateway into merge-gatew…
shawnh2 2c65b0b
only setting up necessary arguments for merged gateway e2e test to be…
shawnh2 85fadad
Merge branch 'main' into merge-gateways-e2e-test
zirain 0b4509a
Merge branch 'main' into merge-gateways-e2e-test
shawnh2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright Envoy Gateway Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// The full text of the Apache license is available in the LICENSE file at | ||
// the root of the repo. | ||
|
||
//go:build e2e | ||
// +build e2e | ||
|
||
package e2e | ||
|
||
import ( | ||
"flag" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
"sigs.k8s.io/controller-runtime/pkg/client/config" | ||
gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" | ||
gwapiv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2" | ||
"sigs.k8s.io/gateway-api/conformance/utils/flags" | ||
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes" | ||
"sigs.k8s.io/gateway-api/conformance/utils/suite" | ||
|
||
egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1" | ||
"github.com/envoyproxy/gateway/test/e2e" | ||
"github.com/envoyproxy/gateway/test/e2e/tests" | ||
) | ||
|
||
func TestMergeGateways(t *testing.T) { | ||
flag.Parse() | ||
|
||
cfg, err := config.GetConfig() | ||
require.NoError(t, err) | ||
|
||
c, err := client.New(cfg, client.Options{}) | ||
require.NoError(t, err) | ||
require.NoError(t, gwapiv1a2.AddToScheme(c.Scheme())) | ||
require.NoError(t, gwapiv1.AddToScheme(c.Scheme())) | ||
require.NoError(t, egv1a1.AddToScheme(c.Scheme())) | ||
|
||
if flags.RunTest != nil && *flags.RunTest != "" { | ||
t.Logf("Running E2E test %s with %s GatewayClass\n cleanup: %t\n debug: %t", | ||
*flags.RunTest, *flags.GatewayClassName, *flags.CleanupBaseResources, *flags.ShowDebug) | ||
} else { | ||
t.Logf("Running E2E tests with %s GatewayClass\n cleanup: %t\n debug: %t", | ||
*flags.GatewayClassName, *flags.CleanupBaseResources, *flags.ShowDebug) | ||
} | ||
|
||
cSuite := suite.New(suite.Options{ | ||
Client: c, | ||
GatewayClassName: *flags.GatewayClassName, | ||
Debug: *flags.ShowDebug, | ||
CleanupBaseResources: *flags.CleanupBaseResources, | ||
RunTest: *flags.RunTest, | ||
}) | ||
|
||
// Setting up the necessary arguments for the suite instead of calling Suite.Setup method again, | ||
// since this test suite reuse the base resources of previous test suite. | ||
cSuite.Applier.FS = e2e.Manifests | ||
cSuite.Applier.GatewayClass = *flags.GatewayClassName | ||
cSuite.ControllerName = kubernetes.GWCMustHaveAcceptedConditionTrue(t, | ||
cSuite.Client, cSuite.TimeoutConfig, cSuite.GatewayClassName) | ||
|
||
t.Logf("Running %d MergeGateways tests", len(tests.MergeGatewaysTests)) | ||
cSuite.Run(t, tests.MergeGatewaysTests) | ||
} |
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,147 @@ | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
name: merged-gateway-1 | ||
namespace: gateway-conformance-infra | ||
spec: | ||
gatewayClassName: merge-gateways | ||
listeners: | ||
- allowedRoutes: | ||
namespaces: | ||
from: Same | ||
name: http1 | ||
port: 8080 | ||
protocol: HTTP | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
name: merged-gateway-2 | ||
namespace: gateway-conformance-infra | ||
spec: | ||
gatewayClassName: merge-gateways | ||
listeners: | ||
- allowedRoutes: | ||
namespaces: | ||
from: Same | ||
name: http2 | ||
port: 8081 | ||
protocol: HTTP | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
name: merged-gateway-3 | ||
namespace: gateway-conformance-infra | ||
spec: | ||
gatewayClassName: merge-gateways | ||
listeners: | ||
- allowedRoutes: | ||
namespaces: | ||
from: Same | ||
name: http3 | ||
port: 8082 | ||
protocol: HTTP | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
name: merged-gateway-4 | ||
namespace: gateway-conformance-infra | ||
spec: | ||
gatewayClassName: merge-gateways | ||
listeners: | ||
- allowedRoutes: | ||
namespaces: | ||
from: Same | ||
name: http3 | ||
port: 8082 | ||
protocol: HTTP | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: merged-gateway-route-1 | ||
namespace: gateway-conformance-infra | ||
spec: | ||
parentRefs: | ||
- name: merged-gateway-1 | ||
hostnames: | ||
- "www.example1.com" | ||
rules: | ||
- backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: infra-backend-v1 | ||
port: 8080 | ||
weight: 1 | ||
matches: | ||
- path: | ||
type: PathPrefix | ||
value: /merge1 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: merged-gateway-route-2 | ||
namespace: gateway-conformance-infra | ||
spec: | ||
parentRefs: | ||
- name: merged-gateway-2 | ||
hostnames: | ||
- "www.example2.com" | ||
rules: | ||
- backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: infra-backend-v2 | ||
port: 8080 | ||
weight: 1 | ||
matches: | ||
- path: | ||
type: PathPrefix | ||
value: /merge2 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: merged-gateway-route-3 | ||
namespace: gateway-conformance-infra | ||
spec: | ||
parentRefs: | ||
- name: merged-gateway-3 | ||
hostnames: | ||
- "www.example3.com" | ||
rules: | ||
- backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: infra-backend-v3 | ||
port: 8080 | ||
weight: 1 | ||
matches: | ||
- path: | ||
type: PathPrefix | ||
value: /merge3 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: merged-gateway-route-4 | ||
namespace: gateway-conformance-infra | ||
spec: | ||
parentRefs: | ||
- name: merged-gateway-4 | ||
hostnames: | ||
- "www.example4.com" | ||
rules: | ||
- backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: infra-backend-v3 | ||
port: 8080 | ||
weight: 1 | ||
matches: | ||
- path: | ||
type: PathPrefix | ||
value: /merge4 |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the instability because you are using the same listener
name
andport
b/wmerged-gateway-4
&merged-gateway-3
cc @cnvergence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the
merged-gateway-4
is deliberately collide withmerged-gateway-3
. the test case formerged-gateway-4
is to make sure the right status will be surfaced if the merge gateway is conflict with another.