Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit bb141c9

Browse files
committed
Adds e2e test to test proxy readiness probe
Signed-off-by: JoshVanL <[email protected]>
1 parent 03147a7 commit bb141c9

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

pkg/probe/probe.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
"github.com/heptiolabs/healthcheck"
1313
"k8s.io/apiserver/pkg/authentication/authenticator"
14-
//"k8s.io/apiserver/pkg/authentication/request/bearertoken"
1514
"k8s.io/klog"
1615
)
1716

test/e2e/framework/helper/deploy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (h *Helper) DeployProxy(ns *corev1.Namespace, issuerURL, clientID string,
6767
Port: intstr.FromInt(8080),
6868
},
6969
},
70-
InitialDelaySeconds: 9,
70+
InitialDelaySeconds: 1,
7171
PeriodSeconds: 3,
7272
},
7373
}

test/e2e/suite/cases/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package cases
44
import (
55
_ "github.com/jetstack/kube-oidc-proxy/test/e2e/suite/cases/impersonation"
66
_ "github.com/jetstack/kube-oidc-proxy/test/e2e/suite/cases/passthrough"
7+
_ "github.com/jetstack/kube-oidc-proxy/test/e2e/suite/cases/probe"
78
_ "github.com/jetstack/kube-oidc-proxy/test/e2e/suite/cases/rbac"
89
_ "github.com/jetstack/kube-oidc-proxy/test/e2e/suite/cases/token"
910
_ "github.com/jetstack/kube-oidc-proxy/test/e2e/suite/cases/upgrade"

test/e2e/suite/cases/probe/probe.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright Jetstack Ltd. See LICENSE for details.
2+
package probe
3+
4+
import (
5+
"time"
6+
7+
. "github.com/onsi/ginkgo"
8+
. "github.com/onsi/gomega"
9+
10+
"github.com/jetstack/kube-oidc-proxy/test/e2e/framework"
11+
"github.com/jetstack/kube-oidc-proxy/test/e2e/framework/helper"
12+
)
13+
14+
var _ = framework.CasesDescribe("Readiness Probe", func() {
15+
f := framework.NewDefaultFramework("readiness-probe")
16+
17+
It("Should not become ready if the issuer is unavailable", func() {
18+
By("Deleting the Issuer so no longer becomes reachable")
19+
Expect(f.Helper().DeleteIssuer(f.Namespace.Name)).NotTo(HaveOccurred())
20+
21+
By("Deleting the current proxy that is ready")
22+
Expect(f.Helper().DeleteProxy(f.Namespace.Name)).NotTo(HaveOccurred())
23+
24+
By("Deploying the Proxy should never become ready as the issuer is unavailable")
25+
_, _, err := f.Helper().DeployProxy(f.Namespace, f.IssuerURL(),
26+
f.ClientID(), f.IssuerKeyBundle())
27+
// Error should occur (not ready)
28+
Expect(err).To(HaveOccurred())
29+
})
30+
31+
It("Should continue to be ready even if the issuer becomes unavailable", func() {
32+
By("Deleting the Issuer so no longer becomes reachable")
33+
Expect(f.Helper().DeleteIssuer(f.Namespace.Name)).NotTo(HaveOccurred())
34+
35+
time.Sleep(time.Second * 10)
36+
37+
err := f.Helper().WaitForPodReady(f.Namespace.Name, helper.ProxyName, time.Second*5)
38+
Expect(err).NotTo(HaveOccurred())
39+
})
40+
})

0 commit comments

Comments
 (0)