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:
@@ -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{
|
||||
|
Reference in New Issue
Block a user