Skip to content

Commit

Permalink
rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
msarvar committed Sep 27, 2021
1 parent 2a3c948 commit 29a6837
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 24 deletions.
2 changes: 1 addition & 1 deletion server/controllers/events/events_controller_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ func TestSimlpleWorkflow_terraformLockFile(t *testing.T) {
userConfig = server.UserConfig{}
userConfig.DisableApply = true

ctrl, vcsClient, githubGetter, atlantisWorkspace := setupE2E(t, c.RepoDir)
ctrl, vcsClient, githubGetter, atlantisWorkspace, _ := setupE2E(t, c.RepoDir)
// Set the repo to be cloned through the testing backdoor.
repoDir, headSHA, cleanup := initializeRepo(t, c.RepoDir)
defer cleanup()
Expand Down
1 change: 0 additions & 1 deletion server/controllers/logstreaming_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/gorilla/websocket"
"github.com/runatlantis/atlantis/server/controllers/templates"
"github.com/runatlantis/atlantis/server/core/db"
"github.com/runatlantis/atlantis/server/events/models"
"github.com/runatlantis/atlantis/server/handlers"
"github.com/runatlantis/atlantis/server/logging"
)
Expand Down
25 changes: 9 additions & 16 deletions server/core/runtime/init_step_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,17 @@ func TestRun_InitOmitsUpgradeFlagIfLockFileTracked(t *testing.T) {
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)

<<<<<<< HEAD:server/core/runtime/init_step_runner_test.go
output, err := iso.Run(models.ProjectCommandContext{
Workspace: "workspace",
RepoRelDir: ".",
Log: logger,
}, []string{"extra", "args"}, repoDir, map[string]string(nil))
=======
output, err := iso.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil))
>>>>>>> 47798014... Orca 845 (#89):server/events/runtime/init_step_runner_test.go
Ok(t, err)
// When there is no error, should not return init output to PR.
Equals(t, "", output)

expectedArgs := []string{"init", "-input=false", "-no-color", "extra", "args"}
<<<<<<< HEAD:server/core/runtime/init_step_runner_test.go
terraform.VerifyWasCalledOnce().RunCommandWithVersion(logger, repoDir, expectedArgs, map[string]string(nil), tfVersion, "workspace")
=======
terraform.VerifyWasCalledOnce().RunCommandWithVersion(ctx, tmpDir, expectedArgs, map[string]string(nil), tfVersion, "workspace")
>>>>>>> 47798014... Orca 845 (#89):server/events/runtime/init_step_runner_test.go
terraform.VerifyWasCalledOnce().RunCommandWithVersion(ctx, repoDir, expectedArgs, map[string]string(nil), tfVersion, "workspace")
}

func TestRun_InitKeepsUpgradeFlagIfLockFileNotPresent(t *testing.T) {
Expand Down Expand Up @@ -299,24 +291,25 @@ func TestRun_InitDeletesLockFileIfPresentAndNotTracked(t *testing.T) {
logger := logging.NewNoopLogger(t)

tfVersion, _ := version.NewVersion("0.14.0")
ctx := models.ProjectCommandContext{
Workspace: "workspace",
RepoRelDir: ".",
Log: logger,
}
iso := runtime.InitStepRunner{
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
}
When(terraform.RunCommandWithVersion(logging_matchers.AnyLoggingSimpleLogging(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
When(terraform.RunCommandWithVersion(matchers.AnyModelsProjectCommandContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)

output, err := iso.Run(models.ProjectCommandContext{
Workspace: "workspace",
RepoRelDir: ".",
Log: logger,
}, []string{"extra", "args"}, repoDir, map[string]string(nil))
output, err := iso.Run(ctx, []string{"extra", "args"}, repoDir, map[string]string(nil))
Ok(t, err)
// When there is no error, should not return init output to PR.
Equals(t, "", output)

expectedArgs := []string{"init", "-input=false", "-no-color", "-upgrade", "extra", "args"}
terraform.VerifyWasCalledOnce().RunCommandWithVersion(logger, repoDir, expectedArgs, map[string]string(nil), tfVersion, "workspace")
terraform.VerifyWasCalledOnce().RunCommandWithVersion(ctx, repoDir, expectedArgs, map[string]string(nil), tfVersion, "workspace")
}

func runCmd(t *testing.T, dir string, name string, args ...string) string {
Expand Down
2 changes: 1 addition & 1 deletion server/core/runtime/version_step_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ func (v *VersionStepRunner) Run(ctx models.ProjectCommandContext, extraArgs []st
}

versionCmd := []string{"version"}
return v.TerraformExecutor.RunCommandWithVersion(ctx.Log, filepath.Clean(path), versionCmd, envs, tfVersion, ctx.Workspace)
return v.TerraformExecutor.RunCommandWithVersion(ctx, filepath.Clean(path), versionCmd, envs, tfVersion, ctx.Workspace)
}
2 changes: 1 addition & 1 deletion server/core/runtime/version_step_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestRunVersionStep(t *testing.T) {

t.Run("ensure runs", func(t *testing.T) {
_, err := s.Run(context, []string{}, tmpDir, map[string]string(nil))
terraform.VerifyWasCalledOnce().RunCommandWithVersion(logger, tmpDir, []string{"version"}, map[string]string(nil), tfVersion, "default")
terraform.VerifyWasCalledOnce().RunCommandWithVersion(context, tmpDir, []string{"version"}, map[string]string(nil), tfVersion, "default")
Ok(t, err)
})
}
2 changes: 0 additions & 2 deletions server/events/apply_command_runner.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package events

import (
"strings"

"github.com/runatlantis/atlantis/server/core/db"
"github.com/runatlantis/atlantis/server/core/locking"
"github.com/runatlantis/atlantis/server/events/models"
Expand Down
2 changes: 0 additions & 2 deletions server/events/apply_requirement_handler.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package events

import (
"github.com/pkg/errors"
"github.com/runatlantis/atlantis/server/core/runtime"
"github.com/runatlantis/atlantis/server/events/models"
"github.com/runatlantis/atlantis/server/events/yaml/raw"
"github.com/runatlantis/atlantis/server/events/yaml/valid"
Expand Down
3 changes: 3 additions & 0 deletions server/events/project_command_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,7 @@ func TestDefaultProjectCommandBuilder_BuildVersionCommand(t *testing.T) {
ThenReturn(tmpDir, nil)

logger := logging.NewNoopLogger(t)
scope := stats.NewStore(stats.NewNullSink(), false)

globalCfgArgs := valid.GlobalCfgArgs{
AllowRepoCfg: false,
Expand All @@ -1219,6 +1220,8 @@ func TestDefaultProjectCommandBuilder_BuildVersionCommand(t *testing.T) {
false,
false,
"**/*.tf,**/*.tfvars,**/*.tfvars.json,**/terragrunt.hcl",
scope,
logger,
)

ctxs, err := builder.BuildVersionCommands(
Expand Down
1 change: 1 addition & 0 deletions server/events/project_command_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ type DefaultProjectCommandRunner struct { //create object and test
InitStepRunner StepRunner
PlanStepRunner StepRunner
ShowStepRunner StepRunner
VersionStepRunner StepRunner
ApplyStepRunner StepRunner
PolicyCheckStepRunner StepRunner
RunStepRunner CustomStepRunner
Expand Down

0 comments on commit 29a6837

Please sign in to comment.