fixes for bashtop removal
This commit is contained in:
@@ -610,57 +610,7 @@ func TestSetupVivaldiRepoExisting(t *testing.T) {
|
||||
|
||||
// ── special installer branches ──────────────────────────────────────────
|
||||
|
||||
func TestInstallBashtopExistingClone(t *testing.T) {
|
||||
defer resetMocks()
|
||||
osStat = func(_ string) (os.FileInfo, error) { return nil, nil }
|
||||
runCmd = func(_ []string, _ CmdOpts) CmdResult { return CmdResult{ExitCode: 0} }
|
||||
installBashtop("/tmp")
|
||||
}
|
||||
|
||||
func TestInstallBashtopPullFails(t *testing.T) {
|
||||
defer resetMocks()
|
||||
osStat = func(_ string) (os.FileInfo, error) { return nil, nil }
|
||||
runCmd = func(argv []string, _ CmdOpts) CmdResult {
|
||||
if len(argv) > 1 && argv[1] == "-C" {
|
||||
return CmdResult{ExitCode: 1}
|
||||
}
|
||||
return CmdResult{ExitCode: 0}
|
||||
}
|
||||
installBashtop("/tmp")
|
||||
if !hasIssueContaining("bashtop git pull failed") {
|
||||
t.Error("expected pull failure error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInstallBashtopCloneFails(t *testing.T) {
|
||||
defer resetMocks()
|
||||
osStat = func(_ string) (os.FileInfo, error) { return nil, os.ErrNotExist }
|
||||
runCmd = func(argv []string, _ CmdOpts) CmdResult {
|
||||
if argv[0] == "git" && argv[1] == "clone" {
|
||||
return CmdResult{ExitCode: 1}
|
||||
}
|
||||
return CmdResult{ExitCode: 0}
|
||||
}
|
||||
installBashtop("/tmp")
|
||||
if !hasIssueContaining("bashtop git clone failed") {
|
||||
t.Error("expected clone failure error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInstallBashtopMakeFails(t *testing.T) {
|
||||
defer resetMocks()
|
||||
osStat = func(_ string) (os.FileInfo, error) { return nil, os.ErrNotExist }
|
||||
runCmd = func(argv []string, _ CmdOpts) CmdResult {
|
||||
if argv[0] == "make" {
|
||||
return CmdResult{ExitCode: 1}
|
||||
}
|
||||
return CmdResult{ExitCode: 0}
|
||||
}
|
||||
installBashtop("/tmp")
|
||||
if !hasIssueContaining("make install") {
|
||||
t.Error("expected make install failure error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInstallPulumiNoVersion(t *testing.T) {
|
||||
defer resetMocks()
|
||||
|
||||
@@ -223,25 +223,6 @@ func resolveSystemPkgs(names []string) ([]string, []string) {
|
||||
return resolved, skipped
|
||||
}
|
||||
|
||||
func installSystemPackages(pkgs []string, special []string) {
|
||||
if len(special) > 0 {
|
||||
tmp, err := os.MkdirTemp("", "bootstrap-special-")
|
||||
if err != nil {
|
||||
errLog(fmt.Sprintf("could not create temp dir for special packages: %v", err))
|
||||
return
|
||||
}
|
||||
defer osRemoveAll(tmp)
|
||||
for _, pkg := range special {
|
||||
fmt.Printf("\n [SPECIAL] Installing %s ...\n", pkg)
|
||||
installSpecialPkg(pkg, tmp)
|
||||
}
|
||||
}
|
||||
|
||||
if pkgMgr == "apt-get" && hasCmd("fdfind") {
|
||||
runCmd([]string{"ln", "-sf", "/usr/bin/fdfind", "/usr/local/bin/fd"}, CmdOpts{AsSudo: true})
|
||||
}
|
||||
}
|
||||
|
||||
// isSystemPkgInstalled queries the host package manager.
|
||||
func isSystemPkgInstalled(pkg string) bool {
|
||||
switch pkgMgr {
|
||||
|
||||
@@ -37,7 +37,6 @@ var guiSystemPkgs = map[string]bool{
|
||||
}
|
||||
|
||||
func isSpecialPkgInstalled(pkg string) bool {
|
||||
home, _ := os.UserHomeDir()
|
||||
exists := func(p string) bool { _, err := osStat(p); return err == nil }
|
||||
switch pkg {
|
||||
case "obsidian":
|
||||
@@ -497,6 +496,10 @@ func installSystemPackages(regular, special []string) {
|
||||
installSpecialPkg(pkg, tmp)
|
||||
}
|
||||
}
|
||||
|
||||
if pkgMgr == "apt-get" && hasCmd("fdfind") {
|
||||
runCmd([]string{"ln", "-sf", "/usr/bin/fdfind", "/usr/local/bin/fd"}, CmdOpts{AsSudo: true})
|
||||
}
|
||||
}
|
||||
|
||||
// appendProfileLine adds a PATH/env line to a system-wide login-shell profile,
|
||||
|
||||
@@ -247,32 +247,7 @@ func TestInstallMinikube(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestInstallBashtop(t *testing.T) {
|
||||
defer resetMocks()
|
||||
|
||||
osStat = func(name string) (os.FileInfo, error) {
|
||||
return nil, os.ErrNotExist // Not cloned yet
|
||||
}
|
||||
|
||||
var runCmdCalls [][]string
|
||||
runCmd = func(argv []string, opts CmdOpts) CmdResult {
|
||||
runCmdCalls = append(runCmdCalls, argv)
|
||||
return CmdResult{ExitCode: 0}
|
||||
}
|
||||
|
||||
installBashtop("/tmp")
|
||||
|
||||
// Git clone and make install should be run
|
||||
if len(runCmdCalls) < 2 {
|
||||
t.Fatalf("expected git clone and make install, got calls: %v", runCmdCalls)
|
||||
}
|
||||
if runCmdCalls[0][1] != "clone" {
|
||||
t.Errorf("expected git clone, got %v", runCmdCalls[0])
|
||||
}
|
||||
if runCmdCalls[1][0] != "make" || runCmdCalls[1][1] != "install" {
|
||||
t.Errorf("expected make install, got %v", runCmdCalls[1])
|
||||
}
|
||||
}
|
||||
|
||||
func TestInstallPulumi(t *testing.T) {
|
||||
defer resetMocks()
|
||||
|
||||
Reference in New Issue
Block a user