Skip to content

Commit

Permalink
fix: terraform recipe unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
huf1 committed Jun 30, 2022
1 parent f837994 commit 0975779
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/recipes/terraform/terraform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ func Test_DeployFlow(t *testing.T) {
// then the user confirmation is expected
executor.On("AskUserToConfirm", mock.Anything).Once()

// then the plan json will be created
executor.On("Execute", mock.MatchedBy(func(command string) bool {
return strings.Contains(command, "show -json") && strings.Contains(command, "test.deploy.tfplan")
})).Once()

// then the fully apply is expected
executor.On("Execute", mock.MatchedBy(func(command string) bool {
return strings.Contains(command, "apply -auto-approve") && strings.Contains(command, "test.deploy.tfplan")
Expand All @@ -121,6 +126,11 @@ func Test_DeployFlow(t *testing.T) {
executor.On("Execute", mock.MatchedBy(func(command string) bool {
return strings.Contains(command, "plan -input=false") && strings.Contains(command, "test.deploy.tfplan")
})).Once()

// then the plan json will be created
executor.On("Execute", mock.MatchedBy(func(command string) bool {
return strings.Contains(command, "show -json") && strings.Contains(command, "test.deploy.tfplan")
})).Once()
},
true,
false,
Expand Down

0 comments on commit 0975779

Please sign in to comment.