Fixed access_test.go
kubectl auth returns with an exit code != 0 / error now when response is "no"
@@ -98,24 +98,21 @@ var _ = Describe("User Access", func() {
By(fmt.Sprintf("verifying VIEW sa for verb %s", verb))
expectedRes, _ := viewVerbs[verb]
as := fmt.Sprintf("system:serviceaccount:%s:%s", namespace, view)
- result, err := tests.RunKubectlCommand("auth", "can-i", "--as", as, verb, resource)
- Expect(err).ToNot(HaveOccurred())
+ result, _ := tests.RunKubectlCommand("auth", "can-i", "--as", as, verb, resource)
Expect(result).To(ContainSubstring(expectedRes))
// EDIT
By(fmt.Sprintf("verifying EDIT sa for verb %s", verb))
expectedRes, _ = editVerbs[verb]
as = fmt.Sprintf("system:serviceaccount:%s:%s", namespace, edit)
- result, err = tests.RunKubectlCommand("auth", "can-i", "--as", as, verb, resource)
- Expect(err).ToNot(HaveOccurred())
+ result, _ = tests.RunKubectlCommand("auth", "can-i", "--as", as, verb, resource)
Expect(result).To(ContainSubstring(expectedRes))
// ADMIN
By(fmt.Sprintf("verifying ADMIN sa for verb %s", verb))
expectedRes, _ = adminVerbs[verb]
as = fmt.Sprintf("system:serviceaccount:%s:%s", namespace, admin)
- result, err = tests.RunKubectlCommand("auth", "can-i", "--as", as, verb, resource)
- Expect(err).ToNot(HaveOccurred())
+ result, _ = tests.RunKubectlCommand("auth", "can-i", "--as", as, verb, resource)
Expect(result).To(ContainSubstring(expectedRes))
// DEFAULT - the default should always return 'no' for ever verb.
@@ -123,8 +120,7 @@ var _ = Describe("User Access", func() {
By(fmt.Sprintf("verifying DEFAULT sa for verb %s", verb))
expectedRes = "no"
as = fmt.Sprintf("system:serviceaccount:%s:default", namespace)
- result, err = tests.RunKubectlCommand("auth", "can-i", "--as", as, verb, resource)
- Expect(err).ToNot(HaveOccurred())
+ result, _ = tests.RunKubectlCommand("auth", "can-i", "--as", as, verb, resource)
Expect(result).To(ContainSubstring(expectedRes))
}
},
