From 79d2522e344e8782fee2c78b0d5a87c6be812247 Mon Sep 17 00:00:00 2001 From: mitchell Date: Tue, 17 Oct 2023 16:27:44 -0400 Subject: [PATCH 1/2] Lack of having a commit ID for package operations is an error. --- internal/runbits/requirements/requirements.go | 4 ++-- test/integration/package_int_test.go | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/runbits/requirements/requirements.go b/internal/runbits/requirements/requirements.go index aab0992659..8e65e826db 100644 --- a/internal/runbits/requirements/requirements.go +++ b/internal/runbits/requirements/requirements.go @@ -108,7 +108,7 @@ func (r *RequirementOperation) ExecuteRequirementOperation(requirementName, requ switch nsType { case model.NamespacePackage, model.NamespaceBundle: commitID, err := localcommit.Get(r.Project.Dir()) - if err != nil && !localcommit.IsFileDoesNotExistError(err) { + if err != nil { return errs.Wrap(err, "Unable to get local commit") } @@ -190,7 +190,7 @@ func (r *RequirementOperation) ExecuteRequirementOperation(requirementName, requ } parentCommitID, err := localcommit.Get(r.Project.Dir()) - if err != nil && !localcommit.IsFileDoesNotExistError(err) { + if err != nil { return errs.Wrap(err, "Unable to get local commit") } hasParentCommit := parentCommitID != "" diff --git a/test/integration/package_int_test.go b/test/integration/package_int_test.go index d824fe0cde..21e7568070 100644 --- a/test/integration/package_int_test.go +++ b/test/integration/package_int_test.go @@ -470,6 +470,11 @@ func (suite *PackageIntegrationTestSuite) TestJSON() { cp.ExpectExitCode(0) AssertValidJSON(suite.T(), cp) + cp = ts.Spawn("checkout", "ActiveState-CLI/Perl-5.32", ".") + cp.Expect("Skipping runtime setup") + cp.Expect("Checked out project") + cp.ExpectExitCode(0) + cp = ts.SpawnWithOpts( e2e.OptArgs("install", "Text-CSV", "--output", "editor"), e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"), From 6132cbe667f1f2700dd9b037568ce9585703df09 Mon Sep 17 00:00:00 2001 From: mitchell Date: Fri, 20 Oct 2023 17:09:52 -0400 Subject: [PATCH 2/2] Lack of having a commit ID for push/pull is also an error. --- internal/runners/pull/pull.go | 4 ++-- internal/runners/push/push.go | 2 +- test/integration/pull_int_test.go | 2 +- test/integration/push_int_test.go | 18 ------------------ 4 files changed, 4 insertions(+), 22 deletions(-) diff --git a/internal/runners/pull/pull.go b/internal/runners/pull/pull.go index 2234aee863..586f3569d9 100644 --- a/internal/runners/pull/pull.go +++ b/internal/runners/pull/pull.go @@ -99,7 +99,7 @@ func (p *Pull) Run(params *PullParams) error { var localCommit *strfmt.UUID localCommitID, err := localcommit.Get(p.project.Dir()) - if err != nil && !localcommit.IsFileDoesNotExistError(err) { + if err != nil { return errs.Wrap(err, "Unable to get local commit") } if localCommitID != "" { @@ -151,7 +151,7 @@ func (p *Pull) Run(params *PullParams) error { } commitID, err := localcommit.Get(p.project.Dir()) - if err != nil && !localcommit.IsFileDoesNotExistError(err) { + if err != nil { return errs.Wrap(err, "Unable to get local commit") } diff --git a/internal/runners/push/push.go b/internal/runners/push/push.go index 25a54f1d83..2c32aa7bf2 100644 --- a/internal/runners/push/push.go +++ b/internal/runners/push/push.go @@ -254,7 +254,7 @@ func (r *Push) verifyInput() error { } commitID, err := localcommit.Get(r.project.Dir()) - if err != nil && !localcommit.IsFileDoesNotExistError(err) { + if err != nil { return errs.Wrap(err, "Unable to get local commit") } if commitID == "" { diff --git a/test/integration/pull_int_test.go b/test/integration/pull_int_test.go index b4ff02e38d..c4c589ef89 100644 --- a/test/integration/pull_int_test.go +++ b/test/integration/pull_int_test.go @@ -24,7 +24,7 @@ func (suite *PullIntegrationTestSuite) TestPull() { ts := e2e.New(suite.T(), false) defer ts.Close() - ts.PrepareProject("ActiveState-CLI/Python3", "") + ts.PrepareProject("ActiveState-CLI/Python3", "59404293-e5a9-4fd0-8843-77cd4761b5b5") cp := ts.Spawn("pull") cp.Expect("Operating on project") diff --git a/test/integration/push_int_test.go b/test/integration/push_int_test.go index c72f41b3d6..d00af970e3 100644 --- a/test/integration/push_int_test.go +++ b/test/integration/push_int_test.go @@ -264,24 +264,6 @@ func (suite *PushIntegrationTestSuite) TestPush_NoChanges() { } } -func (suite *PushIntegrationTestSuite) TestPush_NoCommit() { - suite.OnlyRunForTags(tagsuite.Push) - - ts := e2e.New(suite.T(), false) - defer ts.Close() - - ts.PrepareProject("ActiveState-CLI/cli", "") - - ts.LoginAsPersistentUser() - cp := ts.SpawnWithOpts(e2e.OptArgs("push")) - cp.Expect("nothing to push") - cp.ExpectExitCode(1) - - if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) - } -} - func (suite *PushIntegrationTestSuite) TestPush_NameInUse() { suite.OnlyRunForTags(tagsuite.Push)