cacher: Use PodList type for use in GetList

Using a Pod type in a GetList() call in a test
can panic at worst and error out at best. Here,
neither happened because the error condition
being tested for (cacher being stopped or not)
gets returned before the list pointer can be
enforced.

This commit changes the above to use PodList.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
This commit is contained in:
Madhav Jivrajani 2022-07-15 12:22:04 +05:30
parent be53d94595
commit 487761f4e2

View File

@ -647,10 +647,11 @@ func TestCacheDontAcceptRequestsStopped(t *testing.T) {
t.Fatalf("Success to create Get: %v", err)
}
listResult := &example.PodList{}
err = cacher.GetList(context.TODO(), "pods/ns", storage.ListOptions{
ResourceVersion: "1",
Recursive: true,
}, result)
}, listResult)
if err == nil {
t.Fatalf("Success to create GetList: %v", err)
}
@ -660,7 +661,6 @@ func TestCacheDontAcceptRequestsStopped(t *testing.T) {
case <-time.After(wait.ForeverTestTimeout):
t.Errorf("timed out waiting for watch to close")
}
}
func TestTimeBucketWatchersBasic(t *testing.T) {