mirror of https://github.com/databricks/cli.git
remvoe old function
This commit is contained in:
parent
25831e3432
commit
e2ca65f81e
|
@ -15,7 +15,6 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/databricks/cli/internal/testutil"
|
"github.com/databricks/cli/internal/testutil"
|
||||||
"github.com/databricks/cli/libs/env"
|
"github.com/databricks/cli/libs/env"
|
||||||
|
@ -336,47 +335,6 @@ func readMergedScriptContents(t *testing.T, dir string) string {
|
||||||
return strings.Join(prepares, "\n")
|
return strings.Join(prepares, "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func BuildCLI(t *testing.T, cwd, coverDir string) string {
|
|
||||||
execPath := filepath.Join(cwd, "build", "databricks")
|
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
execPath += ".exe"
|
|
||||||
}
|
|
||||||
|
|
||||||
start := time.Now()
|
|
||||||
args := []string{
|
|
||||||
"go", "build",
|
|
||||||
"-mod", "vendor",
|
|
||||||
"-o", execPath,
|
|
||||||
}
|
|
||||||
|
|
||||||
if coverDir != "" {
|
|
||||||
args = append(args, "-cover")
|
|
||||||
}
|
|
||||||
|
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
// Get this error on my local Windows:
|
|
||||||
// error obtaining VCS status: exit status 128
|
|
||||||
// Use -buildvcs=false to disable VCS stamping.
|
|
||||||
args = append(args, "-buildvcs=false")
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd := exec.Command(args[0], args[1:]...)
|
|
||||||
cmd.Dir = ".."
|
|
||||||
out, err := cmd.CombinedOutput()
|
|
||||||
elapsed := time.Since(start)
|
|
||||||
t.Logf("%s took %s", args, elapsed)
|
|
||||||
require.NoError(t, err, "go build failed: %s: %s\n%s", args, err, out)
|
|
||||||
if len(out) > 0 {
|
|
||||||
t.Logf("go build output: %s: %s", args, out)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Quick check + warm up cache:
|
|
||||||
cmd = exec.Command(execPath, "--version")
|
|
||||||
out, err = cmd.CombinedOutput()
|
|
||||||
require.NoError(t, err, "%s --version failed: %s\n%s", execPath, err, out)
|
|
||||||
return execPath
|
|
||||||
}
|
|
||||||
|
|
||||||
func copyFile(src, dst string) error {
|
func copyFile(src, dst string) error {
|
||||||
in, err := os.Open(src)
|
in, err := os.Open(src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue