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

Update to termtest v2 #2731

Merged
merged 146 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
1307185
Replacing termtest v1 with v2
Naatan Jun 28, 2023
be9a8be
WIP: Move tests to termtest v2
Naatan Jul 5, 2023
de70855
Update termtest package to get terminal emulation fix
Naatan Aug 23, 2023
267cc04
Add missing import
Naatan Aug 23, 2023
0d145bd
Merge branch 'version/0-41-0-RC1' into DX-1910
Naatan Aug 23, 2023
b035e17
@Naatan
Naatan Aug 23, 2023
7a4740d
Fix activate test
Naatan Aug 23, 2023
22b87e8
Use Output() instead of Snapshot() as that was what the original imp…
Naatan Aug 23, 2023
62a713e
Update modules
Naatan Aug 23, 2023
ef1f227
Fix tests using Send() where they should be using SendLine()
Naatan Aug 23, 2023
e4f10ad
Update termtest to get race condition fix with Send()
Naatan Aug 23, 2023
68a4734
Update termtest
Naatan Aug 24, 2023
4d54662
Don't continue running test when they can't possibly succeed
Naatan Aug 24, 2023
22d365c
Fix ExpectInput not matching the right thing
Naatan Aug 24, 2023
bef1afc
Don't rely on SHELL
Naatan Aug 24, 2023
b67f686
Fix SpawnShell failing if there are no further args
Naatan Aug 24, 2023
d2b2e30
Don't run shells within shells
Naatan Aug 24, 2023
c4fc3ed
Update termtest
Naatan Aug 25, 2023
29caa61
Leave default to run inside shell for now
Naatan Aug 25, 2023
dbc69da
Update termtest
Naatan Aug 28, 2023
ff93152
Ensure errors are surfaced
Naatan Aug 28, 2023
1f57ac0
Update termtest to get windows fixes
Naatan Aug 28, 2023
db8a297
Update termtest
Naatan Aug 28, 2023
728c3ad
Fix interrupt test
Naatan Aug 28, 2023
0129cb0
Work around line ending issue
Naatan Aug 28, 2023
3d8ed79
Fix test depending on terminal col width
Naatan Aug 28, 2023
512973b
Fix unable to run subtest
Naatan Aug 29, 2023
0958d3e
Turn on verbose logging to debug
Naatan Aug 29, 2023
62aed26
Limit terminal colums to 140 so we can check Snapshot() output withou…
Naatan Aug 29, 2023
1d89d41
Work around SendLine race condition
Naatan Aug 29, 2023
2da75d7
Fix test sending too many enter keys
Naatan Aug 29, 2023
2114af3
Use SendEnter()
Naatan Aug 29, 2023
d150396
Fix spawning commands not working on Windows
Naatan Aug 29, 2023
cf5dc7e
Drop verbose flag on tests
Naatan Aug 29, 2023
46d18b1
Fix test not matching cause of wrapping
Naatan Aug 29, 2023
b2e9bf2
Create org as part of new user creation in tests
Naatan Aug 29, 2023
a7b453e
Fix test relying on VERBOSE=true
Naatan Aug 29, 2023
04fd9ae
Don't run tests inside shell
Naatan Aug 29, 2023
617e4c5
Fix test using wrong method to retrieve executable
Naatan Aug 29, 2023
6d831bd
Give activation tests plenty of time
Naatan Aug 29, 2023
269ad07
Let implementer decide whether SendInput is appropriate
Naatan Aug 29, 2023
27e6612
Match casing of prompt
Naatan Aug 30, 2023
8fddb49
Debug test
Naatan Aug 30, 2023
20b4bde
Always use cmd style expect assertions on Windows, except when using …
Naatan Aug 30, 2023
b6aa8ec
Attempt to fix race condition
Naatan Aug 30, 2023
fe51e22
Set verbosity on the right level
Naatan Aug 30, 2023
7352999
Wait until process exits to assert
Naatan Aug 30, 2023
ae4652c
Ensure activate has sufficient time
Naatan Aug 30, 2023
315370f
Fix test assertion being too specific
Naatan Aug 30, 2023
f69c370
Always strip windows line endings
Naatan Aug 30, 2023
45d1564
Normalize line endings across the board
Naatan Aug 30, 2023
cb6036a
Also run baseline in verbose
Naatan Aug 30, 2023
aac5d49
Work around pty bug on windows
Naatan Aug 30, 2023
c4c6397
Only report termtest logs for failed test
Naatan Aug 31, 2023
fce6b32
Give checkout enough time
Naatan Aug 31, 2023
92cc3be
Give windows extra time before sending input
Naatan Aug 31, 2023
e2bdc7a
Update termtest to address potential premature close issue
Naatan Aug 31, 2023
f414c88
Revert "Create org as part of new user creation in tests"
Naatan Aug 31, 2023
35596a7
Fix logs not populated
Naatan Aug 31, 2023
a260bf3
Revert windows output workaround as it creates false positives
Naatan Aug 31, 2023
8028459
Attempt to work around pty output issues on windows
Naatan Aug 31, 2023
e61e47a
Fix bad formatting
Naatan Aug 31, 2023
75af502
Attempt to fix missing termtest log
Naatan Aug 31, 2023
c9c22c8
Update termtest
Naatan Sep 1, 2023
aea2f04
Fix sleep being way too long
Naatan Sep 5, 2023
6a22271
Drop custom timeouts where not needed
Naatan Sep 5, 2023
7e3e851
Update termtest
Naatan Sep 5, 2023
3ccd4d4
Disable executor verbosity as it's making it difficult to read test r…
Naatan Sep 5, 2023
150a575
Increase test time
Naatan Sep 5, 2023
2926b38
cmd doesn't like single quotes
Naatan Sep 5, 2023
66bb9ec
Fix test
Naatan Sep 5, 2023
d7d04d2
Try to fix failing test
Naatan Sep 6, 2023
4679e3a
Give runtime sourcing enough time
Naatan Sep 6, 2023
3f32568
Give enough time
Naatan Sep 6, 2023
96e7caa
Simplify test
Naatan Sep 6, 2023
812a768
Fix nil pointer when runtime sourcing is disabled
Naatan Sep 6, 2023
f672c7d
Give more time for runtime sourcing
Naatan Sep 6, 2023
8599937
Make it easier to debug test failures
Naatan Sep 6, 2023
3c9b9b3
Accessing env information requires non-disabled runtime
Naatan Sep 6, 2023
8166f66
Update termtest
Naatan Sep 8, 2023
7edd21d
Fix test name
Naatan Sep 8, 2023
763d698
Update termtest
Naatan Sep 8, 2023
4c9b83d
Update termtest
Naatan Sep 8, 2023
26afb93
Debug
Naatan Sep 11, 2023
3fc8bdc
Disable defender on Windows
Naatan Sep 11, 2023
9991305
Disable logging service requests
Naatan Sep 11, 2023
55f0185
Fix CI step
Naatan Sep 11, 2023
2c77b2f
Fix step on WIndows
Naatan Sep 11, 2023
061fe7b
Update termtest
Naatan Sep 11, 2023
cc86c70
Remove verbose logging
Naatan Sep 12, 2023
49bc64e
Fix vscode test
Naatan Sep 12, 2023
4087dc2
Debug
Naatan Sep 12, 2023
e1fc84b
Revert "Debug"
Naatan Sep 12, 2023
88c2df1
Update termtest
Naatan Sep 12, 2023
6208b05
Update termtest
Naatan Sep 12, 2023
7d126eb
Reduce chance of race condition
Naatan Sep 13, 2023
153c5f4
Update termtest
Naatan Sep 13, 2023
9073b64
Give runtime sourcing enough time
Naatan Sep 13, 2023
20d7882
Give runtime sourcing time
Naatan Sep 13, 2023
fc0fd35
Debug test
Naatan Sep 13, 2023
6d7da13
Debug log escape sequences
Naatan Sep 13, 2023
0e1cb41
Update termtest
Naatan Sep 13, 2023
8a67c52
Fix SendLine called too early
Naatan Sep 13, 2023
5c1cee5
Use snapshot because output is error prone due to cleaning
Naatan Sep 14, 2023
8b1e725
Fix assertion
Naatan Sep 14, 2023
939e670
Fix assertion with branch listing
Naatan Sep 14, 2023
5b4b674
Update termtest
Naatan Sep 14, 2023
d8479b3
Disable verbose logging
Naatan Sep 14, 2023
028a14d
Attempt to fix failed assertion due to line break
Naatan Sep 14, 2023
d592514
Update termtest
Naatan Sep 14, 2023
456c9dd
Also delay on regular sends on Windows
Naatan Sep 14, 2023
fe4ed94
Work around posix escape sequences on Windows
Naatan Sep 14, 2023
28bfd81
Use snapshot output for quick debugging as it gives a better sense of…
Naatan Sep 14, 2023
9fb3d7e
Drop useless comments
Naatan Sep 14, 2023
ce521cc
Skip tests on Windows for now as SendKeyDown doesn't work
Naatan Sep 14, 2023
8f42ce9
Wait for exit first
Naatan Sep 14, 2023
5b2395c
Prevent assertion issues due to escape sequences (color codes)
Naatan Sep 14, 2023
6c6b63b
Account for color codes in assertion
Naatan Sep 14, 2023
be95799
Reduce chance of race
Naatan Sep 15, 2023
2f61728
Merge branch 'version/0-42-0-RC1' into DX-1910
Naatan Sep 15, 2023
2110f00
Convert tests to termtest v2
Naatan Sep 15, 2023
6759c04
Merge branch 'version/0-42-0-RC1' into DX-1910
Naatan Sep 18, 2023
9c77bd6
Give runtime sourcing more time
Naatan Sep 18, 2023
7d7e365
Enable code that was disabled for v1 of termtest
Naatan Sep 18, 2023
4f62fad
Merge branch 'version/0-42-0-RC1' into DX-1910
Naatan Sep 18, 2023
47fae4d
Merge branch 'version/0-42-0-RC1' into DX-1910
Naatan Sep 18, 2023
7177cf1
Merge branch 'version/0-41-0-RC1' into DX-1910
Naatan Sep 19, 2023
69e8445
Update tests to use new API
Naatan Sep 19, 2023
f40a517
Merge branch 'version/0-42-0-RC1' into DX-1910
Naatan Sep 19, 2023
4da3f5b
Update tests to termtest v2 api
Naatan Sep 19, 2023
f5f92c0
Fix test
Naatan Sep 19, 2023
fb4684e
Fix test
Naatan Sep 19, 2023
205678b
Give windows more time to delete files
Naatan Sep 20, 2023
5ec5c03
Merge branch 'version/0-42-0-RC1' into DX-1910
Naatan Sep 20, 2023
65cd5d8
Fix typo
Naatan Sep 25, 2023
03a4736
Fix incorrect name in comment
Naatan Sep 25, 2023
a1bf3d0
Make comment more specific
Naatan Sep 25, 2023
b93bacc
Add link to jira ticket
Naatan Sep 25, 2023
dd8cb15
Add comments explaining flags
Naatan Sep 25, 2023
5ed621c
Use variable instead of hard coded string
Naatan Sep 25, 2023
89d6a7a
Add comment
Naatan Sep 25, 2023
5331492
Add comment with rationale to ExpectRE
Naatan Sep 25, 2023
c1debf8
Merge remote-tracking branch 'origin/version/0-42-0-RC1' into DX-1910
Naatan Sep 25, 2023
68fa6b9
Update new tests to use termtest v2 api
Naatan Sep 25, 2023
fea0746
Use cmd var
Naatan Sep 25, 2023
3d87ecb
Add comment with rationale about exit code
Naatan Sep 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ jobs:

