mirror of
https://github.com/helm/helm.git
synced 2026-04-24 15:49:11 -04:00
test(statuswait): add more tests suggested by Copilot code review
add missing coverage for the positive case where cluster-scoped resources (like ClusterRole or Namespace) should work correctly
Signed-off-by: Mohsen Mottaghi <mohsenmottaghi@outlook.com>
(cherry picked from commit a1543d5947)
This commit is contained in:
parent
3818c02f81
commit
2a2e6f722a
1 changed files with 30 additions and 0 deletions
|
|
@ -569,6 +569,34 @@ func TestStatusWaitMultipleNamespaces(t *testing.T) {
|
|||
return sw.WaitForDelete(rl, timeout)
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "cluster-scoped resources work correctly with unrestricted permissions",
|
||||
objManifests: []string{podNamespace1Manifest, clusterRoleManifest},
|
||||
testFunc: func(sw statusWaiter, rl ResourceList, timeout time.Duration) error {
|
||||
return sw.Wait(rl, timeout)
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "namespace-scoped and cluster-scoped resources work together",
|
||||
objManifests: []string{podNamespace1Manifest, podNamespace2Manifest, clusterRoleManifest},
|
||||
testFunc: func(sw statusWaiter, rl ResourceList, timeout time.Duration) error {
|
||||
return sw.Wait(rl, timeout)
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "delete cluster-scoped resources works correctly",
|
||||
objManifests: []string{podNamespace1Manifest, namespaceManifest},
|
||||
testFunc: func(sw statusWaiter, rl ResourceList, timeout time.Duration) error {
|
||||
return sw.WaitForDelete(rl, timeout)
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "watch cluster-scoped resources works correctly",
|
||||
objManifests: []string{clusterRoleManifest},
|
||||
testFunc: func(sw statusWaiter, rl ResourceList, timeout time.Duration) error {
|
||||
return sw.WatchUntilReady(rl, timeout)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
|
@ -579,6 +607,8 @@ func TestStatusWaitMultipleNamespaces(t *testing.T) {
|
|||
fakeMapper := testutil.NewFakeRESTMapper(
|
||||
v1.SchemeGroupVersion.WithKind("Pod"),
|
||||
batchv1.SchemeGroupVersion.WithKind("Job"),
|
||||
schema.GroupVersion{Group: "rbac.authorization.k8s.io", Version: "v1"}.WithKind("ClusterRole"),
|
||||
v1.SchemeGroupVersion.WithKind("Namespace"),
|
||||
)
|
||||
sw := statusWaiter{
|
||||
client: fakeClient,
|
||||
|
|
|
|||
Loading…
Reference in a new issue