From 25b82725c67a3f3ca7847a1d260055889df6b20e Mon Sep 17 00:00:00 2001 From: mitchell Date: Tue, 17 Oct 2023 16:27:44 -0400 Subject: [PATCH] Lack of having a commit ID for package operations is an error. --- internal/runbits/requirements/requirements.go | 4 +-- test/integration/package_int_test.go | 36 +++---------------- 2 files changed, 7 insertions(+), 33 deletions(-) diff --git a/internal/runbits/requirements/requirements.go b/internal/runbits/requirements/requirements.go index f89281cd54..66f920d028 100644 --- a/internal/runbits/requirements/requirements.go +++ b/internal/runbits/requirements/requirements.go @@ -127,7 +127,7 @@ func (r *RequirementOperation) ExecuteRequirementOperation(requirementName, requ switch nsType { case model.NamespacePackage, model.NamespaceBundle: commitID, err := localcommit.Get(pj.Dir()) - if err != nil && !localcommit.IsFileDoesNotExistError(err) { + if err != nil { return errs.Wrap(err, "Unable to get local commit") } language, err := model.LanguageByCommit(commitID) @@ -205,7 +205,7 @@ func (r *RequirementOperation) ExecuteRequirementOperation(requirementName, requ } parentCommitID, err := localcommit.Get(pj.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 0ecc082265..8b08d9cccc 100644 --- a/test/integration/package_int_test.go +++ b/test/integration/package_int_test.go @@ -2,7 +2,6 @@ package integration import ( "fmt" - "io/ioutil" "path/filepath" "runtime" "testing" @@ -448,36 +447,6 @@ scripts: ts.PrepareCommitIdFile("a9d0bc88-585a-49cf-89c1-6c07af781cff") } -func (suite *PackageIntegrationTestSuite) TestInstall_Empty() { - suite.OnlyRunForTags(tagsuite.Package) - if runtime.GOOS == "darwin" { - suite.T().Skip("Skipping mac for now as the builds are still too unreliable") - return - } - - ts := e2e.New(suite.T(), false) - defer ts.Close() - - cp := ts.SpawnWithOpts( - e2e.OptArgs("install", "JSON"), - e2e.OptAppendEnv("ACTIVESTATE_CLI_DISABLE_RUNTIME=false"), - ) - cp.Expect("Installing Package") - cp.ExpectExitCode(0, e2e.RuntimeSourcingTimeoutOpt) - - configFilepath := filepath.Join(ts.Dirs.Work, constants.ConfigFileName) - suite.Require().FileExists(configFilepath) - - content, err := ioutil.ReadFile(configFilepath) - suite.Require().NoError(err) - if !suite.Contains(string(content), constants.DashboardCommitURL) { - suite.Fail("activestate.yaml does not contain dashboard commit URL") - } - - commitIdFile := filepath.Join(ts.Dirs.Work, constants.ProjectConfigDirName, constants.CommitIdFileName) - suite.Assert().FileExists(commitIdFile) -} - func (suite *PackageIntegrationTestSuite) TestPackage_UninstallDoesNotExist() { suite.OnlyRunForTags(tagsuite.Package) @@ -501,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"),