mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-05 10:28:34 +00:00
Add -var test.
This commit is contained in:
@@ -68,10 +68,21 @@ func TestGitHubWorkflow(t *testing.T) {
|
||||
},
|
||||
ExpMergeCommentFile: "exp-output-merge.txt",
|
||||
},
|
||||
{
|
||||
Description: "simple with comment -var",
|
||||
RepoDir: "simple",
|
||||
ModifiedFiles: []string{"main.tf"},
|
||||
ExpAutoplanCommentFile: "exp-output-autoplan.txt",
|
||||
CommentAndReplies: []string{
|
||||
"atlantis plan -- -var var=overridden", "exp-output-atlantis-plan-var.txt",
|
||||
"atlantis apply", "exp-output-apply-var.txt",
|
||||
},
|
||||
ExpMergeCommentFile: "exp-output-merge.txt",
|
||||
},
|
||||
}
|
||||
for _, c := range cases {
|
||||
ctrl, vcsClient, githubGetter, atlantisWorkspace := setupE2E(t)
|
||||
t.Run(c.Description, func(t *testing.T) {
|
||||
ctrl, vcsClient, githubGetter, atlantisWorkspace := setupE2E(t)
|
||||
// Set the repo to be cloned through the testing backdoor.
|
||||
repoDir, cleanup := initializeRepo(t, c.RepoDir)
|
||||
defer cleanup()
|
||||
@@ -100,7 +111,7 @@ func TestGitHubWorkflow(t *testing.T) {
|
||||
w = httptest.NewRecorder()
|
||||
ctrl.Post(w, commentReq)
|
||||
responseContains(t, w, 200, "Processing...")
|
||||
_, _, atlantisComment := vcsClient.VerifyWasCalled(Twice()).CreateComment(AnyRepo(), AnyInt(), AnyString()).GetCapturedArguments()
|
||||
_, _, atlantisComment := vcsClient.VerifyWasCalled(Times((i/2)+2)).CreateComment(AnyRepo(), AnyInt(), AnyString()).GetCapturedArguments()
|
||||
|
||||
exp, err = ioutil.ReadFile(filepath.Join(repoDir, expOutputFile))
|
||||
Ok(t, err)
|
||||
@@ -115,7 +126,8 @@ func TestGitHubWorkflow(t *testing.T) {
|
||||
w = httptest.NewRecorder()
|
||||
ctrl.Post(w, pullClosedReq)
|
||||
responseContains(t, w, 200, "Pull request cleaned successfully")
|
||||
_, _, pullClosedComment := vcsClient.VerifyWasCalled(Times(3)).CreateComment(AnyRepo(), AnyInt(), AnyString()).GetCapturedArguments()
|
||||
numPrevComments := (len(c.CommentAndReplies) / 2) + 1
|
||||
_, _, pullClosedComment := vcsClient.VerifyWasCalled(Times(numPrevComments+1)).CreateComment(AnyRepo(), AnyInt(), AnyString()).GetCapturedArguments()
|
||||
exp, err = ioutil.ReadFile(filepath.Join(repoDir, c.ExpMergeCommentFile))
|
||||
Ok(t, err)
|
||||
Equals(t, string(exp), pullClosedComment)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
Ran Apply in dir: `.` workspace: `default`
|
||||
```diff
|
||||
null_resource.simple: Creating...
|
||||
null_resource.simple: Creation complete after 0s (ID: ******************)
|
||||
|
||||
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
|
||||
|
||||
Outputs:
|
||||
|
||||
this = overridden
|
||||
|
||||
```
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
Ran Plan in dir: `.` workspace: `default`
|
||||
```diff
|
||||
Refreshing Terraform state in-memory prior to plan...
|
||||
The refreshed state will be used to calculate this plan, but will not be
|
||||
persisted to local or remote state storage.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
An execution plan has been generated and is shown below.
|
||||
Resource actions are indicated with the following symbols:
|
||||
+ create
|
||||
|
||||
Terraform will perform the following actions:
|
||||
|
||||
+ null_resource.simple
|
||||
id: <computed>
|
||||
Plan: 1 to add, 0 to change, 0 to destroy.
|
||||
|
||||
```
|
||||
|
||||
* To **discard** this plan click [here](lock-url).
|
||||
|
||||
Reference in New Issue
Block a user