@@ -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
1618func TestIsInScope (t * testing.T ) {
@@ -145,6 +147,8 @@ func TestIsInScope(t *testing.T) {
145147}
146148
147149func 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