Skip to content

Commit

Permalink
Deflake watchcache tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtek-t committed Apr 29, 2024
1 parent c6b6163 commit ac3e675
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions staging/src/k8s.io/apiserver/pkg/storage/testing/store_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -1631,7 +1631,9 @@ func RunTestListContinuation(ctx context.Context, t *testing.T, store storage.In
}
}
options := storage.ListOptions{
ResourceVersion: "0",
// Limit is ignored when ResourceVersion is set to 0.
// Set it to consistent read.
ResourceVersion: "",
Predicate: pred(1, ""),
Recursive: true,
}
Expand All @@ -1654,7 +1656,8 @@ func RunTestListContinuation(ctx context.Context, t *testing.T, store storage.In
// no limit, should get two items
out = &example.PodList{}
options = storage.ListOptions{
ResourceVersion: "0",
// ResourceVersion should be unset when setting continuation token.
ResourceVersion: "",
Predicate: pred(0, continueFromSecondItem),
Recursive: true,
}
Expand All @@ -1677,7 +1680,8 @@ func RunTestListContinuation(ctx context.Context, t *testing.T, store storage.In
// limit, should get two more pages
out = &example.PodList{}
options = storage.ListOptions{
ResourceVersion: "0",
// ResourceVersion should be unset when setting continuation token.
ResourceVersion: "",
Predicate: pred(1, continueFromSecondItem),
Recursive: true,
}
Expand All @@ -1699,7 +1703,8 @@ func RunTestListContinuation(ctx context.Context, t *testing.T, store storage.In

out = &example.PodList{}
options = storage.ListOptions{
ResourceVersion: "0",
// ResourceVersion should be unset when setting continuation token.
ResourceVersion: "",
Predicate: pred(1, continueFromThirdItem),
Recursive: true,
}
Expand Down Expand Up @@ -1815,7 +1820,9 @@ func RunTestListContinuationWithFilter(ctx context.Context, t *testing.T, store
}
}
options := storage.ListOptions{
ResourceVersion: "0",
// Limit is ignored when ResourceVersion is set to 0.
// Set it to consistent read.
ResourceVersion: "",
Predicate: pred(2, ""),
Recursive: true,
}
Expand Down Expand Up @@ -1845,7 +1852,8 @@ func RunTestListContinuationWithFilter(ctx context.Context, t *testing.T, store
// both read counters should be incremented for the singular calls they make in this case
out = &example.PodList{}
options = storage.ListOptions{
ResourceVersion: "0",
// ResourceVersion should be unset when setting continuation token.
ResourceVersion: "",
Predicate: pred(2, cont),
Recursive: true,
}
Expand Down

0 comments on commit ac3e675

Please sign in to comment.