mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
pkg/storage/testing/watcher_tests: RunWatchSemantics checks if the storage has been primed with init data
This commit is contained in:
parent
de735be512
commit
e7e2123feb
@ -1460,6 +1460,21 @@ func RunWatchSemantics(ctx context.Context, t *testing.T, store storage.Interfac
|
|||||||
createdPods = append(createdPods, out)
|
createdPods = append(createdPods, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(createdPods) > 0 {
|
||||||
|
// this list call ensures that the cache has seen the created pods.
|
||||||
|
// this makes the watch request below deterministic.
|
||||||
|
listObject := &example.PodList{}
|
||||||
|
opts := storage.ListOptions{
|
||||||
|
Predicate: storage.Everything,
|
||||||
|
Recursive: true,
|
||||||
|
ResourceVersion: createdPods[len(createdPods)-1].ResourceVersion,
|
||||||
|
ResourceVersionMatch: metav1.ResourceVersionMatchNotOlderThan,
|
||||||
|
}
|
||||||
|
err := store.GetList(ctx, fmt.Sprintf("/pods/%s", ns), opts, listObject)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Len(t, listObject.Items, len(createdPods))
|
||||||
|
}
|
||||||
|
|
||||||
if scenario.useCurrentRV {
|
if scenario.useCurrentRV {
|
||||||
currentStorageRV, err := storage.GetCurrentResourceVersionFromStorage(ctx, store, func() runtime.Object { return &example.PodList{} }, "/pods", "")
|
currentStorageRV, err := storage.GetCurrentResourceVersionFromStorage(ctx, store, func() runtime.Object { return &example.PodList{} }, "/pods", "")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user