-
Notifications
You must be signed in to change notification settings - Fork 365
refactor: E2E tests to support parallel tests #2501
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
Changes from 6 commits
4842859
c2340e5
0fe8b52
bbadbbd
f3b6bf8
835a81d
d164ae8
e7ec20a
26ada20
6afab7e
9dcb4ef
0741306
7b28f3b
1906033
79600b4
2f17c77
91feeaf
badb102
be9929a
4f3edb0
c3f8dbb
7e0c971
0ab4fdc
19cd878
8f33813
7b35de6
0b229bb
a9aee63
4130ac0
05b989c
1c58561
904e129
8f7c181
a1e5974
f11b3c7
513f255
6bce11a
c975b1d
fd76b09
67caaf3
6279ee5
e8bff71
940fe22
17e3faf
6b6dc55
30ba121
76d080f
cfef33d
3c21b08
9339785
6d5f7f2
a67d6b5
f0b1b01
fcef3fd
dcad5b1
9bb7169
d327d42
8ff0cb4
fc3f4c0
470c6eb
89646cc
6375c58
6e579f1
9c1babf
f73fffb
9b715d0
cd7034b
097efb1
c4eb985
c856c8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,15 +19,22 @@ package v1alpha1 | |
|
|
||
| import ( | ||
| "fmt" | ||
| "time" | ||
|
|
||
| . "github.com/onsi/ginkgo/v2" | ||
| . "github.com/onsi/gomega" | ||
| "k8s.io/apimachinery/pkg/types" | ||
|
|
||
| "github.com/apache/apisix-ingress-controller/test/e2e/scaffold" | ||
| ) | ||
|
|
||
| var _ = Describe("Test BackendTrafficPolicy base on HTTPRoute", Label("apisix.apache.org", "v1alpha1", "backendtrafficpolicy"), func() { | ||
| s := scaffold.NewDefaultScaffold() | ||
| var ( | ||
| s = scaffold.NewScaffold(&scaffold.Options{ | ||
| ControllerName: fmt.Sprintf("apisix.apache.org/apisix-ingress-controller-%d", time.Now().Unix()), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be used as the default behavior.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It already has default behavior:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. revered to defaultscaffold
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have reverted back to this behavior. I see a lot of tests fail when defaultScaffold is used. I am looking into the reason but for now I have reverted to this. |
||
| }) | ||
| err error | ||
| ) | ||
|
|
||
| var defaultGatewayProxy = ` | ||
| apiVersion: apisix.apache.org/v1alpha1 | ||
|
|
@@ -59,7 +66,7 @@ spec: | |
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: Gateway | ||
| metadata: | ||
| name: apisix | ||
| name: %s | ||
| spec: | ||
| gatewayClassName: %s | ||
| listeners: | ||
|
|
@@ -80,7 +87,7 @@ metadata: | |
| name: httpbin | ||
| spec: | ||
| parentRefs: | ||
| - name: apisix | ||
| - name: %s | ||
| hostnames: | ||
| - "httpbin.org" | ||
| rules: | ||
|
|
@@ -125,7 +132,25 @@ spec: | |
| ` | ||
|
|
||
| BeforeEach(func() { | ||
| s.ApplyDefaultGatewayResource(defaultGatewayProxy, defaultGatewayClass, defaultGateway, defaultHTTPRoute) | ||
| gatewayName := s.Namespace() | ||
| By("create GatewayProxy") | ||
| err = s.CreateResourceFromString(fmt.Sprintf(defaultGatewayProxy, s.Deployer.GetAdminEndpoint(), s.AdminKey())) | ||
| Expect(err).NotTo(HaveOccurred(), "creating GatewayProxy") | ||
| time.Sleep(time.Second) | ||
|
|
||
| By("create GatewayClass") | ||
| gatewayClassName := fmt.Sprintf("apisix-%d", time.Now().Unix()) | ||
| err = s.CreateResourceFromString(fmt.Sprintf(defaultGatewayClass, gatewayClassName, s.GetControllerName())) | ||
| Expect(err).NotTo(HaveOccurred(), "creating GatewayClass") | ||
| time.Sleep(time.Second) | ||
|
|
||
| By("create Gateway") | ||
| err = s.CreateResourceFromStringWithNamespace(fmt.Sprintf(defaultGateway, gatewayName, gatewayClassName), s.Namespace()) | ||
| Expect(err).NotTo(HaveOccurred(), "creating Gateway") | ||
| time.Sleep(time.Second) | ||
|
|
||
| By("create HTTPRoute") | ||
| s.ApplyHTTPRoute(types.NamespacedName{Namespace: s.Namespace(), Name: "httpbin"}, fmt.Sprintf(defaultHTTPRoute, gatewayName)) | ||
| }) | ||
| It("should rewrite upstream host", func() { | ||
| s.ResourceApplied("BackendTrafficPolicy", "httpbin", createUpstreamHost, 1) | ||
|
|
||
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.
use make install-ginkgo?