chore: second depr. pointer pkg replacement for apiserver
Kubernetes-commit: fe61e825e046d793d64fc0686110212dacf8231e
This commit is contained in:
parent
03b538a8e8
commit
d0ee71ec17
|
@ -47,7 +47,7 @@ import (
|
||||||
"k8s.io/component-base/metrics/testutil"
|
"k8s.io/component-base/metrics/testutil"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
kmsservice "k8s.io/kms/pkg/service"
|
kmsservice "k8s.io/kms/pkg/service"
|
||||||
"k8s.io/utils/pointer"
|
"k8s.io/utils/ptr"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -411,7 +411,7 @@ func TestKMSvsEnablement(t *testing.T) {
|
||||||
Duration: 1 * time.Second,
|
Duration: 1 * time.Second,
|
||||||
},
|
},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(1000),
|
CacheSize: ptr.To[int32](1000),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -422,7 +422,7 @@ func TestKMSvsEnablement(t *testing.T) {
|
||||||
Duration: 1 * time.Second,
|
Duration: 1 * time.Second,
|
||||||
},
|
},
|
||||||
Endpoint: "unix:///tmp/anothertestprovider.sock",
|
Endpoint: "unix:///tmp/anothertestprovider.sock",
|
||||||
CacheSize: pointer.Int32(1000),
|
CacheSize: ptr.To[int32](1000),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -880,7 +880,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -904,7 +904,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -920,7 +920,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -944,7 +944,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -960,7 +960,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -984,7 +984,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1000,7 +1000,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1024,7 +1024,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1041,7 +1041,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/another-testprovider.sock",
|
Endpoint: "unix:///tmp/another-testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1067,7 +1067,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1091,7 +1091,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1108,7 +1108,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/another-testprovider.sock",
|
Endpoint: "unix:///tmp/another-testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1134,7 +1134,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1159,7 +1159,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1175,7 +1175,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/another-testprovider.sock",
|
Endpoint: "unix:///tmp/another-testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1201,7 +1201,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1225,7 +1225,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1241,7 +1241,7 @@ func TestWildcardMasking(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/another-testprovider.sock",
|
Endpoint: "unix:///tmp/another-testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1300,7 +1300,7 @@ func TestWildcardStructure(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1316,7 +1316,7 @@ func TestWildcardStructure(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1335,7 +1335,7 @@ func TestWildcardStructure(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1351,7 +1351,7 @@ func TestWildcardStructure(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1376,7 +1376,7 @@ func TestWildcardStructure(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1393,7 +1393,7 @@ func TestWildcardStructure(t *testing.T) {
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
Timeout: &metav1.Duration{Duration: 3 * time.Second},
|
||||||
Endpoint: "unix:///tmp/testprovider.sock",
|
Endpoint: "unix:///tmp/testprovider.sock",
|
||||||
CacheSize: pointer.Int32(10),
|
CacheSize: ptr.To[int32](10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,7 +60,7 @@ import (
|
||||||
"k8s.io/component-base/metrics/testutil"
|
"k8s.io/component-base/metrics/testutil"
|
||||||
"k8s.io/utils/clock"
|
"k8s.io/utils/clock"
|
||||||
testingclock "k8s.io/utils/clock/testing"
|
testingclock "k8s.io/utils/clock/testing"
|
||||||
"k8s.io/utils/pointer"
|
"k8s.io/utils/ptr"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newTestCacherWithoutSyncing(s storage.Interface, c clock.WithTicker) (*Cacher, storage.Versioner, error) {
|
func newTestCacherWithoutSyncing(s storage.Interface, c clock.WithTicker) (*Cacher, storage.Versioner, error) {
|
||||||
|
@ -2414,7 +2414,7 @@ func TestWaitUntilWatchCacheFreshAndForceAllEvents(t *testing.T) {
|
||||||
p.AllowWatchBookmarks = true
|
p.AllowWatchBookmarks = true
|
||||||
return p
|
return p
|
||||||
}(),
|
}(),
|
||||||
SendInitialEvents: pointer.Bool(true),
|
SendInitialEvents: ptr.To(true),
|
||||||
ResourceVersion: "105",
|
ResourceVersion: "105",
|
||||||
},
|
},
|
||||||
verifyBackingStore: func(t *testing.T, s *dummyStorage) {
|
verifyBackingStore: func(t *testing.T, s *dummyStorage) {
|
||||||
|
@ -2430,7 +2430,7 @@ func TestWaitUntilWatchCacheFreshAndForceAllEvents(t *testing.T) {
|
||||||
p.AllowWatchBookmarks = false
|
p.AllowWatchBookmarks = false
|
||||||
return p
|
return p
|
||||||
}(),
|
}(),
|
||||||
SendInitialEvents: pointer.Bool(true),
|
SendInitialEvents: ptr.To(true),
|
||||||
},
|
},
|
||||||
backingStorage: func() *dummyStorage {
|
backingStorage: func() *dummyStorage {
|
||||||
hasBeenPrimed := false
|
hasBeenPrimed := false
|
||||||
|
@ -2474,7 +2474,7 @@ func TestWaitUntilWatchCacheFreshAndForceAllEvents(t *testing.T) {
|
||||||
p.AllowWatchBookmarks = true
|
p.AllowWatchBookmarks = true
|
||||||
return p
|
return p
|
||||||
}(),
|
}(),
|
||||||
SendInitialEvents: pointer.Bool(true),
|
SendInitialEvents: ptr.To(true),
|
||||||
},
|
},
|
||||||
backingStorage: func() *dummyStorage {
|
backingStorage: func() *dummyStorage {
|
||||||
hasBeenPrimed := false
|
hasBeenPrimed := false
|
||||||
|
@ -2700,7 +2700,7 @@ func TestWatchListIsSynchronisedWhenNoEventsFromStoreReceived(t *testing.T) {
|
||||||
pred.AllowWatchBookmarks = true
|
pred.AllowWatchBookmarks = true
|
||||||
opts := storage.ListOptions{
|
opts := storage.ListOptions{
|
||||||
Predicate: pred,
|
Predicate: pred,
|
||||||
SendInitialEvents: pointer.Bool(true),
|
SendInitialEvents: ptr.To(true),
|
||||||
}
|
}
|
||||||
w, err := cacher.Watch(context.Background(), "pods/ns", opts)
|
w, err := cacher.Watch(context.Background(), "pods/ns", opts)
|
||||||
require.NoError(t, err, "failed to create watch: %v")
|
require.NoError(t, err, "failed to create watch: %v")
|
||||||
|
@ -2817,12 +2817,12 @@ func TestGetWatchCacheResourceVersion(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=unset, allowWatchBookmarks=true, sendInitialEvents=true",
|
name: "RV=unset, allowWatchBookmarks=true, sendInitialEvents=true",
|
||||||
opts: listOptions(true, pointer.Bool(true), ""),
|
opts: listOptions(true, ptr.To(true), ""),
|
||||||
expectedWatchResourceVersion: 100,
|
expectedWatchResourceVersion: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=unset, allowWatchBookmarks=true, sendInitialEvents=false",
|
name: "RV=unset, allowWatchBookmarks=true, sendInitialEvents=false",
|
||||||
opts: listOptions(true, pointer.Bool(false), ""),
|
opts: listOptions(true, ptr.To(false), ""),
|
||||||
expectedWatchResourceVersion: 100,
|
expectedWatchResourceVersion: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -2834,12 +2834,12 @@ func TestGetWatchCacheResourceVersion(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=unset, allowWatchBookmarks=false, sendInitialEvents=true, legacy",
|
name: "RV=unset, allowWatchBookmarks=false, sendInitialEvents=true, legacy",
|
||||||
opts: listOptions(false, pointer.Bool(true), ""),
|
opts: listOptions(false, ptr.To(true), ""),
|
||||||
expectedWatchResourceVersion: 100,
|
expectedWatchResourceVersion: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=unset, allowWatchBookmarks=false, sendInitialEvents=false",
|
name: "RV=unset, allowWatchBookmarks=false, sendInitialEvents=false",
|
||||||
opts: listOptions(false, pointer.Bool(false), ""),
|
opts: listOptions(false, ptr.To(false), ""),
|
||||||
expectedWatchResourceVersion: 100,
|
expectedWatchResourceVersion: 100,
|
||||||
},
|
},
|
||||||
// +-----------------+---------------------+-----------------------+
|
// +-----------------+---------------------+-----------------------+
|
||||||
|
@ -2854,12 +2854,12 @@ func TestGetWatchCacheResourceVersion(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=0, allowWatchBookmarks=true, sendInitialEvents=true",
|
name: "RV=0, allowWatchBookmarks=true, sendInitialEvents=true",
|
||||||
opts: listOptions(true, pointer.Bool(true), "0"),
|
opts: listOptions(true, ptr.To(true), "0"),
|
||||||
expectedWatchResourceVersion: 0,
|
expectedWatchResourceVersion: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=0, allowWatchBookmarks=true, sendInitialEvents=false",
|
name: "RV=0, allowWatchBookmarks=true, sendInitialEvents=false",
|
||||||
opts: listOptions(true, pointer.Bool(false), "0"),
|
opts: listOptions(true, ptr.To(false), "0"),
|
||||||
expectedWatchResourceVersion: 0,
|
expectedWatchResourceVersion: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -2869,12 +2869,12 @@ func TestGetWatchCacheResourceVersion(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=0, allowWatchBookmarks=false, sendInitialEvents=true",
|
name: "RV=0, allowWatchBookmarks=false, sendInitialEvents=true",
|
||||||
opts: listOptions(false, pointer.Bool(true), "0"),
|
opts: listOptions(false, ptr.To(true), "0"),
|
||||||
expectedWatchResourceVersion: 0,
|
expectedWatchResourceVersion: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=0, allowWatchBookmarks=false, sendInitialEvents=false",
|
name: "RV=0, allowWatchBookmarks=false, sendInitialEvents=false",
|
||||||
opts: listOptions(false, pointer.Bool(false), "0"),
|
opts: listOptions(false, ptr.To(false), "0"),
|
||||||
expectedWatchResourceVersion: 0,
|
expectedWatchResourceVersion: 0,
|
||||||
},
|
},
|
||||||
// +-----------------+---------------------+-----------------------+
|
// +-----------------+---------------------+-----------------------+
|
||||||
|
@ -2889,12 +2889,12 @@ func TestGetWatchCacheResourceVersion(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=95, allowWatchBookmarks=true, sendInitialEvents=true",
|
name: "RV=95, allowWatchBookmarks=true, sendInitialEvents=true",
|
||||||
opts: listOptions(true, pointer.Bool(true), "95"),
|
opts: listOptions(true, ptr.To(true), "95"),
|
||||||
expectedWatchResourceVersion: 95,
|
expectedWatchResourceVersion: 95,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=95, allowWatchBookmarks=true, sendInitialEvents=false",
|
name: "RV=95, allowWatchBookmarks=true, sendInitialEvents=false",
|
||||||
opts: listOptions(true, pointer.Bool(false), "95"),
|
opts: listOptions(true, ptr.To(false), "95"),
|
||||||
expectedWatchResourceVersion: 95,
|
expectedWatchResourceVersion: 95,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -2904,12 +2904,12 @@ func TestGetWatchCacheResourceVersion(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=95, allowWatchBookmarks=false, sendInitialEvents=true",
|
name: "RV=95, allowWatchBookmarks=false, sendInitialEvents=true",
|
||||||
opts: listOptions(false, pointer.Bool(true), "95"),
|
opts: listOptions(false, ptr.To(true), "95"),
|
||||||
expectedWatchResourceVersion: 95,
|
expectedWatchResourceVersion: 95,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=95, allowWatchBookmarks=false, sendInitialEvents=false",
|
name: "RV=95, allowWatchBookmarks=false, sendInitialEvents=false",
|
||||||
opts: listOptions(false, pointer.Bool(false), "95"),
|
opts: listOptions(false, ptr.To(false), "95"),
|
||||||
expectedWatchResourceVersion: 95,
|
expectedWatchResourceVersion: 95,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -2980,14 +2980,14 @@ func TestGetBookmarkAfterResourceVersionLockedFunc(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=unset, allowWatchBookmarks=true, sendInitialEvents=true",
|
name: "RV=unset, allowWatchBookmarks=true, sendInitialEvents=true",
|
||||||
opts: listOptions(true, pointer.Bool(true), ""),
|
opts: listOptions(true, ptr.To(true), ""),
|
||||||
requiredResourceVersion: 100,
|
requiredResourceVersion: 100,
|
||||||
watchCacheResourceVersion: 99,
|
watchCacheResourceVersion: 99,
|
||||||
expectedBookmarkResourceVersion: 100,
|
expectedBookmarkResourceVersion: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=unset, allowWatchBookmarks=true, sendInitialEvents=false",
|
name: "RV=unset, allowWatchBookmarks=true, sendInitialEvents=false",
|
||||||
opts: listOptions(true, pointer.Bool(false), ""),
|
opts: listOptions(true, ptr.To(false), ""),
|
||||||
requiredResourceVersion: 100,
|
requiredResourceVersion: 100,
|
||||||
watchCacheResourceVersion: 99,
|
watchCacheResourceVersion: 99,
|
||||||
expectedBookmarkResourceVersion: 0,
|
expectedBookmarkResourceVersion: 0,
|
||||||
|
@ -3001,14 +3001,14 @@ func TestGetBookmarkAfterResourceVersionLockedFunc(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=unset, allowWatchBookmarks=false, sendInitialEvents=true",
|
name: "RV=unset, allowWatchBookmarks=false, sendInitialEvents=true",
|
||||||
opts: listOptions(false, pointer.Bool(true), ""),
|
opts: listOptions(false, ptr.To(true), ""),
|
||||||
requiredResourceVersion: 100,
|
requiredResourceVersion: 100,
|
||||||
watchCacheResourceVersion: 99,
|
watchCacheResourceVersion: 99,
|
||||||
expectedBookmarkResourceVersion: 0,
|
expectedBookmarkResourceVersion: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=unset, allowWatchBookmarks=false, sendInitialEvents=false",
|
name: "RV=unset, allowWatchBookmarks=false, sendInitialEvents=false",
|
||||||
opts: listOptions(false, pointer.Bool(false), ""),
|
opts: listOptions(false, ptr.To(false), ""),
|
||||||
requiredResourceVersion: 100,
|
requiredResourceVersion: 100,
|
||||||
watchCacheResourceVersion: 99,
|
watchCacheResourceVersion: 99,
|
||||||
expectedBookmarkResourceVersion: 0,
|
expectedBookmarkResourceVersion: 0,
|
||||||
|
@ -3027,14 +3027,14 @@ func TestGetBookmarkAfterResourceVersionLockedFunc(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=0, allowWatchBookmarks=true, sendInitialEvents=true",
|
name: "RV=0, allowWatchBookmarks=true, sendInitialEvents=true",
|
||||||
opts: listOptions(true, pointer.Bool(true), "0"),
|
opts: listOptions(true, ptr.To(true), "0"),
|
||||||
requiredResourceVersion: 0,
|
requiredResourceVersion: 0,
|
||||||
watchCacheResourceVersion: 99,
|
watchCacheResourceVersion: 99,
|
||||||
expectedBookmarkResourceVersion: 99,
|
expectedBookmarkResourceVersion: 99,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=0, allowWatchBookmarks=true, sendInitialEvents=false",
|
name: "RV=0, allowWatchBookmarks=true, sendInitialEvents=false",
|
||||||
opts: listOptions(true, pointer.Bool(false), "0"),
|
opts: listOptions(true, ptr.To(false), "0"),
|
||||||
requiredResourceVersion: 0,
|
requiredResourceVersion: 0,
|
||||||
watchCacheResourceVersion: 99,
|
watchCacheResourceVersion: 99,
|
||||||
expectedBookmarkResourceVersion: 0,
|
expectedBookmarkResourceVersion: 0,
|
||||||
|
@ -3048,14 +3048,14 @@ func TestGetBookmarkAfterResourceVersionLockedFunc(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=0, allowWatchBookmarks=false, sendInitialEvents=true",
|
name: "RV=0, allowWatchBookmarks=false, sendInitialEvents=true",
|
||||||
opts: listOptions(false, pointer.Bool(true), "0"),
|
opts: listOptions(false, ptr.To(true), "0"),
|
||||||
requiredResourceVersion: 0,
|
requiredResourceVersion: 0,
|
||||||
watchCacheResourceVersion: 99,
|
watchCacheResourceVersion: 99,
|
||||||
expectedBookmarkResourceVersion: 0,
|
expectedBookmarkResourceVersion: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=0, allowWatchBookmarks=false, sendInitialEvents=false",
|
name: "RV=0, allowWatchBookmarks=false, sendInitialEvents=false",
|
||||||
opts: listOptions(false, pointer.Bool(false), "0"),
|
opts: listOptions(false, ptr.To(false), "0"),
|
||||||
requiredResourceVersion: 0,
|
requiredResourceVersion: 0,
|
||||||
watchCacheResourceVersion: 99,
|
watchCacheResourceVersion: 99,
|
||||||
expectedBookmarkResourceVersion: 0,
|
expectedBookmarkResourceVersion: 0,
|
||||||
|
@ -3074,14 +3074,14 @@ func TestGetBookmarkAfterResourceVersionLockedFunc(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=95, allowWatchBookmarks=true, sendInitialEvents=true",
|
name: "RV=95, allowWatchBookmarks=true, sendInitialEvents=true",
|
||||||
opts: listOptions(true, pointer.Bool(true), "95"),
|
opts: listOptions(true, ptr.To(true), "95"),
|
||||||
requiredResourceVersion: 0,
|
requiredResourceVersion: 0,
|
||||||
watchCacheResourceVersion: 99,
|
watchCacheResourceVersion: 99,
|
||||||
expectedBookmarkResourceVersion: 95,
|
expectedBookmarkResourceVersion: 95,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=95, allowWatchBookmarks=true, sendInitialEvents=false",
|
name: "RV=95, allowWatchBookmarks=true, sendInitialEvents=false",
|
||||||
opts: listOptions(true, pointer.Bool(false), "95"),
|
opts: listOptions(true, ptr.To(false), "95"),
|
||||||
requiredResourceVersion: 0,
|
requiredResourceVersion: 0,
|
||||||
watchCacheResourceVersion: 99,
|
watchCacheResourceVersion: 99,
|
||||||
expectedBookmarkResourceVersion: 0,
|
expectedBookmarkResourceVersion: 0,
|
||||||
|
@ -3095,14 +3095,14 @@ func TestGetBookmarkAfterResourceVersionLockedFunc(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=95, allowWatchBookmarks=false, sendInitialEvents=true",
|
name: "RV=95, allowWatchBookmarks=false, sendInitialEvents=true",
|
||||||
opts: listOptions(false, pointer.Bool(true), "95"),
|
opts: listOptions(false, ptr.To(true), "95"),
|
||||||
requiredResourceVersion: 0,
|
requiredResourceVersion: 0,
|
||||||
watchCacheResourceVersion: 99,
|
watchCacheResourceVersion: 99,
|
||||||
expectedBookmarkResourceVersion: 0,
|
expectedBookmarkResourceVersion: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "RV=95, allowWatchBookmarks=false, sendInitialEvents=false",
|
name: "RV=95, allowWatchBookmarks=false, sendInitialEvents=false",
|
||||||
opts: listOptions(false, pointer.Bool(false), "95"),
|
opts: listOptions(false, ptr.To(false), "95"),
|
||||||
requiredResourceVersion: 0,
|
requiredResourceVersion: 0,
|
||||||
watchCacheResourceVersion: 99,
|
watchCacheResourceVersion: 99,
|
||||||
expectedBookmarkResourceVersion: 0,
|
expectedBookmarkResourceVersion: 0,
|
||||||
|
|
|
@ -44,7 +44,7 @@ import (
|
||||||
"k8s.io/apiserver/pkg/storage"
|
"k8s.io/apiserver/pkg/storage"
|
||||||
"k8s.io/apiserver/pkg/storage/value"
|
"k8s.io/apiserver/pkg/storage/value"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
utilpointer "k8s.io/utils/pointer"
|
"k8s.io/utils/ptr"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KeyValidation func(ctx context.Context, t *testing.T, key string)
|
type KeyValidation func(ctx context.Context, t *testing.T, key string)
|
||||||
|
@ -817,7 +817,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
expectRV: currentRV,
|
expectRV: currentRV,
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectContinueExact: encodeContinueOrDie(createdPods[1].Name+"\x00", int64(mustAtoi(currentRV))),
|
expectContinueExact: encodeContinueOrDie(createdPods[1].Name+"\x00", int64(mustAtoi(currentRV))),
|
||||||
expectedRemainingItemCount: utilpointer.Int64(1),
|
expectedRemainingItemCount: ptr.To[int64](1),
|
||||||
expectEtcdRequest: func() []RecordedList {
|
expectEtcdRequest: func() []RecordedList {
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.ConsistentListFromCache) {
|
if utilfeature.DefaultFeatureGate.Enabled(features.ConsistentListFromCache) {
|
||||||
return nil
|
return nil
|
||||||
|
@ -841,7 +841,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
expectedOut: []example.Pod{*createdPods[1]},
|
expectedOut: []example.Pod{*createdPods[1]},
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectContinueExact: encodeContinueOrDie(createdPods[1].Name+"\x00", int64(mustAtoi(list.ResourceVersion))),
|
expectContinueExact: encodeContinueOrDie(createdPods[1].Name+"\x00", int64(mustAtoi(list.ResourceVersion))),
|
||||||
expectedRemainingItemCount: utilpointer.Int64(1),
|
expectedRemainingItemCount: ptr.To[int64](1),
|
||||||
rv: list.ResourceVersion,
|
rv: list.ResourceVersion,
|
||||||
expectRV: list.ResourceVersion,
|
expectRV: list.ResourceVersion,
|
||||||
},
|
},
|
||||||
|
@ -856,7 +856,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
expectedOut: []example.Pod{*createdPods[1]},
|
expectedOut: []example.Pod{*createdPods[1]},
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectContinueExact: encodeContinueOrDie(createdPods[1].Name+"\x00", int64(mustAtoi(list.ResourceVersion))),
|
expectContinueExact: encodeContinueOrDie(createdPods[1].Name+"\x00", int64(mustAtoi(list.ResourceVersion))),
|
||||||
expectedRemainingItemCount: utilpointer.Int64(1),
|
expectedRemainingItemCount: ptr.To[int64](1),
|
||||||
rv: list.ResourceVersion,
|
rv: list.ResourceVersion,
|
||||||
rvMatch: metav1.ResourceVersionMatchExact,
|
rvMatch: metav1.ResourceVersionMatchExact,
|
||||||
expectRV: list.ResourceVersion,
|
expectRV: list.ResourceVersion,
|
||||||
|
@ -871,7 +871,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
},
|
},
|
||||||
expectedOut: []example.Pod{*createdPods[1]},
|
expectedOut: []example.Pod{*createdPods[1]},
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectedRemainingItemCount: utilpointer.Int64(1),
|
expectedRemainingItemCount: ptr.To[int64](1),
|
||||||
rv: list.ResourceVersion,
|
rv: list.ResourceVersion,
|
||||||
rvMatch: metav1.ResourceVersionMatchNotOlderThan,
|
rvMatch: metav1.ResourceVersionMatchNotOlderThan,
|
||||||
expectRVFunc: resourceVersionNotOlderThan(list.ResourceVersion),
|
expectRVFunc: resourceVersionNotOlderThan(list.ResourceVersion),
|
||||||
|
@ -891,7 +891,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
ignoreForWatchCache: true,
|
ignoreForWatchCache: true,
|
||||||
expectedOut: []example.Pod{*createdPods[1]},
|
expectedOut: []example.Pod{*createdPods[1]},
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectedRemainingItemCount: utilpointer.Int64(1),
|
expectedRemainingItemCount: ptr.To[int64](1),
|
||||||
rv: "0",
|
rv: "0",
|
||||||
expectRVFunc: resourceVersionNotOlderThan(list.ResourceVersion),
|
expectRVFunc: resourceVersionNotOlderThan(list.ResourceVersion),
|
||||||
},
|
},
|
||||||
|
@ -910,7 +910,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
ignoreForWatchCache: true,
|
ignoreForWatchCache: true,
|
||||||
expectedOut: []example.Pod{*createdPods[1]},
|
expectedOut: []example.Pod{*createdPods[1]},
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectedRemainingItemCount: utilpointer.Int64(1),
|
expectedRemainingItemCount: ptr.To[int64](1),
|
||||||
rv: "0",
|
rv: "0",
|
||||||
rvMatch: metav1.ResourceVersionMatchNotOlderThan,
|
rvMatch: metav1.ResourceVersionMatchNotOlderThan,
|
||||||
expectRVFunc: resourceVersionNotOlderThan(list.ResourceVersion),
|
expectRVFunc: resourceVersionNotOlderThan(list.ResourceVersion),
|
||||||
|
@ -1319,7 +1319,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
expectContinueExact: encodeContinueOrDie(createdPods[0].Namespace+"/"+createdPods[0].Name+"\x00", int64(mustAtoi(createdPods[1].ResourceVersion))),
|
expectContinueExact: encodeContinueOrDie(createdPods[0].Namespace+"/"+createdPods[0].Name+"\x00", int64(mustAtoi(createdPods[1].ResourceVersion))),
|
||||||
rvMatch: metav1.ResourceVersionMatchExact,
|
rvMatch: metav1.ResourceVersionMatchExact,
|
||||||
expectRV: createdPods[1].ResourceVersion,
|
expectRV: createdPods[1].ResourceVersion,
|
||||||
expectedRemainingItemCount: utilpointer.Int64(1),
|
expectedRemainingItemCount: ptr.To[int64](1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test List with limit, resource version of third write, match=Exact",
|
name: "test List with limit, resource version of third write, match=Exact",
|
||||||
|
@ -1335,7 +1335,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectContinueExact: encodeContinueOrDie(createdPods[1].Namespace+"/"+createdPods[1].Name+"\x00", int64(mustAtoi(createdPods[2].ResourceVersion))),
|
expectContinueExact: encodeContinueOrDie(createdPods[1].Namespace+"/"+createdPods[1].Name+"\x00", int64(mustAtoi(createdPods[2].ResourceVersion))),
|
||||||
expectRV: createdPods[2].ResourceVersion,
|
expectRV: createdPods[2].ResourceVersion,
|
||||||
expectedRemainingItemCount: utilpointer.Int64(1),
|
expectedRemainingItemCount: ptr.To[int64](1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test List with limit, resource version of fourth write, match=Exact",
|
name: "test List with limit, resource version of fourth write, match=Exact",
|
||||||
|
@ -1364,7 +1364,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
expectRV: createdPods[4].ResourceVersion,
|
expectRV: createdPods[4].ResourceVersion,
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectContinueExact: encodeContinueOrDie(createdPods[0].Namespace+"/"+createdPods[0].Name+"\x00", int64(mustAtoi(createdPods[4].ResourceVersion))),
|
expectContinueExact: encodeContinueOrDie(createdPods[0].Namespace+"/"+createdPods[0].Name+"\x00", int64(mustAtoi(createdPods[4].ResourceVersion))),
|
||||||
expectedRemainingItemCount: utilpointer.Int64(4),
|
expectedRemainingItemCount: ptr.To[int64](4),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test List with limit, resource version of six write, match=Exact",
|
name: "test List with limit, resource version of six write, match=Exact",
|
||||||
|
@ -1380,7 +1380,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
expectRV: createdPods[5].ResourceVersion,
|
expectRV: createdPods[5].ResourceVersion,
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectContinueExact: encodeContinueOrDie(createdPods[1].Namespace+"/"+createdPods[1].Name+"\x00", int64(mustAtoi(createdPods[5].ResourceVersion))),
|
expectContinueExact: encodeContinueOrDie(createdPods[1].Namespace+"/"+createdPods[1].Name+"\x00", int64(mustAtoi(createdPods[5].ResourceVersion))),
|
||||||
expectedRemainingItemCount: utilpointer.Int64(4),
|
expectedRemainingItemCount: ptr.To[int64](4),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test List with limit, resource version of seventh write, match=Exact",
|
name: "test List with limit, resource version of seventh write, match=Exact",
|
||||||
|
@ -1396,7 +1396,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
expectRV: updatedPod.ResourceVersion,
|
expectRV: updatedPod.ResourceVersion,
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectContinueExact: encodeContinueOrDie(createdPods[2].Namespace+"/"+createdPods[2].Name+"\x00", int64(mustAtoi(updatedPod.ResourceVersion))),
|
expectContinueExact: encodeContinueOrDie(createdPods[2].Namespace+"/"+createdPods[2].Name+"\x00", int64(mustAtoi(updatedPod.ResourceVersion))),
|
||||||
expectedRemainingItemCount: utilpointer.Int64(2),
|
expectedRemainingItemCount: ptr.To[int64](2),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test List with limit, resource version of eight write, match=Exact",
|
name: "test List with limit, resource version of eight write, match=Exact",
|
||||||
|
@ -1425,7 +1425,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
expectRV: fmt.Sprint(continueRV + 1),
|
expectRV: fmt.Sprint(continueRV + 1),
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectContinueExact: encodeContinueOrDie(updatedPod.Namespace+"/"+updatedPod.Name+"\x00", int64(continueRV+1)),
|
expectContinueExact: encodeContinueOrDie(updatedPod.Namespace+"/"+updatedPod.Name+"\x00", int64(continueRV+1)),
|
||||||
expectedRemainingItemCount: utilpointer.Int64(4),
|
expectedRemainingItemCount: ptr.To[int64](4),
|
||||||
},
|
},
|
||||||
// Continue
|
// Continue
|
||||||
{
|
{
|
||||||
|
@ -1465,7 +1465,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
expectRV: createdPods[4].ResourceVersion,
|
expectRV: createdPods[4].ResourceVersion,
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectContinueExact: encodeContinueOrDie(createdPods[1].Namespace+"/"+createdPods[1].Name+"\x00", int64(mustAtoi(createdPods[4].ResourceVersion))),
|
expectContinueExact: encodeContinueOrDie(createdPods[1].Namespace+"/"+createdPods[1].Name+"\x00", int64(mustAtoi(createdPods[4].ResourceVersion))),
|
||||||
expectedRemainingItemCount: utilpointer.Int64(3),
|
expectedRemainingItemCount: ptr.To[int64](3),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test List with continue, resource version of six write",
|
name: "test List with continue, resource version of six write",
|
||||||
|
@ -1480,7 +1480,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
expectRV: createdPods[5].ResourceVersion,
|
expectRV: createdPods[5].ResourceVersion,
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectContinueExact: encodeContinueOrDie(createdPods[2].Namespace+"/"+createdPods[2].Name+"\x00", int64(mustAtoi(createdPods[5].ResourceVersion))),
|
expectContinueExact: encodeContinueOrDie(createdPods[2].Namespace+"/"+createdPods[2].Name+"\x00", int64(mustAtoi(createdPods[5].ResourceVersion))),
|
||||||
expectedRemainingItemCount: utilpointer.Int64(2),
|
expectedRemainingItemCount: ptr.To[int64](2),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test List with continue, resource version of seventh write",
|
name: "test List with continue, resource version of seventh write",
|
||||||
|
@ -1507,7 +1507,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
expectRV: fmt.Sprint(continueRV + 1),
|
expectRV: fmt.Sprint(continueRV + 1),
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectContinueExact: encodeContinueOrDie(createdPods[1].Namespace+"/"+createdPods[1].Name+"\x00", int64(continueRV+1)),
|
expectContinueExact: encodeContinueOrDie(createdPods[1].Namespace+"/"+createdPods[1].Name+"\x00", int64(continueRV+1)),
|
||||||
expectedRemainingItemCount: utilpointer.Int64(3),
|
expectedRemainingItemCount: ptr.To[int64](3),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test List with continue from second pod, negative resource version gives consistent read",
|
name: "test List with continue from second pod, negative resource version gives consistent read",
|
||||||
|
@ -1533,7 +1533,7 @@ func RunTestList(ctx context.Context, t *testing.T, store storage.Interface, inc
|
||||||
expectContinue: true,
|
expectContinue: true,
|
||||||
expectContinueExact: encodeContinueOrDie(createdPods[2].Namespace+"/"+createdPods[2].Name+"\x00", int64(continueRV+1)),
|
expectContinueExact: encodeContinueOrDie(createdPods[2].Namespace+"/"+createdPods[2].Name+"\x00", int64(continueRV+1)),
|
||||||
expectRV: currentRV,
|
expectRV: currentRV,
|
||||||
expectedRemainingItemCount: utilpointer.Int64(2),
|
expectedRemainingItemCount: ptr.To[int64](2),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test List with continue from third pod, negative resource version gives consistent read",
|
name: "test List with continue from third pod, negative resource version gives consistent read",
|
||||||
|
|
|
@ -44,7 +44,7 @@ import (
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
utilflowcontrol "k8s.io/apiserver/pkg/util/flowcontrol"
|
utilflowcontrol "k8s.io/apiserver/pkg/util/flowcontrol"
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||||
"k8s.io/utils/pointer"
|
"k8s.io/utils/ptr"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RunTestWatch(ctx context.Context, t *testing.T, store storage.Interface) {
|
func RunTestWatch(ctx context.Context, t *testing.T, store storage.Interface) {
|
||||||
|
@ -1273,7 +1273,7 @@ func RunTestOptionalWatchBookmarksWithCorrectResourceVersion(ctx context.Context
|
||||||
// In that case we expect a watch request to be established.
|
// In that case we expect a watch request to be established.
|
||||||
func RunSendInitialEventsBackwardCompatibility(ctx context.Context, t *testing.T, store storage.Interface) {
|
func RunSendInitialEventsBackwardCompatibility(ctx context.Context, t *testing.T, store storage.Interface) {
|
||||||
opts := storage.ListOptions{Predicate: storage.Everything}
|
opts := storage.ListOptions{Predicate: storage.Everything}
|
||||||
opts.SendInitialEvents = pointer.Bool(true)
|
opts.SendInitialEvents = ptr.To(true)
|
||||||
w, err := store.Watch(ctx, "/pods", opts)
|
w, err := store.Watch(ctx, "/pods", opts)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
w.Stop()
|
w.Stop()
|
||||||
|
|
Loading…
Reference in New Issue