Use jfrog-cli-core test-utils in unit-tests
package main
import (
- "github.com/jfrog/jfrog-cli-core/utils/coreutils"
+ coreTests "github.com/jfrog/jfrog-cli-core/utils/tests"
"github.com/jfrog/jfrog-cli/utils/tests"
"github.com/jfrog/jfrog-client-go/utils/log"
clientTests "github.com/jfrog/jfrog-client-go/utils/tests"
@@ -22,23 +22,9 @@ func TestUnitTests(t *testing.T) {
os.Exit(1)
}
- setJfrogHome(homePath)
+ coreTests.SetJfrogHome(homePath)
packages := clientTests.GetTestPackages("./...")
packages = clientTests.ExcludeTestsPackage(packages, CliIntegrationTests)
clientTests.RunTests(packages, *tests.HideUnitTestLog)
- cleanUnitTestsJfrogHome(homePath)
-}
-
-func setJfrogHome(homePath string) {
- if err := os.Setenv(coreutils.HomeDir, homePath); err != nil {
- log.Error(err)
- os.Exit(1)
- }
-}
-
-func cleanUnitTestsJfrogHome(homePath string) {
- os.RemoveAll(homePath)
- if err := os.Unsetenv(coreutils.HomeDir); err != nil {
- os.Exit(1)
- }
+ coreTests.CleanUnitTestsJfrogHome(homePath)
}
