Skip to content

Commit

Permalink
Lack of having a commit ID for package operations is an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchell-as committed Oct 17, 2023
1 parent 88c299d commit 25b8272
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 33 deletions.
4 changes: 2 additions & 2 deletions internal/runbits/requirements/requirements.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 != ""
Expand Down
36 changes: 5 additions & 31 deletions test/integration/package_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package integration

import (
"fmt"
"io/ioutil"
"path/filepath"
"runtime"
"testing"
Expand Down Expand Up @@ -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)

Expand All @@ -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"),
Expand Down

0 comments on commit 25b8272

Please sign in to comment.