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

Set runtime source timeout for expects where runtime sourcing is enabled #2837

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions test/integration/activate_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (suite *ActivateIntegrationTestSuite) activatePython(version string, extraE
e2e.OptArgs("-c", "import sys; print(sys.copyright);"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("ActiveState Software Inc.")
cp.Expect("ActiveState Software Inc.", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)
}

Expand Down Expand Up @@ -528,7 +528,7 @@ func (suite *ActivateIntegrationTestSuite) TestActivate_FromCache() {
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)

cp.ExpectInput()
cp.ExpectInput(e2e.RuntimeSourcingTimeoutOpt)
cp.SendLine("exit")
cp.ExpectExitCode(0)
suite.NotContains(cp.Output(), "Downloading")
Expand Down
4 changes: 2 additions & 2 deletions test/integration/bundle_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ func (suite *BundleIntegrationTestSuite) TestJSON() {
e2e.OptArgs("bundles", "install", "Testing", "--output", "json"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect(`"name":"Testing"`)
cp.Expect(`"name":"Testing"`, e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)
AssertValidJSON(suite.T(), cp)

cp = ts.SpawnWithOpts(
e2e.OptArgs("bundles", "uninstall", "Testing", "-o", "editor"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect(`"name":"Testing"`)
cp.Expect(`"name":"Testing"`, e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)
AssertValidJSON(suite.T(), cp)
}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/checkout_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (suite *CheckoutIntegrationTestSuite) TestCheckoutCustomRTPath() {
suite.Require().NoError(err)
customRTPath = strings.ToLower(customRTPath)
}
cp.Expect(customRTPath)
cp.Expect(customRTPath, e2e.RuntimeSourcingTimeoutOpt)
}

func (suite *CheckoutIntegrationTestSuite) TestCheckoutNotFound() {
Expand Down
14 changes: 6 additions & 8 deletions test/integration/deploy_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import (
"path/filepath"
"runtime"
"testing"
"time"

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

Expand Down Expand Up @@ -57,12 +55,12 @@ func (suite *DeployIntegrationTestSuite) deploy(ts *e2e.Session, prj string, tar
)
}

cp.Expect("Installing", termtest.OptExpectTimeout(40*time.Second))
cp.Expect("Configuring", termtest.OptExpectTimeout(40*time.Second))
cp.Expect("Installing", e2e.RuntimeSourcingTimeoutOpt)
cp.Expect("Configuring")
if runtime.GOOS != "windows" {
cp.Expect("Symlinking", termtest.OptExpectTimeout(30*time.Second))
cp.Expect("Symlinking")
}
cp.Expect("Deployment Information", termtest.OptExpectTimeout(60*time.Second))
cp.Expect("Deployment Information")
cp.Expect(targetID) // expect bin dir
if runtime.GOOS == "windows" {
cp.Expect("log out")
Expand Down Expand Up @@ -291,7 +289,7 @@ func (suite *DeployIntegrationTestSuite) TestDeployConfigure() {
)
}

cp.Expect("Configuring shell", termtest.OptExpectTimeout(60*time.Second))
cp.Expect("Configuring shell", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)
suite.AssertConfig(ts, targetID.String())

Expand All @@ -300,7 +298,7 @@ func (suite *DeployIntegrationTestSuite) TestDeployConfigure() {
e2e.OptArgs("deploy", "configure", "ActiveState-CLI/Python3", "--path", targetPath, "--user"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Configuring shell", termtest.OptExpectTimeout(60*time.Second))
cp.Expect("Configuring shell", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

out, err := exec.Command("reg", "query", `HKCU\Environment`, "/v", "Path").Output()
Expand Down
2 changes: 1 addition & 1 deletion test/integration/exec_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (suite *ExecIntegrationTestSuite) TestExecWithPath() {
e2e.OptArgs("exec", "--path", pythonDir, "which", "python3"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Operating on project ActiveState-CLI/Python-3.9")
cp.Expect("Operating on project ActiveState-CLI/Python-3.9", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectRe(regexp.MustCompile("cache/[0-9A-Fa-f]+/usr/bin/python3").String())
cp.ExpectExitCode(0)

Expand Down
4 changes: 2 additions & 2 deletions test/integration/export_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (suite *ExportIntegrationTestSuite) TestExport_Env() {
e2e.OptArgs("export", "env"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect(`PATH: `)
cp.Expect(`PATH: `, e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

suite.Assert().NotContains(cp.Output(), "ACTIVESTATE_ACTIVATED")
Expand All @@ -115,7 +115,7 @@ func (suite *ExportIntegrationTestSuite) TestJSON() {
e2e.OptArgs("export", "env", "-o", "json"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.ExpectExitCode(0)
cp.ExpectExitCode(0, e2e.RuntimeSourcingTimeoutOpt)
AssertValidJSON(suite.T(), cp)

ts.LoginAsPersistentUser()
Expand Down
2 changes: 1 addition & 1 deletion test/integration/init_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (suite *InitIntegrationTestSuite) TestInit_InferLanguageFromUse() {
e2e.OptArgs("use", "Python3"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Switched to project")
cp.Expect("Switched to project", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

pname := strutils.UUID()
Expand Down
4 changes: 1 addition & 3 deletions test/integration/install_scripts_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import (
"path/filepath"
"runtime"
"testing"
"time"

"github.com/ActiveState/termtest"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"github.com/thoas/go-funk"
Expand Down Expand Up @@ -234,7 +232,7 @@ func scriptPath(t *testing.T, targetDir string) string {

func expectStateToolInstallation(cp *e2e.SpawnedCmd) {
cp.Expect("Preparing Installer for State Tool Package Manager")
cp.Expect("Installation Complete", termtest.OptExpectTimeout(time.Minute))
cp.Expect("Installation Complete", e2e.RuntimeSourcingTimeoutOpt)
}

// assertBinDirContents checks if given files are or are not in the bin directory
Expand Down
2 changes: 1 addition & 1 deletion test/integration/package_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ func (suite *PackageIntegrationTestSuite) TestJSON() {
e2e.OptArgs("uninstall", "Text-CSV", "-o", "json"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect(`{"name":"Text-CSV"`)
cp.Expect(`{"name":"Text-CSV"`, e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)
AssertValidJSON(suite.T(), cp)
}
Expand Down
4 changes: 2 additions & 2 deletions test/integration/progress_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (suite *ProgressIntegrationTestSuite) TestProgress() {
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect(locale.T("setup_runtime"))
cp.Expect("Checked out")
cp.Expect("Checked out", e2e.RuntimeSourcingTimeoutOpt)
suite.Assert().NotContains(cp.Output(), "...")
cp.ExpectExitCode(0)

Expand All @@ -33,7 +33,7 @@ func (suite *ProgressIntegrationTestSuite) TestProgress() {
)
cp.Expect(locale.T("setup_runtime"))
cp.Expect("...")
cp.Expect("Checked out")
cp.Expect("Checked out", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)
}

Expand Down
2 changes: 1 addition & 1 deletion test/integration/pull_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (suite *PullIntegrationTestSuite) TestMergeBuildScript() {
e2e.OptArgs("install", "requests"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Package added")
cp.Expect("Package added", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

proj, err := project.FromPath(ts.Dirs.Work)
Expand Down
4 changes: 2 additions & 2 deletions test/integration/push_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ func (suite *PushIntegrationTestSuite) TestCarlisle() {
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"))
switch runtime.GOOS {
case "darwin":
cp.ExpectRe("added|being built", termtest.OptExpectTimeout(60*time.Second)) // while cold storage is off
cp.ExpectRe("added|being built", e2e.RuntimeSourcingTimeoutOpt) // while cold storage is off
cp.Wait()
default:
cp.Expect("added", termtest.OptExpectTimeout(60*time.Second))
cp.Expect("added", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)
}

Expand Down
6 changes: 3 additions & 3 deletions test/integration/refresh_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (suite *RefreshIntegrationTestSuite) TestRefresh() {
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Setting Up Runtime")
cp.Expect("Runtime updated")
cp.Expect("Runtime updated", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

cp = ts.SpawnWithOpts(
Expand All @@ -41,14 +41,14 @@ func (suite *RefreshIntegrationTestSuite) TestRefresh() {
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Setting Up Runtime")
cp.Expect("Runtime updated")
cp.Expect("Runtime updated", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

cp = ts.SpawnWithOpts(
e2e.OptArgs("exec", "--", "python3", "-c", "import requests"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.ExpectExitCode(0)
cp.ExpectExitCode(0, e2e.RuntimeSourcingTimeoutOpt)

cp = ts.Spawn("refresh")
suite.Assert().NotContains(cp.Output(), "Setting Up Runtime", "Unchanged runtime should not refresh")
Expand Down
2 changes: 1 addition & 1 deletion test/integration/revert_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (suite *RevertIntegrationTestSuite) TestRevert() {
e2e.OptArgs("shell", "Revert"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.ExpectInput()
cp.ExpectInput(e2e.RuntimeSourcingTimeoutOpt)
cp.SendLine("python3")
cp.Expect("3.9.15")
cp.SendLine("import urllib3")
Expand Down
2 changes: 1 addition & 1 deletion test/integration/runtime_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (suite *RuntimeIntegrationTestSuite) TestInterruptSetup() {
e2e.OptArgs("checkout", "ActiveState-CLI/test-interrupt-small-python#863c45e2-3626-49b6-893c-c15e85a17241", "."),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Checked out project")
cp.Expect("Checked out project", e2e.RuntimeSourcingTimeoutOpt)

targetDir := target.ProjectDirToTargetDir(ts.Dirs.Work, ts.Dirs.Cache)
pythonExe := filepath.Join(setup.ExecDir(targetDir), "python3"+exeutils.Extension)
Expand Down
6 changes: 3 additions & 3 deletions test/integration/shell_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (suite *ShellIntegrationTestSuite) TestDefaultNoLongerExists() {
e2e.OptArgs("use", "ActiveState-CLI/Python3"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Switched to project")
cp.Expect("Switched to project", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

err := os.RemoveAll(filepath.Join(ts.Dirs.Work, "Python3"))
Expand Down Expand Up @@ -228,7 +228,7 @@ func (suite *ShellIntegrationTestSuite) TestUseShellUpdates() {
e2e.OptAppendEnv("SHELL=bash"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Switched to project")
cp.Expect("Switched to project", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

// Ensure both bash and zsh RC files are updated
Expand Down Expand Up @@ -294,7 +294,7 @@ func (suite *ShellIntegrationTestSuite) TestRuby() {
e2e.OptArgs("shell", "Ruby-3.2.2"),
e2e.OptAppendEnv(constants.DisableRuntime+"=false"),
)
cp.Expect("Activated")
cp.Expect("Activated", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectInput()
cp.SendLine("ruby -v")
cp.Expect("3.2.2")
Expand Down
2 changes: 1 addition & 1 deletion test/integration/shells_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (suite *ShellsIntegrationTestSuite) TestShells() {
e2e.OptArgs("checkout", "ActiveState-CLI/small-python"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Checked out project")
cp.Expect("Checked out project", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

for _, shell := range shells {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/show_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (suite *ShowIntegrationTestSuite) TestShow() {
e2e.OptArgs("activate"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.ExpectInput()
cp.ExpectInput(e2e.RuntimeSourcingTimeoutOpt)

cp = ts.Spawn("show")
cp.Expect(`Name`)
Expand Down
18 changes: 9 additions & 9 deletions test/integration/use_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (suite *UseIntegrationTestSuite) TestUse() {
e2e.OptArgs("use", "ActiveState-CLI/Python3"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Switched to project")
cp.Expect("Switched to project", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

// Verify runtime works.
Expand All @@ -57,7 +57,7 @@ func (suite *UseIntegrationTestSuite) TestUse() {
e2e.OptArgs("use", "ActiveState-CLI/Python-3.9"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Switched to project")
cp.Expect("Switched to project", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

// Verify the new runtime works.
Expand All @@ -70,7 +70,7 @@ func (suite *UseIntegrationTestSuite) TestUse() {
e2e.OptArgs("use", "Python3"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Switched to project")
cp.Expect("Switched to project", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

// Verify the first runtime is set up correctly and usable.
Expand Down Expand Up @@ -102,7 +102,7 @@ func (suite *UseIntegrationTestSuite) TestUseCwd() {
e2e.OptWD(pythonDir),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Switched to project")
cp.Expect("Switched to project", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

emptyDir := filepath.Join(ts.Dirs.Work, "EmptyDir")
Expand Down Expand Up @@ -133,7 +133,7 @@ func (suite *UseIntegrationTestSuite) TestReset() {
e2e.OptArgs("use", "ActiveState-CLI/Python3"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Switched to project")
cp.Expect("Switched to project", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

python3Exe := filepath.Join(ts.Dirs.DefaultBin, "python3"+osutils.ExeExt)
Expand Down Expand Up @@ -188,7 +188,7 @@ func (suite *UseIntegrationTestSuite) TestShow() {
e2e.OptArgs("use", "ActiveState-CLI/Python3"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Switched to project")
cp.Expect("Switched to project", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

cp = ts.SpawnWithOpts(
Expand Down Expand Up @@ -239,7 +239,7 @@ func (suite *UseIntegrationTestSuite) TestSetupNotice() {
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Setting Up Runtime")
cp.Expect("Checked out project")
cp.Expect("Checked out project", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

suite.Require().NoError(os.RemoveAll(filepath.Join(ts.Dirs.Work, "Python3"))) // runtime marker still exists
Expand All @@ -256,7 +256,7 @@ func (suite *UseIntegrationTestSuite) TestSetupNotice() {
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect("Setting Up Runtime")
cp.Expect("Switched to project")
cp.Expect("Switched to project", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)
}

Expand All @@ -274,7 +274,7 @@ func (suite *UseIntegrationTestSuite) TestJSON() {
e2e.OptArgs("use", "-o", "json"),
e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"),
)
cp.Expect(`"namespace":`)
cp.Expect(`"namespace":`, e2e.RuntimeSourcingTimeoutOpt)
cp.Expect(`"path":`)
cp.Expect(`"executables":`)
cp.ExpectExitCode(0)
Expand Down
Loading