test
This commit is contained in:
@@ -7,14 +7,14 @@ import (
|
||||
|
||||
func Version(path string) (string, error) {
|
||||
|
||||
cmd := exec.Command(path, "version", "--short")
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
cmd := exec.Command(path, "version", "--short")
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
res := string(stdout)
|
||||
res = strings.TrimSuffix(res, "\n")
|
||||
res := string(stdout)
|
||||
res = strings.TrimSuffix(res, "\n")
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
package helm
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"testing"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestHelmVersion(t *testing.T){
|
||||
|
||||
bin := filepath.Join(TEST_BIN_DIR, "helm")
|
||||
os.Chmod(bin, 0700)
|
||||
|
||||
bin := filepath.Join(TEST_BIN_DIR, "helm")
|
||||
os.Chmod(bin, 0700)
|
||||
assert.FileExists(t, bin, "TestHelmVersion error")
|
||||
|
||||
version, err := Version(bin)
|
||||
version, err := Version(bin)
|
||||
|
||||
assert.Nilf(t, err, "error message %s", bin)
|
||||
assert.Equal(t, version, "v3.15.4+gfa9efb0", "TestHelmVersion error")
|
||||
assert.Nilf(t, err, "error message %s", bin)
|
||||
assert.Equal(t, "v3.15.4+gfa9efb0", version, "TestHelmVersion error")
|
||||
}
|
||||
Reference in New Issue
Block a user