Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove TestStateTrayRemoval #2830

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading