From d304fb497d821eece5b9154dac60b01cff6d0702 Mon Sep 17 00:00:00 2001 From: mdrakos Date: Wed, 25 Oct 2023 15:06:20 -0700 Subject: [PATCH 1/2] Fix failing integration tests --- test/integration/bundle_int_test.go | 6 ++++-- test/integration/package_int_test.go | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/test/integration/bundle_int_test.go b/test/integration/bundle_int_test.go index ed4cf0775b..d7a90bc98f 100644 --- a/test/integration/bundle_int_test.go +++ b/test/integration/bundle_int_test.go @@ -221,8 +221,10 @@ func (suite *BundleIntegrationTestSuite) TestJSON() { cp.ExpectExitCode(0) AssertValidJSON(suite.T(), cp) - cp = ts.Spawn("checkout", "ActiveState-CLI/Bundles", ".") - cp.Expect("Skipping runtime setup") + cp = ts.SpawnWithOpts( + e2e.OptArgs("checkout", "ActiveState-CLI/Bundles", "."), + e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"), + ) cp.Expect("Checked out project") cp.ExpectExitCode(0) diff --git a/test/integration/package_int_test.go b/test/integration/package_int_test.go index 81578f1b6d..77f4e4c4c4 100644 --- a/test/integration/package_int_test.go +++ b/test/integration/package_int_test.go @@ -470,8 +470,10 @@ func (suite *PackageIntegrationTestSuite) TestJSON() { cp.ExpectExitCode(0) AssertValidJSON(suite.T(), cp) - cp = ts.Spawn("checkout", "ActiveState-CLI/Packages-Perl", ".") - cp.Expect("Skipping runtime setup") + cp = ts.SpawnWithOpts( + e2e.OptArgs("checkout", "ActiveState-CLI/Packages-Perl", "."), + e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"), + ) cp.Expect("Checked out project") cp.ExpectExitCode(0) From 5a90844252be7b20cd8f6084a7bd2d78634c7e9b Mon Sep 17 00:00:00 2001 From: mdrakos Date: Thu, 26 Oct 2023 14:30:31 -0700 Subject: [PATCH 2/2] Address PR review feedback Removed unreferenced code Use rationalized error type Attempt to speed up integration tests --- internal/constants/constants.go | 4 ---- internal/runbits/rationalize/types.go | 2 -- internal/runbits/requirements/requirements.go | 3 ++- pkg/platform/model/projects.go | 6 ------ test/integration/bundle_int_test.go | 1 - test/integration/package_int_test.go | 1 - 6 files changed, 2 insertions(+), 15 deletions(-) diff --git a/internal/constants/constants.go b/internal/constants/constants.go index 3d24c34c23..e2a794a63c 100644 --- a/internal/constants/constants.go +++ b/internal/constants/constants.go @@ -312,10 +312,6 @@ const ActiveStateSupportURL = "https://www.activestate.com/support/?utm_source=p // ActiveStateDashboardURL is the URL for the ActiveState account preferences page const ActiveStateDashboardURL = "https://platform.activestate.com/?utm_source=platform-application-gui&utm_medium=activestate-desktop&utm_content=drop-down&utm_campaign=maru" -// DashboardCommitURL is the URL used to inspect commits -// TODO: Can this be removed? -const DashboardCommitURL = "https://platform.activestate.com/commit/" - // BugTrackerURL is the URL of our bug tracker const BugTrackerURL = "https://github.com/ActiveState/state-tool/issues" diff --git a/internal/runbits/rationalize/types.go b/internal/runbits/rationalize/types.go index 51a69035f6..264794e7fa 100644 --- a/internal/runbits/rationalize/types.go +++ b/internal/runbits/rationalize/types.go @@ -17,8 +17,6 @@ var ErrNotAuthenticated = errors.New("not authenticated") var ErrActionAborted = errors.New("aborted by user") -var ErrHeadless = errors.New("headless") - type ErrAPI struct { Wrapped error Code int diff --git a/internal/runbits/requirements/requirements.go b/internal/runbits/requirements/requirements.go index aab0992659..ad2ab06a22 100644 --- a/internal/runbits/requirements/requirements.go +++ b/internal/runbits/requirements/requirements.go @@ -19,6 +19,7 @@ import ( "github.com/ActiveState/cli/internal/prompt" "github.com/ActiveState/cli/internal/rtutils/ptr" "github.com/ActiveState/cli/internal/runbits" + "github.com/ActiveState/cli/internal/runbits/rationalize" "github.com/ActiveState/cli/pkg/localcommit" bpModel "github.com/ActiveState/cli/pkg/platform/api/buildplanner/model" medmodel "github.com/ActiveState/cli/pkg/platform/api/mediator/model" @@ -101,7 +102,7 @@ func (r *RequirementOperation) ExecuteRequirementOperation(requirementName, requ var err error if r.Project == nil { - return locale.NewInputError("err_no_project", "No project found") + return rationalize.ErrNoProject } out.Notice(locale.Tl("operating_message", "", r.Project.NamespaceString(), r.Project.Dir())) diff --git a/pkg/platform/model/projects.go b/pkg/platform/model/projects.go index 4de74f5554..e3cc24da17 100644 --- a/pkg/platform/model/projects.go +++ b/pkg/platform/model/projects.go @@ -2,7 +2,6 @@ package model import ( "fmt" - "strings" "github.com/go-openapi/strfmt" @@ -264,11 +263,6 @@ func ProjectURL(owner, name, commitID string) string { return url } -// CommitURL creates a valid platform commit URL for the given commit -func CommitURL(commitID string) string { - return fmt.Sprintf("%s/%s", strings.TrimSuffix(constants.DashboardCommitURL, "/"), commitID) -} - func AddBranch(projectID strfmt.UUID, label string) (strfmt.UUID, error) { var branchID strfmt.UUID addParams := projects.NewAddBranchParams() diff --git a/test/integration/bundle_int_test.go b/test/integration/bundle_int_test.go index d7a90bc98f..8e1ad7e905 100644 --- a/test/integration/bundle_int_test.go +++ b/test/integration/bundle_int_test.go @@ -223,7 +223,6 @@ func (suite *BundleIntegrationTestSuite) TestJSON() { cp = ts.SpawnWithOpts( e2e.OptArgs("checkout", "ActiveState-CLI/Bundles", "."), - e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"), ) cp.Expect("Checked out project") cp.ExpectExitCode(0) diff --git a/test/integration/package_int_test.go b/test/integration/package_int_test.go index 77f4e4c4c4..f15c01a3f7 100644 --- a/test/integration/package_int_test.go +++ b/test/integration/package_int_test.go @@ -472,7 +472,6 @@ func (suite *PackageIntegrationTestSuite) TestJSON() { cp = ts.SpawnWithOpts( e2e.OptArgs("checkout", "ActiveState-CLI/Packages-Perl", "."), - e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"), ) cp.Expect("Checked out project") cp.ExpectExitCode(0)