Documentation ¶
Index ¶
- type AnyResource
- type AnyResourceList
- type AnyResourceListResponse
- type AnyResourceResponse
- type K8sResourceClient
- type K8sResponse
- type K8sTestHelper
- func (c *K8sTestHelper) AsStatusError(err error) *errors.StatusError
- func (c *K8sTestHelper) CreateDS(cmd *datasources.AddDataSourceCommand) *datasources.DataSource
- func (c *K8sTestHelper) GetGroupVersionInfoJSON(group string) string
- func (c *K8sTestHelper) GetResourceClient(args ResourceClientArgs) *K8sResourceClient
- func (c *K8sTestHelper) List(user User, namespace string, gvr schema.GroupVersionResource) AnyResourceListResponse
- func (c *K8sTestHelper) LoadYAMLOrJSON(body string) *unstructured.Unstructured
- func (c *K8sTestHelper) LoadYAMLOrJSONFile(fpath string) *unstructured.Unstructured
- func (c *K8sTestHelper) NewDiscoveryClient() *discovery.DiscoveryClient
- func (c *K8sTestHelper) PostResource(user User, resource string, payload AnyResource) AnyResourceResponse
- func (c *K8sTestHelper) PutResource(user User, resource string, payload AnyResource) AnyResourceResponse
- func (c *K8sTestHelper) Shutdown()
- type OrgUsers
- type RequestParams
- type ResourceClientArgs
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnyResource ¶
type AnyResourceList ¶
type AnyResourceListResponse ¶
type AnyResourceListResponse = K8sResponse[AnyResourceList]
type AnyResourceResponse ¶
type AnyResourceResponse = K8sResponse[AnyResource]
type K8sResourceClient ¶
type K8sResourceClient struct { Args ResourceClientArgs Resource dynamic.ResourceInterface // contains filtered or unexported fields }
func (*K8sResourceClient) SanitizeJSON ¶
func (c *K8sResourceClient) SanitizeJSON(v *unstructured.Unstructured) string
remove the meta keys that are expected to change each time
type K8sResponse ¶
type K8sResponse[T any] struct { Response *http.Response Body []byte Result *T Status *metav1.Status }
func DoRequest ¶
func DoRequest[T any](c *K8sTestHelper, params RequestParams, result *T) K8sResponse[T]
type K8sTestHelper ¶
type K8sTestHelper struct { Org1 OrgUsers // default OrgB OrgUsers // some other id // contains filtered or unexported fields }
func NewK8sTestHelper ¶
func NewK8sTestHelper(t *testing.T, opts testinfra.GrafanaOpts) *K8sTestHelper
func (*K8sTestHelper) AsStatusError ¶
func (c *K8sTestHelper) AsStatusError(err error) *errors.StatusError
Cast the error to status error
func (*K8sTestHelper) CreateDS ¶
func (c *K8sTestHelper) CreateDS(cmd *datasources.AddDataSourceCommand) *datasources.DataSource
func (*K8sTestHelper) GetGroupVersionInfoJSON ¶
func (c *K8sTestHelper) GetGroupVersionInfoJSON(group string) string
func (*K8sTestHelper) GetResourceClient ¶
func (c *K8sTestHelper) GetResourceClient(args ResourceClientArgs) *K8sResourceClient
This will set the expected Group/Version/Resource and return the discovery info if found
func (*K8sTestHelper) List ¶
func (c *K8sTestHelper) List(user User, namespace string, gvr schema.GroupVersionResource) AnyResourceListResponse
func (*K8sTestHelper) LoadYAMLOrJSON ¶
func (c *K8sTestHelper) LoadYAMLOrJSON(body string) *unstructured.Unstructured
Read local JSON or YAML file into a resource
func (*K8sTestHelper) LoadYAMLOrJSONFile ¶
func (c *K8sTestHelper) LoadYAMLOrJSONFile(fpath string) *unstructured.Unstructured
Read local JSON or YAML file into a resource
func (*K8sTestHelper) NewDiscoveryClient ¶
func (c *K8sTestHelper) NewDiscoveryClient() *discovery.DiscoveryClient
func (*K8sTestHelper) PostResource ¶
func (c *K8sTestHelper) PostResource(user User, resource string, payload AnyResource) AnyResourceResponse
func (*K8sTestHelper) PutResource ¶
func (c *K8sTestHelper) PutResource(user User, resource string, payload AnyResource) AnyResourceResponse
func (*K8sTestHelper) Shutdown ¶
func (c *K8sTestHelper) Shutdown()
type RequestParams ¶
type ResourceClientArgs ¶
type ResourceClientArgs struct { User User Namespace string GVR schema.GroupVersionResource }
type User ¶
func (*User) NewRestConfig ¶
func (*User) RESTClient ¶
func (c *User) RESTClient(t *testing.T, gv *schema.GroupVersion) *rest.RESTClient
func (*User) ResourceClient ¶
func (c *User) ResourceClient(t *testing.T, gvr schema.GroupVersionResource) dynamic.NamespaceableResourceInterface
Click to show internal directories.
Click to hide internal directories.