package testing
import "k8s.io/kubectl/pkg/util/openapi/testing"
Index ¶
- func CreateOpenAPISchemaFunc(path string) func() (openapi.Resources, error)
- type EmptyResources
- func (f EmptyResources) GetConsumes(gvk schema.GroupVersionKind, operation string) []string
- func (f EmptyResources) LookupResource(gvk schema.GroupVersionKind) proto.Schema
- type FakeResources
Functions ¶
func CreateOpenAPISchemaFunc ¶
CreateOpenAPISchemaFunc returns a function useful for the TestFactory.
Types ¶
type EmptyResources ¶
type EmptyResources struct{}
EmptyResources implement a Resources that just doesn't have any resources.
func (EmptyResources) GetConsumes ¶
func (f EmptyResources) GetConsumes(gvk schema.GroupVersionKind, operation string) []string
func (EmptyResources) LookupResource ¶
func (f EmptyResources) LookupResource(gvk schema.GroupVersionKind) proto.Schema
LookupResource will always return nil. It doesn't have any resources.
type FakeResources ¶
type FakeResources struct {
// contains filtered or unexported fields
}
FakeResources is a wrapper to directly load the openapi schema from a file, and get the schema for given GVK. This is only for test since it's assuming that the file is there and everything will go fine.
func NewFakeResources ¶
func NewFakeResources(path string) *FakeResources
NewFakeResources creates a new FakeResources.
func (*FakeResources) GetConsumes ¶
func (f *FakeResources) GetConsumes(gvk schema.GroupVersionKind, operation string) []string
func (*FakeResources) LookupResource ¶
func (f *FakeResources) LookupResource(gvk schema.GroupVersionKind) proto.Schema
LookupResource will read the schema, parse it and return the resources. It doesn't return errors and will panic instead.
Source Files ¶
openapi.go
- Version
- v0.32.3 (latest)
- Published
- Mar 12, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 6 days ago –
Tools for package owners.