Skip to content

Commit

Permalink
Merge branch version/0-42-0-RC1 to adopt changes from PR #2830
Browse files Browse the repository at this point in the history
  • Loading branch information
as-builds committed Oct 18, 2023
2 parents 5d83759 + 0cdb267 commit da5a32d
Showing 1 changed file with 0 additions and 63 deletions.
63 changes: 0 additions & 63 deletions cmd/state-installer/test/integration/installer_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ import (
"runtime"
"strings"
"testing"
"time"

"github.com/ActiveState/termtest"
"github.com/stretchr/testify/suite"

"github.com/ActiveState/cli/internal/condition"
"github.com/ActiveState/cli/internal/config"
"github.com/ActiveState/cli/internal/constants"
"github.com/ActiveState/cli/internal/environment"
"github.com/ActiveState/cli/internal/fileutils"
"github.com/ActiveState/cli/internal/httputil"
"github.com/ActiveState/cli/internal/installation"
"github.com/ActiveState/cli/internal/osutils"
"github.com/ActiveState/cli/internal/subshell"
Expand Down Expand Up @@ -193,66 +190,6 @@ func (suite *InstallerIntegrationTestSuite) TestInstallErrorTips() {
"error tips should be displayed in shell created by installer")
}

func (suite *InstallerIntegrationTestSuite) TestStateTrayRemoval() {
suite.OnlyRunForTags(tagsuite.Installer, tagsuite.Critical)
ts := e2e.New(suite.T(), false)
defer ts.Close()

dir := installationDir(ts)

// Install a release version that still has state-tray.
version := "0.35.0-SHAb78e2a4"
var cp *e2e.SpawnedCmd
if runtime.GOOS != "windows" {
oneLiner := fmt.Sprintf("sh <(curl -q https://platform.activestate.com/dl/cli/pdli01/install.sh) -f -n -t %s -v %s", dir, version)
cp = ts.SpawnCmdWithOpts(
"bash", e2e.OptArgs("-c", oneLiner),
e2e.OptAppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
)
} else {
b, err := httputil.GetDirect("https://platform.activestate.com/dl/cli/pdli01/install.ps1")
suite.Require().NoError(err)

ps1File := filepath.Join(ts.Dirs.Work, "install.ps1")
suite.Require().NoError(fileutils.WriteFile(ps1File, b))

cp = ts.SpawnCmdWithOpts("powershell.exe", e2e.OptArgs(ps1File, "-f", "-n", "-t", dir, "-v", version),
e2e.OptAppendEnv("SHELL="),
e2e.OptAppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
)
}
cp.Expect("Installation Complete", termtest.OptExpectTimeout(5*time.Minute))

// Verify state-tray is there.
svcExec, err := installation.ServiceExecFromDir(dir)
suite.Require().NoError(err)
trayExec := strings.Replace(svcExec, constants.StateSvcCmd, "state-tray", 1)
suite.FileExists(trayExec)
updateDialogExec := strings.Replace(svcExec, constants.StateSvcCmd, "state-update-dialog", 1)
// suite.FileExists(updateDialogExec) // this is not actually installed...

// Run the installer, which should remove state-tray and clean up after it.
cp = ts.SpawnCmdWithOpts(
suite.installerExe,
e2e.OptArgs("-f", "-n", "-t", dir),
e2e.OptAppendEnv(constants.UpdateBranchEnvVarName+"=release"),
e2e.OptAppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
)
cp.Expect("Installing", termtest.OptExpectTimeout(10*time.Second))
cp.Expect("Done", termtest.OptExpectTimeout(30*time.Second))

// Verify state-tray is no longer there.
suite.NoFileExists(trayExec)
suite.NoFileExists(updateDialogExec)

// Verify state can still be run and has a newly updated version.
stateExec, err := installation.StateExecFromDir(dir)
suite.Require().NoError(err)
cp = ts.SpawnCmdWithOpts(stateExec, e2e.OptArgs("--version"))
suite.Assert().NotContains(cp.Output(), version)
cp.ExpectExitCode(0)
}

func (suite *InstallerIntegrationTestSuite) TestInstallerOverwriteServiceApp() {
suite.OnlyRunForTags(tagsuite.Installer)
if runtime.GOOS != "darwin" {
Expand Down

0 comments on commit da5a32d

Please sign in to comment.