Kinflate: added fs as a parameter

This commit is contained in:
Sunil Arora 2018-02-01 16:04:35 -08:00 committed by Antoine Pelisse
parent 4a03e39222
commit 33bc00af62
3 changed files with 7 additions and 3 deletions

View File

@ -30,7 +30,7 @@ func main() {
cmd.AddCommand(commands.NewCmdInflate(os.Stdout, os.Stderr)) cmd.AddCommand(commands.NewCmdInflate(os.Stdout, os.Stderr))
cmd.AddCommand(commands.NewCmdAddResource(os.Stdout, os.Stderr, fs.MakeRealFS())) cmd.AddCommand(commands.NewCmdAddResource(os.Stdout, os.Stderr, fs.MakeRealFS()))
cmd.AddCommand(commands.NewCmdInit(os.Stdout, os.Stderr, fs.MakeRealFS())) cmd.AddCommand(commands.NewCmdInit(os.Stdout, os.Stderr, fs.MakeRealFS()))
cmd.AddCommand(commands.NewCmdAddConfigMap(os.Stderr)) cmd.AddCommand(commands.NewCmdAddConfigMap(os.Stderr, fs.MakeRealFS()))
cmd.AddCommand(commands.NewCmdAddSecret(os.Stderr)) cmd.AddCommand(commands.NewCmdAddSecret(os.Stderr))
err := cmd.Execute() err := cmd.Execute()

View File

@ -19,10 +19,12 @@ package commands
import ( import (
"io" "io"
"k8s.io/kubectl/pkg/kinflate/util/fs"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
func NewCmdAddConfigMap(errOut io.Writer) *cobra.Command { func NewCmdAddConfigMap(errOut io.Writer, fsys fs.FileSystem) *cobra.Command {
var config dataConfig var config dataConfig
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1]", Use: "configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1]",

View File

@ -18,10 +18,12 @@ package commands
import ( import (
"testing" "testing"
"k8s.io/kubectl/pkg/kinflate/util/fs"
) )
func TestNewAddConfigMapIsNotNil(t *testing.T) { func TestNewAddConfigMapIsNotNil(t *testing.T) {
if NewCmdAddConfigMap(nil) == nil { if NewCmdAddConfigMap(nil, fs.MakeFakeFS()) == nil {
t.Fatal("NewCmdAddConfigMap shouldn't be nil") t.Fatal("NewCmdAddConfigMap shouldn't be nil")
} }
} }