refactor: replace util.SliceContainsString with slices.Contains & make fmt (#1041)

* use std package's func instead

Signed-off-by: gang.liu <gang.liu@daocloud.io>

* refactor: replace util.SliceContainsString with slices.Contains  & make fmt

Signed-off-by: gang.liu <gang.liu@daocloud.io>

---------

Signed-off-by: gang.liu <gang.liu@daocloud.io>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
This commit is contained in:
izturn
2024-04-19 20:15:50 +08:00
committed by GitHub
parent 693b23f1fc
commit 1ae4e75196
3 changed files with 7 additions and 38 deletions

View File

@@ -26,29 +26,6 @@ import (
"k8s.io/client-go/kubernetes/fake"
)
func TestSliceContainsString(t *testing.T) {
tests := []struct {
slice []string
s string
expected bool
}{
{
expected: false,
},
{
slice: []string{"temp", "value"},
s: "value",
expected: true,
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.s, func(t *testing.T) {
require.Equal(t, tt.expected, SliceContainsString(tt.slice, tt.s))
})
}
}
func TestGetParent(t *testing.T) {
ownerName := "test-name"
namespace := "test"
@@ -409,6 +386,7 @@ func TestGetPodListByLabels(t *testing.T) {
})
}
}
func TestFileExists(t *testing.T) {
tests := []struct {
filePath string