mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-04 23:08:40 +00:00
* added new flags `plan-backend`, `plan-s3-bucket`, `plan-s3-prefix` and deleted `s3-bucket` * interface `plan.Backend` that is implemented by `file` and `s3` * simplified s3 code * didn't end up following my suggestions in #30 since storing stuff in metadata requires you to `Get` the object *first* and then use the metadata. By parsing the `Key` to get repo, pull, path, and env, it skips an initial `Get` step, and I can download directly to the correct directory * allow users to specify `application/json` or `application/x-www-form-urlencoded` for the webhook delivery type * remove sending of special header for pull request api (fixes #11) Closes #30 and #17 and #11
28 lines
1.2 KiB
Go
28 lines
1.2 KiB
Go
package server
|
|
|
|
import (
|
|
. "github.com/hootsuite/atlantis/testing_util"
|
|
"testing"
|
|
)
|
|
|
|
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)
|
|
}
|
|
}
|