Skip to content

Commit 6f7f8c9

Browse files
committed
re-introduce write protection test cases and add skip rules for them
1 parent 1b13def commit 6f7f8c9

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

test/e2e/authorization.go

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,18 @@ var _ = g.Describe("Authorization [RBAC] [Zalando]", func() {
207207
tc.data.resources = namespacedResources
208208
tc.data.verbs = writeOperations
209209
})
210-
// These should be covered by the admission-controller tests.
211-
// They're written here for completeness.
212-
g.It("should deny write access in kube-system and visibility namespaces", func() {})
213-
g.It("should allow write access in namespaces other than kube-system and visibility", func() {})
210+
// These should be covered by the admission-controller tests. They will
211+
// be skipped here. Later when we cover everything with RBAC, we can run them again.
212+
g.It("should deny write access in kube-system and visibility namespaces", func() {
213+
tc.data.namespaces = []string{"kube-system", "visibility"}
214+
tc.run(context.TODO(), cs, false)
215+
gomega.Expect(tc.output.passed).To(gomega.BeTrue(), tc.output.String())
216+
})
217+
g.It("should allow write access in namespaces other than kube-system and visibility", func() {
218+
tc.data.namespaces = []string{"", "teapot"}
219+
tc.run(context.TODO(), cs, true)
220+
gomega.Expect(tc.output.passed).To(gomega.BeTrue(), tc.output.String())
221+
})
214222
})
215223
g.When("the resource is a global resource", func() {
216224
g.BeforeEach(func() {
@@ -279,6 +287,8 @@ var _ = g.Describe("Authorization [RBAC] [Zalando]", func() {
279287
tc.run(context.TODO(), cs, true)
280288
gomega.Expect(tc.output.passed).To(gomega.BeTrue(), tc.output.String())
281289
})
290+
// This should be covered by the admission-controller tests. It will
291+
// be skipped here. Later when we cover everything with RBAC, we can run it again.
282292
g.It("should deny deletion of kube-system or visibility namespaces", func() {
283293
tc.data.resources = []string{"namespaces"}
284294
tc.data.names = []string{"kube-system", "visibility"}
@@ -292,9 +302,13 @@ var _ = g.Describe("Authorization [RBAC] [Zalando]", func() {
292302
tc.data.resources = namespacedResources
293303
tc.data.verbs = writeOperations
294304
})
295-
// This should be covered by the admission-controller tests.
296-
// It's written here for completeness.
297-
g.It("should deny write access in kube-system namespace", func() {})
305+
// This should be covered by the admission-controller tests. It will
306+
// be skipped here. Later when we cover everything with RBAC, we can run it again.
307+
g.It("should deny write access in kube-system namespace", func() {
308+
tc.data.namespaces = []string{"kube-system"}
309+
tc.run(context.TODO(), cs, false)
310+
gomega.Expect(tc.output.passed).To(gomega.BeTrue(), tc.output.String())
311+
})
298312
g.It("should allow write access in namespaces other than kube-system", func() {
299313
tc.data.namespaces = []string{"", "teapot"}
300314
tc.run(context.TODO(), cs, true)

test/e2e/run_e2e.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ if [ "$e2e" = true ]; then
185185
ginkgo -procs=25 -flake-attempts=2 \
186186
-focus="(\[Conformance\]|\[StatefulSetBasic\]|\[Feature:StatefulSet\]\s\[Slow\].*mysql|\[Zalando\])" \
187187
-skip="(\[Serial\]|validates.that.there.is.no.conflict.between.pods.with.same.hostPort.but.different.hostIP.and.protocol|Should.create.gradual.traffic.routes)" \
188+
-skip="should.deny.write.access.in.kube-system.and.visibility.namespaces|should.allow.write.access.in.namespaces.other.than.kube-system.and.visibility|should.deny.write.access.in.kube-system.namespace|should.deny.deletion.of.kube-system.or.visibility.namespaces" \
188189
"e2e.test" -- \
189190
-delete-namespace-on-failure=false \
190191
-non-blocking-taints=node.kubernetes.io/role,nvidia.com/gpu,dedicated \

0 commit comments

Comments
 (0)