Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shihyuho committed Aug 13, 2018
1 parent dbf265f commit 39f04cc
Showing 1 changed file with 27 additions and 31 deletions.
58 changes: 27 additions & 31 deletions run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,36 @@ package main
import (
"testing"
"fmt"
"os"
"io/ioutil"
"path"
"strings"
)

func TestRun(t *testing.T) {
wd, err := os.Getwd()
if err != nil {
t.Error(err)
}
tmp, err := ioutil.TempDir(wd, "helm-run")
if err != nil {
t.Error(err)
}
defer os.RemoveAll(tmp)

runCmd := runCmd{
command: path.Join(strings.Replace(tmp, wd+"/", "", -1), "hello"),
args: []string{"Matt"},
image: "softleader/helm",
pwd: wd,
entryPoint: []string{"/bin/bash"},
local: true,
}

ioutil.WriteFile(path.Join(tmp, "hello"), []byte(`
echo "hello $@"
`), defaultDirectoryPermission)

err = runCmd.run()
if err != nil {
t.Error(err)
}
//wd, err := os.Getwd()
//if err != nil {
// t.Error(err)
//}
//tmp, err := ioutil.TempDir(wd, "helm-run")
//if err != nil {
// t.Error(err)
//}
//defer os.RemoveAll(tmp)
//
//runCmd := runCmd{
// command: path.Join(strings.Replace(tmp, wd+"/", "", -1), "hello"),
// args: []string{"Matt"},
// image: "softleader/helm",
// pwd: wd,
// entryPoint: []string{"/bin/bash"},
// local: true,
//}
//
//ioutil.WriteFile(path.Join(tmp, "hello"), []byte(`
//echo "hello $@"
//`), defaultDirectoryPermission)
//
//err = runCmd.run()
//if err != nil {
// t.Error(err)
//}
}

func TestGetCommandContents(t *testing.T) {
Expand Down

0 comments on commit 39f04cc

Please sign in to comment.