# === OS Specific Steps ===
steps:
- # === Disable Windows Defender as it slows things down significantly ===
name: Disabling Windows Defender
if: runner.os == 'Windows'
shell: powershell
run: Set-MpPreference -DisableRealtimeMonitoring $true

- # === Checkout Code ===
name: Checkout code
Expand Down Expand Up @@ -313,14 +318,13 @@ jobs:
echo "Running integration tests with tags: $TEST_SUITE_TAGS (empty means every test not specifically tagged)"

export TEST_SUITE_TAGS="$TEST_SUITE_TAGS"
TIMEOUT=15m
TIMEOUT=30m
mitchell-as marked this conversation as resolved.
Show resolved Hide resolved
if [[ "$TEST_SUITE_TAGS" == "all" ]]; then
TIMEOUT=60m
fi
SHELL='' go test -timeout $TIMEOUT -v `go list ./... | grep "integration"` -json 2>&1 | gotestfmt -hide empty-packages
continue-on-error: ${{ github.event_name == 'schedule' }}
env:
ACTIVESTATE_VERBOSE: true
INTEGRATION_TEST_USERNAME: ${{ secrets.INTEGRATION_TEST_USERNAME }}
INTEGRATION_TEST_PASSWORD: ${{ secrets.INTEGRATION_TEST_PASSWORD }}
INTEGRATION_TEST_TOKEN: ${{ secrets.INTEGRATION_TEST_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ linters-settings:
- (*github.com/ActiveState/termtest.ConsoleProcess).ExpectExitCode
- (*github.com/ActiveState/termtest.ConsoleProcess).ExpectNotExitCode
- (*github.com/ActiveState/termtest.ConsoleProcess).ExpectRe
- (*github.com/ActiveState/termtest.ConsoleProcess).ExpectLongString
- (*github.com/ActiveState/termtest.ConsoleProcess).Expect
- (*github.com/ActiveState/termtest.ConsoleProcess).WaitForInput

# When issues occur with linting us the snippet below to help with debugging
Expand All @@ -23,4 +23,4 @@ linters-settings:
# - ineffassign
# - staticcheck
# - typecheck
# - unused
# - unused
99 changes: 50 additions & 49 deletions cmd/state-installer/test/integration/installer_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ func (suite *InstallerIntegrationTestSuite) TestInstallFromLocalSource() {
// Run installer with source-path flag (ie. install from this local path)
cp := ts.SpawnCmdWithOpts(
suite.installerExe,
e2e.WithArgs(installationDir(ts)),
e2e.AppendEnv(constants.DisableUpdates+"=false"),
e2e.AppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
e2e.OptArgs(installationDir(ts)),
e2e.OptAppendEnv(constants.DisableUpdates+"=false"),
e2e.OptAppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
)

// Assert output
Expand All @@ -58,20 +58,20 @@ func (suite *InstallerIntegrationTestSuite) TestInstallFromLocalSource() {
if runtime.GOOS == "darwin" && condition.OnCI() {
cp.Expect("You are running bash on macOS")
}
suite.NotContains(cp.TrimmedSnapshot(), "Downloading State Tool")
cp.WaitForInput()
suite.NotContains(cp.Output(), "Downloading State Tool")
cp.ExpectInput()
cp.SendLine("exit")
cp.ExpectExitCode(0)

// Ensure installing overtop doesn't result in errors
cp = ts.SpawnCmdWithOpts(
suite.installerExe,
e2e.WithArgs(installationDir(ts)),
e2e.AppendEnv(constants.DisableUpdates+"=false"),
e2e.AppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
e2e.OptArgs(installationDir(ts)),
e2e.OptAppendEnv(constants.DisableUpdates+"=false"),
e2e.OptAppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
)
cp.Expect("successfully installed")
cp.WaitForInput()
cp.ExpectInput()
cp.SendLine("exit")
cp.ExpectExitCode(0)

Expand All @@ -80,9 +80,9 @@ func (suite *InstallerIntegrationTestSuite) TestInstallFromLocalSource() {
suite.Require().NoError(fileutils.WriteFile(filepath.Join(installationDir(ts), installation.InstallDirMarker), []byte{}))
cp = ts.SpawnCmdWithOpts(
suite.installerExe,
e2e.WithArgs(installationDir(ts)),
e2e.AppendEnv(constants.DisableUpdates+"=false"),
e2e.AppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
e2e.OptArgs(installationDir(ts)),
e2e.OptAppendEnv(constants.DisableUpdates+"=false"),
e2e.OptAppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
)
cp.Expect("successfully installed")

Expand All @@ -99,21 +99,21 @@ func (suite *InstallerIntegrationTestSuite) TestInstallFromLocalSource() {
suite.NoError(err)

// Verify that launched subshell has State tool on PATH
cp.WaitForInput()
cp.ExpectInput()
cp.SendLine("state --version")
cp.Expect("Version")
cp.WaitForInput()
cp.ExpectInput()

if runtime.GOOS == "windows" {
cp.SendLine("where state")
} else {
cp.SendLine("which state")
}
cp.WaitForInput()
cp.ExpectInput()
cp.SendLine("exit")
cp.ExpectExitCode(0)

snapshot := strings.Replace(cp.TrimmedSnapshot(), "\n", "", -1)
snapshot := strings.Replace(cp.Output(), "\n", "", -1)
if !strings.Contains(snapshot, stateExec) && !strings.Contains(snapshot, stateExecResolved) {
suite.Fail(fmt.Sprintf("Snapshot does not include '%s' or '%s', snapshot:\n %s", stateExec, stateExecResolved, snapshot))
}
Expand Down Expand Up @@ -141,8 +141,8 @@ func (suite *InstallerIntegrationTestSuite) TestInstallIncompatible() {
// Run installer with source-path flag (ie. install from this local path)
cp := ts.SpawnCmdWithOpts(
suite.installerExe,
e2e.WithArgs(installationDir(ts)),
e2e.AppendEnv(constants.DisableUpdates+"=false", sysinfo.VersionOverrideEnvVar+"=10.0.0"),
e2e.OptArgs(installationDir(ts)),
e2e.OptAppendEnv(constants.DisableUpdates+"=false", sysinfo.VersionOverrideEnvVar+"=10.0.0"),
)

// Assert output
Expand All @@ -160,13 +160,13 @@ func (suite *InstallerIntegrationTestSuite) TestInstallNoErrorTips() {

cp := ts.SpawnCmdWithOpts(
suite.installerExe,
e2e.WithArgs(installationDir(ts), "--activate", "ActiveState/DoesNotExist"),
e2e.AppendEnv(constants.DisableUpdates+"=true"),
e2e.AppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
e2e.OptArgs(installationDir(ts), "--activate", "ActiveState/DoesNotExist"),
e2e.OptAppendEnv(constants.DisableUpdates+"=true"),
e2e.OptAppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
)

cp.ExpectExitCode(1)
suite.Assert().NotContains(cp.TrimmedSnapshot(), "Need More Help?", "error tips should not be displayed when invoking installer")
suite.Assert().NotContains(cp.Output(), "Need More Help?", "error tips should not be displayed when invoking installer")
}

func (suite *InstallerIntegrationTestSuite) TestInstallErrorTips() {
Expand All @@ -179,17 +179,18 @@ func (suite *InstallerIntegrationTestSuite) TestInstallErrorTips() {

cp := ts.SpawnCmdWithOpts(
suite.installerExe,
e2e.WithArgs(installationDir(ts), "--activate", "ActiveState-CLI/Python3"),
e2e.AppendEnv(constants.DisableUpdates+"=true"),
e2e.AppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
e2e.OptArgs(installationDir(ts), "--activate", "ActiveState-CLI/Python3"),
e2e.OptAppendEnv(constants.DisableUpdates+"=true"),
e2e.OptAppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
)

cp.WaitForInput()
cp.ExpectInput()
cp.SendLine("state command-does-not-exist")
cp.WaitForInput()
cp.ExpectInput()
cp.SendLine("exit")
cp.Wait()
suite.Assert().Contains(cp.TrimmedSnapshot(), "Need More Help?", "error tips should be displayed in shell created by installer")
cp.ExpectExit()
suite.Assert().Contains(cp.Output(), "Need More Help?",
"error tips should be displayed in shell created by installer")
}

func (suite *InstallerIntegrationTestSuite) TestStateTrayRemoval() {
Expand All @@ -201,12 +202,12 @@ func (suite *InstallerIntegrationTestSuite) TestStateTrayRemoval() {

// Install a release version that still has state-tray.
version := "0.35.0-SHAb78e2a4"
var cp *termtest.ConsoleProcess
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.WithArgs("-c", oneLiner),
e2e.AppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
"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")
Expand All @@ -215,12 +216,12 @@ func (suite *InstallerIntegrationTestSuite) TestStateTrayRemoval() {
ps1File := filepath.Join(ts.Dirs.Work, "install.ps1")
suite.Require().NoError(fileutils.WriteFile(ps1File, b))

cp = ts.SpawnCmdWithOpts("powershell.exe", e2e.WithArgs(ps1File, "-f", "-n", "-t", dir, "-v", version),
e2e.AppendEnv("SHELL="),
e2e.AppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
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", 5*time.Minute)
cp.Expect("Installation Complete", termtest.OptExpectTimeout(5*time.Minute))

// Verify state-tray is there.
svcExec, err := installation.ServiceExecFromDir(dir)
Expand All @@ -233,12 +234,12 @@ func (suite *InstallerIntegrationTestSuite) TestStateTrayRemoval() {
// Run the installer, which should remove state-tray and clean up after it.
cp = ts.SpawnCmdWithOpts(
suite.installerExe,
e2e.WithArgs("-f", "-n", "-t", dir),
e2e.AppendEnv(constants.UpdateBranchEnvVarName+"=release"),
e2e.AppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
e2e.OptArgs("-f", "-n", "-t", dir),
e2e.OptAppendEnv(constants.UpdateBranchEnvVarName+"=release"),
e2e.OptAppendEnv(fmt.Sprintf("%s=%s", constants.OverwriteDefaultSystemPathEnvVarName, dir)),
)
cp.Expect("Installing", 10*time.Second)
cp.Expect("Done", 30*time.Second)
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)
Expand All @@ -247,8 +248,8 @@ func (suite *InstallerIntegrationTestSuite) TestStateTrayRemoval() {
// 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.WithArgs("--version"))
suite.Assert().NotContains(cp.TrimmedSnapshot(), version)
cp = ts.SpawnCmdWithOpts(stateExec, e2e.OptArgs("--version"))
suite.Assert().NotContains(cp.Output(), version)
cp.ExpectExitCode(0)
}

Expand All @@ -267,8 +268,8 @@ func (suite *InstallerIntegrationTestSuite) TestInstallerOverwriteServiceApp() {

cp := ts.SpawnCmdWithOpts(
suite.installerExe,
e2e.WithArgs(installationDir(ts)),
e2e.AppendEnv(fmt.Sprintf("%s=%s", constants.AppInstallDirOverrideEnvVarName, appInstallDir)),
e2e.OptArgs(installationDir(ts)),
e2e.OptAppendEnv(fmt.Sprintf("%s=%s", constants.AppInstallDirOverrideEnvVarName, appInstallDir)),
)
cp.Expect("Done")
cp.SendLine("exit")
Expand All @@ -277,8 +278,8 @@ func (suite *InstallerIntegrationTestSuite) TestInstallerOverwriteServiceApp() {
// State Service.app should be overwritten cleanly without error.
cp = ts.SpawnCmdWithOpts(
suite.installerExe,
e2e.WithArgs(installationDir(ts)+"2"),
e2e.AppendEnv(fmt.Sprintf("%s=%s", constants.AppInstallDirOverrideEnvVarName, appInstallDir)),
e2e.OptArgs(installationDir(ts)+"2"),
e2e.OptAppendEnv(fmt.Sprintf("%s=%s", constants.AppInstallDirOverrideEnvVarName, appInstallDir)),
)
cp.Expect("Done")
cp.SendLine("exit")
Expand Down Expand Up @@ -338,10 +339,10 @@ func installationDir(ts *e2e.Session) string {
func (suite *InstallerIntegrationTestSuite) SetupSuite() {
rootPath := environment.GetRootPathUnsafe()
localPayload := filepath.Join(rootPath, "build", "payload", constants.ToplevelInstallArchiveDir)
suite.Assert().DirExists(localPayload, "locally generated payload exists")
suite.Require().DirExists(localPayload, "locally generated payload exists")

installerExe := filepath.Join(localPayload, constants.StateInstallerCmd+osutils.ExeExt)
suite.Assert().FileExists(installerExe, "locally generated installer exists")
suite.Require().FileExists(installerExe, "locally generated installer exists")

suite.installerExe = installerExe
}
Expand Down
Loading
Loading