Sergiy Markin 4ae2c3a101 Fixed lint and unit tests
This PS makes sure we have linter and unit tests
processed. The code has been reformatted to adhere
to Go's code formatting conventions.

Change-Id: I31f15d6d6c4b9bda7e3837941b6c9c3c3735aea7
2024-03-26 19:41:48 +00:00

59 lines
1.3 KiB
Go

package mocks
import (
"context"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
v1apps "k8s.io/client-go/kubernetes/typed/apps/v1"
v1batch "k8s.io/client-go/kubernetes/typed/batch/v1"
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
)
type Client struct {
v1core.PodInterface
v1core.ServiceInterface
v1apps.DaemonSetInterface
v1core.EndpointsInterface
v1batch.JobInterface
FakeCustomResource *unstructured.Unstructured
Err error
}
func (c Client) Pods(namespace string) v1core.PodInterface {
return c.PodInterface
}
func (c Client) Services(namespace string) v1core.ServiceInterface {
return c.ServiceInterface
}
func (c Client) DaemonSets(namespace string) v1apps.DaemonSetInterface {
return c.DaemonSetInterface
}
func (c Client) Endpoints(namespace string) v1core.EndpointsInterface {
return c.EndpointsInterface
}
func (c Client) Jobs(namespace string) v1batch.JobInterface {
return c.JobInterface
}
func (c Client) CustomResource(
ctx context.Context,
apiVersion, namespace, resource, name string,
) (*unstructured.Unstructured, error) {
return c.FakeCustomResource, c.Err
}
func NewClient() *Client {
return &Client{
PodInterface: NewPClient(),
ServiceInterface: NewSClient(),
DaemonSetInterface: NewDSClient(),
EndpointsInterface: NewEClient(),
JobInterface: NewJClient(),
}
}