K8s: Update from v0.31.3 to v0.32.0 (#98507)

This commit is contained in:
Ryan McKinley
2025-01-06 18:20:35 +03:00
committed by GitHub
parent 085dac8206
commit 6683cdc082
57 changed files with 615 additions and 824 deletions
+15 -15
View File
@@ -249,7 +249,7 @@ func RunTestUnconditionalDelete(ctx context.Context, t *testing.T, store storage
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
out := &example.Pod{} // reset
err := store.Delete(ctx, tt.key, out, nil, storage.ValidateAllObjectFunc, nil)
err := store.Delete(ctx, tt.key, out, nil, storage.ValidateAllObjectFunc, nil, storage.DeleteOptions{})
if tt.expectNotFoundErr {
if err == nil || !storage.IsNotFound(err) {
t.Errorf("expecting not found error, but get: %s", err)
@@ -291,7 +291,7 @@ func RunTestConditionalDelete(ctx context.Context, t *testing.T, store storage.I
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
out := &example.Pod{}
err := store.Delete(ctx, key, out, tt.precondition, storage.ValidateAllObjectFunc, nil)
err := store.Delete(ctx, key, out, tt.precondition, storage.ValidateAllObjectFunc, nil, storage.DeleteOptions{})
if tt.expectInvalidObjErr {
if err == nil || !storage.IsInvalidObj(err) {
t.Errorf("expecting invalid UID error, but get: %s", err)
@@ -343,7 +343,7 @@ func RunTestDeleteWithSuggestion(ctx context.Context, t *testing.T, store storag
key, originalPod := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "name", Namespace: "test-ns"}})
out := &example.Pod{}
if err := store.Delete(ctx, key, out, nil, storage.ValidateAllObjectFunc, originalPod); err != nil {
if err := store.Delete(ctx, key, out, nil, storage.ValidateAllObjectFunc, originalPod, storage.DeleteOptions{}); err != nil {
t.Errorf("Unexpected failure during deletion: %v", err)
}
@@ -367,7 +367,7 @@ func RunTestDeleteWithSuggestionAndConflict(ctx context.Context, t *testing.T, s
}
out := &example.Pod{}
if err := store.Delete(ctx, key, out, nil, storage.ValidateAllObjectFunc, originalPod); err != nil {
if err := store.Delete(ctx, key, out, nil, storage.ValidateAllObjectFunc, originalPod, storage.DeleteOptions{}); err != nil {
t.Errorf("Unexpected failure during deletion: %v", err)
}
@@ -405,7 +405,7 @@ func RunTestDeleteWithConflict(ctx context.Context, t *testing.T, store storage.
}
out := &example.Pod{}
if err := store.Delete(ctx, key, out, nil, validateAllWithUpdate, nil); err != nil {
if err := store.Delete(ctx, key, out, nil, validateAllWithUpdate, nil, storage.DeleteOptions{}); err != nil {
t.Errorf("Unexpected failure during deletion: %v", err)
}
@@ -428,13 +428,13 @@ func RunTestDeleteWithSuggestionOfDeletedObject(ctx context.Context, t *testing.
// First delete, so originalPod is outdated.
deletedPod := &example.Pod{}
if err := store.Delete(ctx, key, deletedPod, nil, storage.ValidateAllObjectFunc, originalPod); err != nil {
if err := store.Delete(ctx, key, deletedPod, nil, storage.ValidateAllObjectFunc, originalPod, storage.DeleteOptions{}); err != nil {
t.Errorf("Unexpected failure during deletion: %v", err)
}
// Now try deleting with stale object.
out := &example.Pod{}
if err := store.Delete(ctx, key, out, nil, storage.ValidateAllObjectFunc, originalPod); !storage.IsNotFound(err) {
if err := store.Delete(ctx, key, out, nil, storage.ValidateAllObjectFunc, originalPod, storage.DeleteOptions{}); !storage.IsNotFound(err) {
t.Errorf("Unexpected error during deletion: %v, expected not-found", err)
}
}
@@ -450,7 +450,7 @@ func RunTestValidateDeletionWithSuggestion(ctx context.Context, t *testing.T, st
return validationError
}
out := &example.Pod{}
if err := store.Delete(ctx, key, out, nil, validateNothing, originalPod); !errors.Is(err, validationError) {
if err := store.Delete(ctx, key, out, nil, validateNothing, originalPod, storage.DeleteOptions{}); !errors.Is(err, validationError) {
t.Errorf("Unexpected failure during deletion: %v", err)
}
if validationCalls != 1 {
@@ -478,7 +478,7 @@ func RunTestValidateDeletionWithSuggestion(ctx context.Context, t *testing.T, st
return nil
}
if err := store.Delete(ctx, key, out, nil, validateFresh, originalPod); err != nil {
if err := store.Delete(ctx, key, out, nil, validateFresh, originalPod, storage.DeleteOptions{}); err != nil {
t.Errorf("Unexpected failure during deletion: %v", err)
}
@@ -506,7 +506,7 @@ func RunTestValidateDeletionWithOnlySuggestionValid(ctx context.Context, t *test
return validationError
}
out := &example.Pod{}
if err := store.Delete(ctx, key, out, nil, validateNothing, originalPod); !errors.Is(err, validationError) {
if err := store.Delete(ctx, key, out, nil, validateNothing, originalPod, storage.DeleteOptions{}); !errors.Is(err, validationError) {
t.Errorf("Unexpected failure during deletion: %v", err)
}
if validationCalls != 1 {
@@ -534,7 +534,7 @@ func RunTestValidateDeletionWithOnlySuggestionValid(ctx context.Context, t *test
return nil
}
err := store.Delete(ctx, key, out, nil, validateFresh, originalPod)
err := store.Delete(ctx, key, out, nil, validateFresh, originalPod, storage.DeleteOptions{})
if err == nil || err.Error() != "stale object" {
t.Errorf("expecting stale object error, but get: %s", err)
}
@@ -568,7 +568,7 @@ func RunTestPreconditionalDeleteWithSuggestion(ctx context.Context, t *testing.T
prec := storage.NewUIDPreconditions("myUID")
out := &example.Pod{}
if err := store.Delete(ctx, key, out, prec, storage.ValidateAllObjectFunc, originalPod); err != nil {
if err := store.Delete(ctx, key, out, prec, storage.ValidateAllObjectFunc, originalPod, storage.DeleteOptions{}); err != nil {
t.Errorf("Unexpected failure during deletion: %v", err)
}
@@ -597,7 +597,7 @@ func RunTestPreconditionalDeleteWithOnlySuggestionPass(ctx context.Context, t *t
// Although originalPod passes the precondition, its delete would fail due to conflict.
// The 2nd try with updatedPod would fail the precondition.
out := &example.Pod{}
err := store.Delete(ctx, key, out, prec, storage.ValidateAllObjectFunc, originalPod)
err := store.Delete(ctx, key, out, prec, storage.ValidateAllObjectFunc, originalPod, storage.DeleteOptions{})
if err == nil || !storage.IsInvalidObj(err) {
t.Errorf("expecting invalid UID error, but get: %s", err)
}
@@ -1390,7 +1390,7 @@ func seedMultiLevelData(ctx context.Context, store storage.Interface) (string, [
// We now delete bazSecond provided it has been created first. We do this to enable
// testing cases that had an object exist initially and then was deleted and how this
// would be reflected in responses of different calls.
if err := store.Delete(ctx, computePodKey(bazSecond), preset[len(preset)-1].storedObj, nil, storage.ValidateAllObjectFunc, nil); err != nil {
if err := store.Delete(ctx, computePodKey(bazSecond), preset[len(preset)-1].storedObj, nil, storage.ValidateAllObjectFunc, nil, storage.DeleteOptions{}); err != nil {
return "", nil, fmt.Errorf("failed to delete object: %w", err)
}
@@ -2643,7 +2643,7 @@ func RunTestTransformationFailure(ctx context.Context, t *testing.T, store Inter
}
// Delete fails with internal error.
if err := store.Delete(ctx, preset[1].key, &example.Pod{}, nil, storage.ValidateAllObjectFunc, nil); !storage.IsInternalError(err) {
if err := store.Delete(ctx, preset[1].key, &example.Pod{}, nil, storage.ValidateAllObjectFunc, nil, storage.DeleteOptions{}); !storage.IsInternalError(err) {
t.Errorf("Unexpected error: %v", err)
}
if err := store.Get(ctx, preset[1].key, storage.GetOptions{}, &example.Pod{}); !storage.IsInternalError(err) {
+1 -1
View File
@@ -95,7 +95,7 @@ func testPropagateStore(ctx context.Context, t *testing.T, store storage.Interfa
key := computePodKey(obj)
// Setup store with the specified key and grab the output for returning.
err := store.Delete(ctx, key, &example.Pod{}, nil, storage.ValidateAllObjectFunc, nil)
err := store.Delete(ctx, key, &example.Pod{}, nil, storage.ValidateAllObjectFunc, nil, storage.DeleteOptions{})
if err != nil && !storage.IsNotFound(err) {
t.Fatalf("Cleanup failed: %v", err)
}
@@ -164,7 +164,7 @@ func testWatch(ctx context.Context, t *testing.T, store storage.Interface, recur
t.Fatalf("GuaranteedUpdate failed: %v", err)
}
} else {
err := store.Delete(ctx, key, out, nil, storage.ValidateAllObjectFunc, nil)
err := store.Delete(ctx, key, out, nil, storage.ValidateAllObjectFunc, nil, storage.DeleteOptions{})
if err != nil {
t.Fatalf("Delete failed: %v", err)
}
@@ -281,7 +281,7 @@ func RunTestDeleteTriggerWatch(ctx context.Context, t *testing.T, store storage.
if err != nil {
t.Fatalf("Watch failed: %v", err)
}
if err := store.Delete(ctx, key, &example.Pod{}, nil, storage.ValidateAllObjectFunc, nil); err != nil {
if err := store.Delete(ctx, key, &example.Pod{}, nil, storage.ValidateAllObjectFunc, nil, storage.DeleteOptions{}); err != nil {
t.Fatalf("Delete failed: %v", err)
}
testCheckEventType(t, w, watch.Deleted)
@@ -485,7 +485,7 @@ func RunTestWatchDeleteEventObjectHaveLatestRV(ctx context.Context, t *testing.T
}
deletedObj := &example.Pod{}
if err := store.Delete(ctx, key, deletedObj, &storage.Preconditions{}, storage.ValidateAllObjectFunc, nil); err != nil {
if err := store.Delete(ctx, key, deletedObj, &storage.Preconditions{}, storage.ValidateAllObjectFunc, nil, storage.DeleteOptions{}); err != nil {
t.Fatalf("Delete failed: %v", err)
}