Skip to content

Commit

Permalink
Revert some setup changes
Browse files Browse the repository at this point in the history
Remove unnecessary integration test
  • Loading branch information
MDrakos committed Oct 3, 2023
1 parent 516fd9a commit 8e87b80
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 52 deletions.
3 changes: 0 additions & 3 deletions internal/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ const DisableUpdates = "ACTIVESTATE_CLI_DISABLE_UPDATES"
// UpdateBranchEnvVarName is the env var that is used to override which branch to pull the update from
const UpdateBranchEnvVarName = "ACTIVESTATE_CLI_UPDATE_BRANCH"

// InstallBuildDependencies is the env var that is used to override whether to install build dependencies
const InstallBuildDependencies = "ACTIVESTATE_CLI_INSTALL_BUILD_DEPENDENCIES"

// InternalConfigFileNameLegacy is effectively the same as InternalConfigName, but includes our preferred extension
const InternalConfigFileNameLegacy = "config.yaml"

Expand Down
3 changes: 0 additions & 3 deletions pkg/platform/runtime/buildplan/buildplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,6 @@ func buildBuildClosureDependencies(artifactID strfmt.UUID, lookup map[strfmt.UUI

var uniqueDeps []strfmt.UUID
for id := range deps {
if _, ok := deps[id]; !ok {
continue
}
uniqueDeps = append(uniqueDeps, id)
}

Expand Down
39 changes: 13 additions & 26 deletions pkg/platform/runtime/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,11 @@ func (s *Setup) fetchAndInstallArtifactsFromBuildPlan(installFunc artifactInstal
var runtimeAndBuildtimeArtifacts artifact.Map
var runtimeArtifacts artifact.Map // Artifacts required for the runtime to function

runtimeArtifacts, err = buildplan.NewMapFromBuildPlan(buildResult.Build)
if err != nil {
return nil, nil, errs.Wrap(err, "Failed to create artifact map from build plan")
}

// If the build is not ready, we need to get the runtime and buildtime closure
if !buildResult.BuildReady {
runtimeAndBuildtimeArtifacts, err = buildplan.NewBuildtimeMap(buildResult.Build)
Expand All @@ -393,23 +398,6 @@ func (s *Setup) fetchAndInstallArtifactsFromBuildPlan(installFunc artifactInstal
}
}

// If we are installing build dependencies, then buildtime dependences are also runtime dependencies
if strings.EqualFold(os.Getenv(constants.InstallBuildDependencies), "true") {
logging.Debug("Installing build dependencies")
if runtimeAndBuildtimeArtifacts == nil {
runtimeAndBuildtimeArtifacts, err = buildplan.NewBuildtimeMap(buildResult.Build)
if err != nil {
return nil, nil, errs.Wrap(err, "Failed to create artifact map from build plan")
}
}
runtimeArtifacts = runtimeAndBuildtimeArtifacts
} else {
runtimeArtifacts, err = buildplan.NewMapFromBuildPlan(buildResult.Build)
if err != nil {
return nil, nil, errs.Wrap(err, "Failed to create artifact map from build plan")
}
}

var setup Setuper
if !buildResult.BuildReady {
setup, err = s.selectSetupImplementation(buildResult.BuildEngine, runtimeAndBuildtimeArtifacts)
Expand Down Expand Up @@ -508,17 +496,16 @@ func (s *Setup) fetchAndInstallArtifactsFromBuildPlan(installFunc artifactInstal
)

artifactsToInstall := []artifact.ArtifactID{}
for _, a := range downloadablePrebuiltResults {
if _, alreadyInstalled := alreadyInstalled[a.ArtifactID]; !alreadyInstalled {
artifactsToInstall = append(artifactsToInstall, a.ArtifactID)
}
}

var artifactsToBuild artifact.Map
if !buildResult.BuildReady {
artifactsToBuild = runtimeAndBuildtimeArtifacts
} else {
if buildResult.BuildReady {
for _, a := range downloadablePrebuiltResults {
if _, alreadyInstalled := alreadyInstalled[a.ArtifactID]; !alreadyInstalled {
artifactsToInstall = append(artifactsToInstall, a.ArtifactID)
}
}
artifactsToBuild = runtimeArtifacts
} else {
artifactsToBuild = runtimeAndBuildtimeArtifacts
}

// The log file we want to use for builds
Expand Down
20 changes: 0 additions & 20 deletions test/integration/checkout_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,26 +244,6 @@ func (suite *CheckoutIntegrationTestSuite) TestCheckoutCaseInsensitive() {
suite.Assert().NotContains(string(bytes), "ACTIVESTATE-CLI/SMALL-PYTHON", "kept incorrect namespace case")
}

func (suite *CheckoutIntegrationTestSuite) TestCheckoutBuildtimeClosure() {
suite.OnlyRunForTags(tagsuite.Checkout)

if runtime.GOOS != "linux" {
suite.T().Skip("Skipping buildtime closure test on non-linux platform")
}

ts := e2e.New(suite.T(), false)
defer ts.Close()

cp := ts.SpawnWithOpts(
e2e.OptArgs("checkout", "ActiveState-CLI/small-python"),
e2e.OptAppendEnv(constants.InstallBuildDependencies+"=true"),
e2e.OptAppendEnv(constants.DisableRuntime+"=false"),
)
// Expect the number of build deps to be 27 which is more than the number of runtime deps.
cp.Expect("27")
cp.ExpectExitCode(0)
}

func TestCheckoutIntegrationTestSuite(t *testing.T) {
suite.Run(t, new(CheckoutIntegrationTestSuite))
}

0 comments on commit 8e87b80

Please sign in to comment.