Files
atlantis/server/events/runtime/runtime_test.go
Luke Kysow 78a2bb519e Set PLANFILE environment variable in run step.
Env var is set to where Atlantis expects the planfile to be.
Fixes #168.
2018-07-07 10:04:49 +02:00

45 lines
793 B
Go

package runtime_test
import (
"fmt"
"testing"
"github.com/runatlantis/atlantis/server/events/runtime"
"github.com/runatlantis/atlantis/server/events/yaml/valid"
. "github.com/runatlantis/atlantis/testing"
)
func TestGetPlanFilename(t *testing.T) {
cases := []struct {
workspace string
maybeCfg *valid.Project
exp string
}{
{
"workspace",
nil,
"workspace.tfplan",
},
{
"workspace",
&valid.Project{},
"workspace.tfplan",
},
{
"workspace",
&valid.Project{
Name: String("project"),
},
"project-workspace.tfplan",
},
}
for i, c := range cases {
t.Run(fmt.Sprintf("case %d", i), func(t *testing.T) {
Equals(t, c.exp, runtime.GetPlanFilename(c.workspace, c.maybeCfg))
})
}
}
func String(v string) *string { return &v }