replace sets.String with sets.Set[string]

The former is deprecated
This commit is contained in:
胡玮文 2024-08-29 02:19:20 +08:00
parent 30ec771cf6
commit e687f93f16

View File

@ -112,7 +112,7 @@ func (t *volumeLimitsTestSuite) DefineTests(driver storageframework.TestDriver,
podNames []string
// All created PVs, incl. the one in resource
pvNames sets.String
pvNames sets.Set[string]
}
var (
l local
@ -279,7 +279,7 @@ func (t *volumeLimitsTestSuite) DefineTests(driver storageframework.TestDriver,
})
}
func cleanupTest(ctx context.Context, cs clientset.Interface, ns string, podNames, pvcNames []string, pvNames sets.String, timeout time.Duration) error {
func cleanupTest(ctx context.Context, cs clientset.Interface, ns string, podNames, pvcNames []string, pvNames sets.Set[string], timeout time.Duration) error {
var cleanupErrors []string
for _, podName := range podNames {
err := cs.CoreV1().Pods(ns).Delete(ctx, podName, metav1.DeleteOptions{})
@ -326,8 +326,8 @@ func cleanupTest(ctx context.Context, cs clientset.Interface, ns string, podName
}
// waitForAllPVCsBound waits until the given PVCs are all bound. It then returns the bound PVC names as a set.
func waitForAllPVCsBound(ctx context.Context, cs clientset.Interface, timeout time.Duration, ns string, pvcNames []string) (sets.String, error) {
pvNames := sets.NewString()
func waitForAllPVCsBound(ctx context.Context, cs clientset.Interface, timeout time.Duration, ns string, pvcNames []string) (sets.Set[string], error) {
pvNames := sets.New[string]()
err := wait.Poll(5*time.Second, timeout, func() (bool, error) {
unbound := 0
for _, pvcName := range pvcNames {