mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-29 16:58:24 +00:00
* Return error if workspace doesn't exist * Default data dir to ~/.atlantis. Don't clean workspaces * Run goimports
29 lines
1.2 KiB
Go
29 lines
1.2 KiB
Go
package server
|
|
|
|
import (
|
|
"testing"
|
|
|
|
. "github.com/hootsuite/atlantis/testing_util"
|
|
)
|
|
|
|
var p PlanExecutor
|
|
|
|
func TestModifiedProjects(t *testing.T) {
|
|
runTest(t, "should handle no files modified", []string{}, []string{})
|
|
runTest(t, "should handle files at root", []string{"root.tf"}, []string{"."})
|
|
runTest(t, "should de-duplicate files at root", []string{"root1.tf", "root2.tf"}, []string{"."})
|
|
runTest(t, "should handle sub directories", []string{"sub/dir/file.tf"}, []string{"sub/dir"})
|
|
runTest(t, "should de-duplicate files in sub directories", []string{"sub/dir/file.tf", "sub/dir/file2.tf"}, []string{"sub/dir"})
|
|
runTest(t, "should handle nested sub directories", []string{"root.tf", "sub/child.tf", "sub/sub/child.tf"}, []string{".", "sub", "sub/sub"})
|
|
runTest(t, "should use parent of env/ dirs", []string{"env/env.tf"}, []string{"."})
|
|
runTest(t, "should use parent of env/ dirs in sub dirs", []string{"sub/env/env.tf"}, []string{"sub"})
|
|
}
|
|
|
|
func runTest(t *testing.T, testDescrip string, filesChanged []string, expectedPaths []string) {
|
|
projects := p.ModifiedProjects("owner/repo", filesChanged)
|
|
for i, p := range projects {
|
|
t.Log(testDescrip)
|
|
Equals(t, expectedPaths[i], p.Path)
|
|
}
|
|
}
|