chore: call close framework when finishing

Signed-off-by: googs1025 <googs1025@gmail.com>
This commit is contained in:
googs1025
2024-07-03 14:18:25 +08:00
parent 7e1a5a0ea8
commit d4627f16a5
14 changed files with 98 additions and 42 deletions

View File

@@ -340,7 +340,7 @@ func TestPostFilter(t *testing.T) {
for _, pod := range tt.pods {
podItems = append(podItems, *pod)
}
cs := clientsetfake.NewSimpleClientset(&v1.PodList{Items: podItems})
cs := clientsetfake.NewClientset(&v1.PodList{Items: podItems})
informerFactory := informers.NewSharedInformerFactory(cs, 0)
podInformer := informerFactory.Core().V1().Pods().Informer()
podInformer.GetStore().Add(tt.pod)
@@ -1087,7 +1087,7 @@ func TestDryRunPreemption(t *testing.T) {
for _, n := range nodes {
objs = append(objs, n)
}
informerFactory := informers.NewSharedInformerFactory(clientsetfake.NewSimpleClientset(objs...), 0)
informerFactory := informers.NewSharedInformerFactory(clientsetfake.NewClientset(objs...), 0)
parallelism := parallelize.DefaultParallelism
if tt.disableParallelism {
// We need disableParallelism because of the non-deterministic nature
@@ -1347,7 +1347,7 @@ func TestSelectBestCandidate(t *testing.T) {
for _, pod := range tt.pods {
objs = append(objs, pod)
}
cs := clientsetfake.NewSimpleClientset(objs...)
cs := clientsetfake.NewClientset(objs...)
informerFactory := informers.NewSharedInformerFactory(cs, 0)
snapshot := internalcache.NewSnapshot(tt.pods, nodes)
logger, ctx := ktesting.NewTestContext(t)
@@ -1685,7 +1685,7 @@ func TestPreempt(t *testing.T) {
labelKeys := []string{"hostname", "zone", "region"}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
client := clientsetfake.NewSimpleClientset()
client := clientsetfake.NewClientset()
informerFactory := informers.NewSharedInformerFactory(client, 0)
podInformer := informerFactory.Core().V1().Pods().Informer()
podInformer.GetStore().Add(test.pod)