mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 21:47:13 +08:00
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:
@ -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) {
|
||||
|
Reference in New Issue
Block a user