Brush all the lint off this code I wrote in a haze
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
const HELM_BIN = "/usr/bin/helm"
|
||||
const helmBin = "/usr/bin/helm"
|
||||
|
||||
// The cmd interface provides a generic form of exec.Cmd so that it can be mocked out in tests.
|
||||
type cmd interface {
|
||||
@@ -43,7 +43,7 @@ type execCmd struct {
|
||||
*exec.Cmd
|
||||
}
|
||||
|
||||
var Command = func(path string, args ...string) cmd {
|
||||
var command = func(path string, args ...string) cmd {
|
||||
return &execCmd{
|
||||
Cmd: exec.Command(path, args...),
|
||||
}
|
||||
|
||||
@@ -4,18 +4,21 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// Help is a step in a helm Plan that calls `helm help`.
|
||||
type Help struct {
|
||||
cmd cmd
|
||||
}
|
||||
|
||||
// Run launches the command.
|
||||
func (h *Help) Run() error {
|
||||
return h.cmd.Run()
|
||||
}
|
||||
|
||||
// NewHelp returns a new Help.
|
||||
func NewHelp() *Help {
|
||||
h := Help{}
|
||||
|
||||
h.cmd = Command(HELM_BIN, "help")
|
||||
h.cmd = command(helmBin, "help")
|
||||
h.cmd.Stdout(os.Stdout)
|
||||
h.cmd.Stderr(os.Stderr)
|
||||
|
||||
|
||||
@@ -11,14 +11,14 @@ func TestHelp(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
mCmd := NewMockcmd(ctrl)
|
||||
originalCommand := Command
|
||||
originalCommand := command
|
||||
|
||||
Command = func(path string, args ...string) cmd {
|
||||
assert.Equal(t, HELM_BIN, path)
|
||||
command = func(path string, args ...string) cmd {
|
||||
assert.Equal(t, helmBin, path)
|
||||
assert.Equal(t, []string{"help"}, args)
|
||||
return mCmd
|
||||
}
|
||||
defer func() { Command = originalCommand }()
|
||||
defer func() { command = originalCommand }()
|
||||
|
||||
mCmd.EXPECT().
|
||||
Stdout(gomock.Any())
|
||||
|
||||
@@ -4,21 +4,24 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// Upgrade is a step in a helm Plan that calls `helm upgrade`.
|
||||
type Upgrade struct {
|
||||
Chart string
|
||||
Release string
|
||||
cmd cmd
|
||||
}
|
||||
|
||||
// Run launches the command.
|
||||
func (u *Upgrade) Run() error {
|
||||
return u.cmd.Run()
|
||||
}
|
||||
|
||||
// NewUpgrade creates a new Upgrade.
|
||||
func NewUpgrade(release, chart string) *Upgrade {
|
||||
u := Upgrade{
|
||||
Chart: chart,
|
||||
Release: release,
|
||||
cmd: Command(HELM_BIN, "upgrade", "--install", release, chart),
|
||||
cmd: command(helmBin, "upgrade", "--install", release, chart),
|
||||
}
|
||||
|
||||
u.cmd.Stdout(os.Stdout)
|
||||
|
||||
@@ -11,15 +11,15 @@ func TestNewUpgrade(t *testing.T) {
|
||||
defer ctrl.Finish()
|
||||
|
||||
mCmd := NewMockcmd(ctrl)
|
||||
originalCommand := Command
|
||||
originalCommand := command
|
||||
|
||||
Command = func(path string, args ...string) cmd {
|
||||
assert.Equal(t, HELM_BIN, path)
|
||||
command = func(path string, args ...string) cmd {
|
||||
assert.Equal(t, helmBin, path)
|
||||
assert.Equal(t, []string{"upgrade", "--install", "jonas_brothers_only_human", "at40"}, args)
|
||||
|
||||
return mCmd
|
||||
}
|
||||
defer func() { Command = originalCommand }()
|
||||
defer func() { command = originalCommand }()
|
||||
|
||||
mCmd.EXPECT().
|
||||
Stdout(gomock.Any())
|
||||
|
||||
Reference in New Issue
Block a user