Skip to content

Commit 88e9595

Browse files
authored
Merge pull request #175 from ntnn/skip-globalsa-check
Tie global service account test result to feature gate it relies on
2 parents 82bf189 + 910bb85 commit 88e9595

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pkg/registry/rbac/validation/kcp_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
authserviceaccount "k8s.io/apiserver/pkg/authentication/serviceaccount"
1212
"k8s.io/apiserver/pkg/authentication/user"
1313
"k8s.io/apiserver/pkg/endpoints/request"
14+
utilfeature "k8s.io/apiserver/pkg/util/feature"
15+
"k8s.io/kubernetes/pkg/features"
1416
)
1517

1618
func TestIsInScope(t *testing.T) {
@@ -145,6 +147,8 @@ func TestIsInScope(t *testing.T) {
145147
}
146148

147149
func TestAppliesToUserWithWarrantsAndScopes(t *testing.T) {
150+
globalsa := utilfeature.DefaultFeatureGate.Enabled(features.GlobalServiceAccount)
151+
148152
tests := []struct {
149153
name string
150154
user user.Info
@@ -266,7 +270,12 @@ func TestAppliesToUserWithWarrantsAndScopes(t *testing.T) {
266270
name: "local service account as global kcp service account",
267271
user: &user.DefaultInfo{Name: "system:serviceaccount:ns:sa", Extra: map[string][]string{"authentication.kcp.io/cluster-name": {"this"}}},
268272
sub: rbacv1.Subject{Kind: "User", Name: "system:kcp:serviceaccount:this:ns:sa"},
269-
want: true,
273+
// This test can only pass if the feature gate is enabled.
274+
// Since global service accounts are not fully implemented
275+
// yet the result of this test is tied to the feature gate.
276+
// When the feature is fully implemented this test should
277+
// run once with and once without the feature gate.
278+
want: globalsa,
270279
},
271280
{
272281
name: "foreign service account as global kcp service account",

0 commit comments

Comments
 (0)