Skip to content

Commit 7debc08

Browse files
committed
more cases
1 parent a02ba4f commit 7debc08

File tree

2 files changed

+50
-5
lines changed

2 files changed

+50
-5
lines changed

test/e2e/gatewayapi/gatewayproxy.go

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ spec:
8181
headers:
8282
X-Proxy-Test: "disabled"
8383
`
84-
var gatewayProxyWithPluginMetadata = `
84+
var (
85+
gatewayProxyWithPluginMetadata0 = `
8586
apiVersion: gateway.apisix.io/v1alpha1
8687
kind: GatewayProxy
8788
metadata:
@@ -100,6 +101,26 @@ spec:
100101
}
101102
}
102103
`
104+
gatewayProxyWithPluginMetadata1 = `
105+
apiVersion: gateway.apisix.io/v1alpha1
106+
kind: GatewayProxy
107+
metadata:
108+
name: api7-proxy-config
109+
spec:
110+
plugins:
111+
- name: error-page
112+
enabled: true
113+
config: {}
114+
pluginMetadata:
115+
error-page: {
116+
"enable": false,
117+
"error_404": {
118+
"body": "404 from plugin metadata",
119+
"content-type": "text/plain"
120+
}
121+
}
122+
`
123+
)
103124

104125
var httpRouteForTest = `
105126
apiVersion: gateway.networking.k8s.io/v1
@@ -249,9 +270,9 @@ spec:
249270
err error
250271
)
251272

252-
It("Should work OK with error-page", func() {
273+
FIt("Should work OK with error-page", func() {
253274
By("Update GatewayProxy with PluginMetadata")
254-
err = s.CreateResourceFromString(gatewayProxyWithPluginMetadata)
275+
err = s.CreateResourceFromString(gatewayProxyWithPluginMetadata0)
255276
Expect(err).ShouldNot(HaveOccurred())
256277
time.Sleep(5 * time.Second)
257278

@@ -265,6 +286,32 @@ spec:
265286
Expect().
266287
Status(http.StatusNotFound).
267288
Body().Contains("404 from plugin metadata")
289+
290+
By("Update GatewayProxy with PluginMetadata")
291+
err = s.CreateResourceFromString(gatewayProxyWithPluginMetadata1)
292+
Expect(err).ShouldNot(HaveOccurred())
293+
time.Sleep(5 * time.Second)
294+
295+
By("Check PluginMetadata working")
296+
s.NewAPISIXClient().
297+
GET("/not-found").
298+
WithHost("example.com").
299+
Expect().
300+
Status(http.StatusNotFound).
301+
Body().Contains(`{"error_msg":"404 Route Not Found"}`)
302+
303+
By("Delete GatewayProxy")
304+
err = s.DeleteResourceFromString(gatewayProxyWithPluginMetadata0)
305+
Expect(err).ShouldNot(HaveOccurred())
306+
time.Sleep(5 * time.Second)
307+
308+
By("Check PluginMetadata is not working")
309+
s.NewAPISIXClient().
310+
GET("/not-found").
311+
WithHost("example.com").
312+
Expect().
313+
Status(http.StatusNotFound).
314+
Body().Contains(`{"error_msg":"404 Route Not Found"}`)
268315
})
269316
})
270317
})

test/e2e/scaffold/scaffold.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,14 +456,12 @@ func (s *Scaffold) afterEach() {
456456
_, _ = fmt.Fprintln(GinkgoWriter, "Dumping namespace contents")
457457
_, _ = k8s.RunKubectlAndGetOutputE(GinkgoT(), s.kubectlOptions, "get", "deploy,sts,svc,pods,gatewayproxy")
458458
_, _ = k8s.RunKubectlAndGetOutputE(GinkgoT(), s.kubectlOptions, "describe", "pods")
459-
_, _ = k8s.RunKubectlAndGetOutputE(GinkgoT(), s.kubectlOptions, "logs", "-l", "control-plane=controller-manager")
460459
}
461460

462461
output := s.GetDeploymentLogs("api7-ingress-controller")
463462
if output != "" {
464463
_, _ = fmt.Fprintln(GinkgoWriter, output)
465464
}
466-
return
467465
}
468466

469467
// if the test case is successful, just delete namespace

0 commit comments

Comments
 (0)