1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-21 11:28:11 +00:00

added delegate error / improve delegate coverage / add new mocks

This commit is contained in:
Felipe C. Gehrke
2024-11-07 20:11:53 -03:00
parent b2f2bab3c4
commit 887fc05f08
7 changed files with 1399 additions and 13 deletions

View File

@@ -2,6 +2,7 @@ package ext
import (
"context"
"errors"
"fmt"
"sync"
@@ -16,6 +17,10 @@ import (
"k8s.io/apiserver/pkg/registry/rest"
)
var (
errMissingUserInfo error = errors.New("missing user info")
)
// delegate is the bridge between k8s.io/apiserver's [rest.Storage] interface and
// our own Store interface we want developers to use
//
@@ -328,7 +333,7 @@ func (s *delegate[T, TList]) GetSingularName() string {
func (s *delegate[T, TList]) makeContext(parentCtx context.Context) (Context, error) {
userInfo, ok := request.UserFrom(parentCtx)
if !ok {
return Context{}, fmt.Errorf("missing user info")
return Context{}, errMissingUserInfo
}
ctx := Context{