Skip to content

Commit 5a052d6

Browse files
author
Martin Linkhorst
committed
add another e2e test and make sure they fail correctly
1 parent 4b4a6c5 commit 5a052d6

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

test/e2e/external_dns.go

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,63 @@ var _ = describe("External DNS creation", func() {
5353
jigi = ingress.NewIngressTestJig(f.ClientSet)
5454
})
5555

56-
f.It("Should create DNS entry via Service [Zalando]", f.WithSlow(), func(ctx context.Context) {
56+
f.It("Should create DNS entry via Service and AWS Cloud Provider [Zalando]", f.WithSlow(), func(ctx context.Context) {
57+
nameprefix := serviceName + "-"
58+
ns := f.Namespace.Name
59+
labels := map[string]string{
60+
"foo": "bar",
61+
"baz": "blah",
62+
}
63+
port := 80
64+
65+
By("Creating service " + serviceName + " in namespace " + ns)
66+
defer func() {
67+
err := cs.CoreV1().Services(ns).Delete(ctx, serviceName, metav1.DeleteOptions{})
68+
framework.ExpectNoError(err, "failed to delete service: %s in namespace: %s", serviceName, ns)
69+
}()
70+
71+
hostName := fmt.Sprintf("%s-%d.%s", serviceName, time.Now().UTC().Unix(), E2EHostedZone())
72+
_, err := jigs.CreateLoadBalancerService(ctx, timeout, func(svc *v1.Service) {
73+
svc.ObjectMeta = metav1.ObjectMeta{
74+
Name: serviceName,
75+
Annotations: map[string]string{
76+
externalDNSAnnotation: hostName,
77+
},
78+
}
79+
svc.Spec.Type = v1.ServiceTypeLoadBalancer
80+
svc.Spec.Selector = labels
81+
svc.Spec.Ports = []v1.ServicePort{
82+
{
83+
Port: int32(port),
84+
TargetPort: intstr.FromInt(port),
85+
},
86+
}
87+
})
88+
framework.ExpectNoError(err, "failed to create service: %s in namespace: %s", serviceName, ns)
89+
90+
By("Submitting the pod to kubernetes")
91+
route := fmt.Sprintf(`* -> inlineContent("%s") -> <shunt>`, "OK")
92+
pod := createSkipperPod(nameprefix, ns, route, labels, port)
93+
defer func() {
94+
By("deleting the pod")
95+
defer GinkgoRecover()
96+
err2 := cs.CoreV1().Pods(ns).Delete(ctx, pod.Name, metav1.DeleteOptions{})
97+
framework.ExpectNoError(err2, "failed to delete pod: %s in namespace: %s", pod.Name, ns)
98+
}()
99+
100+
_, err = cs.CoreV1().Pods(ns).Create(ctx, pod, metav1.CreateOptions{})
101+
framework.ExpectNoError(err, "failed to create pod: %s in namespace: %s", pod.Name, ns)
102+
103+
framework.ExpectNoError(e2epod.WaitForPodNameRunningInNamespace(ctx, f.ClientSet, pod.Name, pod.Namespace),
104+
"failed to wait for pod: %s in namespace: %s", pod.Name, ns)
105+
106+
// wait for DNS and for pod to be reachable.
107+
By("Waiting up to " + timeout.String() + " for " + hostName + " to be reachable")
108+
err = waitForSuccessfulResponse(hostName, timeout)
109+
framework.ExpectNoError(err, "failed to wait for %s to be reachable", hostName)
110+
})
111+
112+
f.It("Should create DNS entry via Service and AWS Load Balancer Controller [Zalando]", f.WithSlow(), func(ctx context.Context) {
57113
nameprefix := serviceName + "-"
58114
ns := f.Namespace.Name
59115
labels := map[string]string{

test/e2e/run_e2e.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ if [ "$e2e" = true ]; then
205205
# some tests are skipped for zalando-aws because they only apply to zalando-eks
206206
SKIPPED_TESTS+=(
207207
"Authorization via admission-controller \[RBAC\] \[Zalando\]"
208+
# "Should create DNS entry via Service and AWS Load Balancer Controller \[Zalando\]" # Depends on availability of AWS Load Balancer Controller in the cluster.
208209
)
209210
fi
210211

@@ -215,6 +216,7 @@ if [ "$e2e" = true ]; then
215216
"Should audit API calls to create, update, patch, delete pods. \[Audit\] \[Zalando\]"
216217
"should validate permissions for \[Authorization\] \[RBAC\] \[Zalando\]" # TODO: Remains skipped until we remove the older RBAC setup
217218
"should creating a working mysql cluster" # upstream test which does not work with IPv6
219+
# "Should create DNS entry via Service and AWS Cloud Provider \[Zalando\]" # Legacy Service Type LoadBalancer controller doesn't support IPv6.
218220
)
219221
fi
220222

0 commit comments

Comments
 (0)