mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #99526 from chymy/fix-staticcheck-failed
Fix staticcheck failures for vendor/k8s.io/apiserver/pkg/registry/generic
This commit is contained in:
commit
267afe2358
@ -13,8 +13,6 @@ vendor/k8s.io/apimachinery/pkg/util/strategicpatch
|
||||
vendor/k8s.io/apimachinery/pkg/util/wait
|
||||
vendor/k8s.io/apiserver/pkg/endpoints/filters
|
||||
vendor/k8s.io/apiserver/pkg/endpoints/metrics
|
||||
vendor/k8s.io/apiserver/pkg/registry/generic/registry
|
||||
vendor/k8s.io/apiserver/pkg/registry/generic/rest
|
||||
vendor/k8s.io/apiserver/pkg/registry/rest/resttest
|
||||
vendor/k8s.io/apiserver/pkg/server/dynamiccertificates
|
||||
vendor/k8s.io/apiserver/pkg/server/filters
|
||||
|
@ -18,9 +18,6 @@ package registry
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
)
|
||||
@ -84,16 +81,3 @@ func (d *decoratedWatcher) Stop() {
|
||||
func (d *decoratedWatcher) ResultChan() <-chan watch.Event {
|
||||
return d.resultCh
|
||||
}
|
||||
|
||||
func makeStatusErrorEvent(err error) watch.Event {
|
||||
status := &metav1.Status{
|
||||
Status: metav1.StatusFailure,
|
||||
Message: err.Error(),
|
||||
Code: http.StatusInternalServerError,
|
||||
Reason: metav1.StatusReasonInternalError,
|
||||
}
|
||||
return watch.Event{
|
||||
Type: watch.Error,
|
||||
Object: status,
|
||||
}
|
||||
}
|
||||
|
@ -744,7 +744,9 @@ func shouldOrphanDependents(ctx context.Context, e *Store, accessor metav1.Objec
|
||||
}
|
||||
|
||||
// An explicit policy was set at deletion time, that overrides everything
|
||||
//lint:ignore SA1019 backwards compatibility
|
||||
if options != nil && options.OrphanDependents != nil {
|
||||
//lint:ignore SA1019 backwards compatibility
|
||||
return *options.OrphanDependents
|
||||
}
|
||||
if options != nil && options.PropagationPolicy != nil {
|
||||
@ -785,6 +787,7 @@ func shouldDeleteDependents(ctx context.Context, e *Store, accessor metav1.Objec
|
||||
}
|
||||
|
||||
// If an explicit policy was set at deletion time, that overrides both
|
||||
//lint:ignore SA1019 backwards compatibility
|
||||
if options != nil && options.OrphanDependents != nil {
|
||||
return false
|
||||
}
|
||||
|
@ -62,8 +62,6 @@ import (
|
||||
var scheme = runtime.NewScheme()
|
||||
var codecs = serializer.NewCodecFactory(scheme)
|
||||
|
||||
const validInitializerName = "test.k8s.io"
|
||||
|
||||
func init() {
|
||||
metav1.AddToGroupVersion(scheme, metav1.SchemeGroupVersion)
|
||||
utilruntime.Must(example.AddToScheme(scheme))
|
||||
@ -265,7 +263,7 @@ func TestStoreListResourceVersion(t *testing.T) {
|
||||
l, err := registry.List(ctx, option)
|
||||
if err != nil {
|
||||
close(waitListCh)
|
||||
t.Fatal(err)
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
waitListCh <- l
|
||||
@ -2062,7 +2060,7 @@ func TestStoreDeleteCollectionNotFound(t *testing.T) {
|
||||
defer wg.Done()
|
||||
_, err := registry.DeleteCollection(testContext, rest.ValidateAllObjectFunc, nil, &metainternalversion.ListOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
@ -2650,7 +2648,7 @@ func TestRetryDeleteValidation(t *testing.T) {
|
||||
// This update will cause the Delete to retry due to conflict.
|
||||
_, _, err := registry.Update(testContext, test.pod.Name, rest.DefaultUpdatedObjectInfo(test.pod, transformer), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
t.Error(err)
|
||||
}
|
||||
updatedOnce.Do(func() {
|
||||
close(updated)
|
||||
|
@ -75,7 +75,6 @@ func TestInputStreamNullLocation(t *testing.T) {
|
||||
|
||||
type testTransport struct {
|
||||
body string
|
||||
err error
|
||||
}
|
||||
|
||||
func (tt *testTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user