Skip to content

Commit

Permalink
Merge branch version/0-47-0-RC1 to adopt changes from PR #3526
Browse files Browse the repository at this point in the history
  • Loading branch information
as-builds committed Oct 3, 2024
2 parents a6d6a35 + 0d07973 commit a02cd55
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion internal/scriptrun/test/integration/scriptrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ import (
"testing"

"github.com/ActiveState/cli/internal/analytics/client/blackhole"
"github.com/ActiveState/cli/internal/installation"
"github.com/ActiveState/cli/internal/primer"
"github.com/ActiveState/cli/internal/scriptrun"
"github.com/ActiveState/cli/internal/svcctl"
"github.com/ActiveState/cli/internal/testhelpers/e2e"
"github.com/ActiveState/cli/internal/testhelpers/suite"
"github.com/ActiveState/cli/internal/testhelpers/tagsuite"
"github.com/kami-zh/go-capturer"
Expand Down Expand Up @@ -87,6 +90,8 @@ scripts:
func (suite *ScriptRunSuite) TestEnvIsSet() {
suite.OnlyRunForTags(tagsuite.Scripts)
t := suite.T()
ts := e2e.New(t, false)
defer ts.Close()

if runtime.GOOS == "windows" {
// For some reason this test hangs on Windows when ran via CI. I cannot reproduce the issue when manually invoking the
Expand Down Expand Up @@ -119,8 +124,17 @@ func (suite *ScriptRunSuite) TestEnvIsSet() {

cfg.Set(constants.AsyncRuntimeConfig, true)

ipcClient := svcctl.NewDefaultIPCClient()
var svcPort string

svcExec, err := installation.ServiceExecFromDir(ts.Dirs.Bin)
suite.Require().NoError(err, errs.JoinMessage(err))

svcPort, err = svcctl.EnsureExecStartedAndLocateHTTP(ipcClient, svcExec, "from test", nil)
suite.Require().NoError(err, errs.JoinMessage(err))

out := capturer.CaptureOutput(func() {
scriptRun := scriptrun.New(primer.New(auth, outputhelper.NewCatcher(), subshell.New(cfg), proj, cfg, blackhole.New(), model.NewSvcModel("")))
scriptRun := scriptrun.New(primer.New(auth, outputhelper.NewCatcher(), subshell.New(cfg), proj, cfg, blackhole.New(), model.NewSvcModel(svcPort)))
script, err := proj.ScriptByName("run")
require.NoError(t, err, "Error: "+errs.JoinMessage(err))
err = scriptRun.Run(script, nil)
Expand Down

0 comments on commit a02cd55

Please sign in to comment.