builder: move kube config handling to k8s driver package

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2024-07-16 23:18:40 +02:00
parent 4304d388ef
commit acf0216292
6 changed files with 105 additions and 102 deletions

View File

@ -11,29 +11,28 @@ import (
"k8s.io/client-go/rest"
)
type mockKubeClientConfig struct {
type mockClientConfig struct {
clientConfig *rest.Config
namespace string
}
func (r *mockKubeClientConfig) ClientConfig() (*rest.Config, error) {
func (r *mockClientConfig) ClientConfig() (*rest.Config, error) {
return r.clientConfig, nil
}
func (r *mockKubeClientConfig) Namespace() (string, bool, error) {
func (r *mockClientConfig) Namespace() (string, bool, error) {
return r.namespace, true, nil
}
func TestFactory_processDriverOpts(t *testing.T) {
kcc := mockKubeClientConfig{
clientConfig: &rest.Config{},
}
cfg := driver.InitConfig{
Name: driver.BuilderName("test"),
KubeClientConfig: &kcc,
Name: driver.BuilderName("test"),
}
f := factory{
cc: &mockClientConfig{
clientConfig: &rest.Config{},
},
}
f := factory{}
t.Run(
"ValidOptions", func(t *testing.T) {