Skip to content

Commit

Permalink
chore: move UDP test resources out of the base (#3857)
Browse files Browse the repository at this point in the history
delay the creation for non-shared udp test resources

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
  • Loading branch information
zhaohuabing authored Jul 15, 2024
1 parent 3da4859 commit d0daf1f
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 87 deletions.
86 changes: 0 additions & 86 deletions test/e2e/base/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -472,92 +472,6 @@ spec:
---
apiVersion: v1
kind: Namespace
metadata:
name: gateway-conformance-udp
labels:
gateway-conformance: udp
---
apiVersion: v1
kind: Service
metadata:
name: coredns
namespace: gateway-conformance-udp
labels:
app: udp
spec:
ports:
- name: udp-dns
port: 53
protocol: UDP
targetPort: 53
selector:
app: udp
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: coredns
namespace: gateway-conformance-udp
labels:
app: udp
spec:
selector:
matchLabels:
app: udp
template:
metadata:
labels:
app: udp
spec:
containers:
- args:
- -conf
- /root/Corefile
image: coredns/coredns
name: coredns
volumeMounts:
- mountPath: /root
name: conf
volumes:
- configMap:
defaultMode: 420
name: coredns
name: conf
---
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: gateway-conformance-udp
data:
Corefile: |
.:53 {
forward . 8.8.8.8 9.9.9.9
log
errors
}
foo.bar.com:53 {
whoami
}
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: udp-gateway
namespace: gateway-conformance-udp
spec:
gatewayClassName: "{GATEWAY_CLASS_NAME}"
listeners:
- name: coredns
protocol: UDP
port: 5300
allowedRoutes:
kinds:
- kind: UDPRoute
---
apiVersion: v1
kind: Namespace
metadata:
name: gateway-preserve-case-backend
---
Expand Down
86 changes: 86 additions & 0 deletions test/e2e/testdata/udproute.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,89 @@
apiVersion: v1
kind: Namespace
metadata:
name: gateway-conformance-udp
labels:
gateway-conformance: udp
---
apiVersion: v1
kind: Service
metadata:
name: coredns
namespace: gateway-conformance-udp
labels:
app: udp
spec:
ports:
- name: udp-dns
port: 53
protocol: UDP
targetPort: 53
selector:
app: udp
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: coredns
namespace: gateway-conformance-udp
labels:
app: udp
spec:
selector:
matchLabels:
app: udp
template:
metadata:
labels:
app: udp
spec:
containers:
- args:
- -conf
- /root/Corefile
image: coredns/coredns
name: coredns
volumeMounts:
- mountPath: /root
name: conf
volumes:
- configMap:
defaultMode: 420
name: coredns
name: conf
---
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: gateway-conformance-udp
data:
Corefile: |
.:53 {
forward . 8.8.8.8 9.9.9.9
log
errors
}
foo.bar.com:53 {
whoami
}
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: udp-gateway
namespace: gateway-conformance-udp
spec:
gatewayClassName: "{GATEWAY_CLASS_NAME}"
listeners:
- name: coredns
protocol: UDP
port: 5300
allowedRoutes:
kinds:
- kind: UDPRoute
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: UDPRoute
metadata:
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/tests/udproute.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ var UDPRouteTest = suite.ConformanceTest{
if err := wait.PollUntilContextTimeout(context.TODO(), time.Second, time.Minute, true,
func(_ context.Context) (done bool, err error) {
t.Logf("performing DNS query %s on %s", domain, gwAddr)
_, err = dns.Exchange(msg, gwAddr)
r, err := dns.Exchange(msg, gwAddr)
if err != nil {
t.Logf("failed to perform a UDP query: %v", err)
return false, nil
}
t.Logf("got DNS response: %s", r.String())
return true, nil
}); err != nil {
t.Errorf("failed to perform DNS query: %v", err)
Expand Down

0 comments on commit d0daf1f

Please sign in to comment.