diff --git a/cli/build/build_test.go b/cli/build/build_test.go
index 50918a8e3..c42abcd59 100644
--- a/cli/build/build_test.go
+++ b/cli/build/build_test.go
@@ -24,17 +24,23 @@ func TestFillCtx(t *testing.T) {
require.NoError(t, os.Chdir(workDir))
defer os.Chdir(wd)
var buildCtx BuildCtx
+
+ workDir, _ = os.Getwd()
+
+ appDir := filepath.Join(workDir, "app1")
+ appDir2 := filepath.Join(workDir, "app2")
+
require.NoError(t, FillCtx(&buildCtx, []string{"app1"}))
- assert.Equal(t, buildCtx.BuildDir, filepath.Join(workDir, "app1"))
+ assert.Equal(t, buildCtx.BuildDir, appDir)
require.NoError(t, FillCtx(&buildCtx, []string{"./app1"}))
- assert.Equal(t, buildCtx.BuildDir, filepath.Join(workDir, "app1"))
+ assert.Equal(t, buildCtx.BuildDir, appDir)
require.NoError(t, FillCtx(&buildCtx, []string{}))
assert.Equal(t, buildCtx.BuildDir, workDir)
require.EqualError(t, FillCtx(&buildCtx, []string{"app1", "app2"}), "too many args")
require.EqualError(t, FillCtx(&buildCtx, []string{"app2"}),
- fmt.Sprintf("stat %s: no such file or directory", filepath.Join(workDir, "app2")))
+ fmt.Sprintf("stat %s: no such file or directory", appDir2))
require.NoError(t, FillCtx(&buildCtx, []string{filepath.Join(workDir, "app1")}))
assert.Equal(t, buildCtx.BuildDir, filepath.Join(workDir, "app1"))
@@ -62,8 +68,12 @@ func TestFillCtxAppPathIsFile(t *testing.T) {
require.NoError(t, os.Chdir(workDir))
defer os.Chdir(wd)
var buildCtx BuildCtx
+ workDir, _ = os.Getwd()
+
+ appDir := filepath.Join(workDir, "app1")
+
require.EqualError(t, FillCtx(&buildCtx, []string{"app1"}),
- fmt.Sprintf("%s is not a directory", filepath.Join(workDir, "app1")))
+ fmt.Sprintf("%s is not a directory", appDir))
}
func TestFillCtxMultipleArgs(t *testing.T) {
diff --git a/cli/configure/configure_test.go b/cli/configure/configure_test.go
index b0cf7a7db..0259e041b 100644
--- a/cli/configure/configure_test.go
+++ b/cli/configure/configure_test.go
@@ -262,6 +262,8 @@ func TestGetConfigPath(t *testing.T) {
require.NoError(t, os.Chdir(filepath.Join(tempDir, "a", "b")))
defer os.Chdir(wd)
}
+ workdir, _ := os.Getwd()
+ workdir = strings.TrimSuffix(workdir, "/a/b")
configName, err := getConfigPath(ConfigName)
assert.Equal(t, "", configName)
@@ -270,7 +272,8 @@ func TestGetConfigPath(t *testing.T) {
require.NoError(t, os.Remove(filepath.Join(tempDir, "a", "tarantool.yaml")))
configName, err = getConfigPath(ConfigName)
- assert.Equal(t, filepath.Join(tempDir, "a", "tarantool.yml"), configName)
+
+ assert.Equal(t, filepath.Join(workdir, "a", "tarantool.yml"), configName)
assert.NoError(t, err)
}
diff --git a/cli/install_ee/install_ee_test.go b/cli/install_ee/install_ee_test.go
index 855d8a8cf..dee97ccc1 100644
--- a/cli/install_ee/install_ee_test.go
+++ b/cli/install_ee/install_ee_test.go
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
+ "github.com/tarantool/tt/cli/util"
"github.com/tarantool/tt/cli/version"
)
@@ -30,9 +31,27 @@ func TestGetVersions(t *testing.T) {
err: fmt.Errorf("no packages for this OS"),
}
- inputData1 := []byte(`tarantool-enterprise-bundle-1.10.10-` +
- `52-g0df29b137-r419.tar.gz 2021-08-18 ` +
+ arch, err := util.GetArch()
+ assert.NoError(err)
+
+ osType, err := util.GetOs()
+ assert.NoError(err)
+ inputData1 := []byte(``)
+ osName := ""
+ switch osType {
+ case util.OsLinux:
+ if arch == "x86_64" {
+ arch = ""
+ }
+ case util.OsMacos:
+ osName = "-macosx-"
+ }
+
+ inputData1 = []byte(`tarantool-enterprise-bundle-1.10.10-` +
+ `52-g0df29b137-r419` + osName + arch + `.tar.gz` +
+ ` 2021-08-18 ` +
`15:56:04 260136444`)
testCases[getVersionsInputValue{data: &inputData1}] =
@@ -47,7 +66,8 @@ func TestGetVersions(t *testing.T) {
Release: version.Release{Type: version.TypeRelease},
Hash: "g0df29b137",
Str: "1.10.10-52-g0df29b137-r419",
- Tarball: "tarantool-enterprise-bundle-1.10.10-52-g0df29b137-r419.tar.gz",
+ Tarball: "tarantool-enterprise-bundle-1.10.10-52-g0df29b137-r419" +
+ osName + arch + ".tar.gz",
},
},
err: nil,
diff --git a/cli/util/util.go b/cli/util/util.go
index 7f89c9781..5a7eb27bd 100644
--- a/cli/util/util.go
+++ b/cli/util/util.go
@@ -680,8 +680,14 @@ func ExecuteCommandStdin(program string, isVerbose bool, logFile *os.File, workD
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
} else {
- cmd.Stdout = logFile
- cmd.Stderr = logFile
+ if logFile != nil {
+ cmd.Stdout = logFile
+ cmd.Stderr = logFile
+ } else {
+ cmd.Stdout = ioutil.Discard
+ cmd.Stderr = ioutil.Discard
+ }
+
}
if workDir == "" {
workDir, _ = os.Getwd()