@@ -32,6 +32,8 @@ import (
32
32
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
33
33
)
34
34
35
+ const diffTag = "[Diff]"
36
+
35
37
func isReleaseDiffEnabled () bool {
36
38
releaseDiff := os .Getenv ("RELEASE_DIFF" )
37
39
return releaseDiff != ""
@@ -94,7 +96,7 @@ func InsertDiffSteps(c resource.TestCase, tempOutputFile *os.File, releaseProvid
94
96
testStep .Config = ReformConfigWithProvider (ogConfig , localProviderName )
95
97
fmt .Fprintf (tempOutputFile , "[DEBUG] Reformatted config: %s\n " , testStep .Config )
96
98
testStep .PreConfig = func () {
97
- fmt .Fprintf (tempOutputFile , "%s Step %d\n " , diffFlag , countSteps )
99
+ fmt .Fprintf (tempOutputFile , "%s Step %d\n " , diffTag , countSteps )
98
100
}
99
101
if testStep .ExpectError == nil && ! testStep .PlanOnly {
100
102
newStep := resource.TestStep {
@@ -170,7 +172,7 @@ func ParseReleaseDiffOutput(output string) (isDiff bool) {
170
172
lines := strings .Split (trimmedOutput , "\n " )
171
173
lastLine := lines [len (lines )- 1 ]
172
174
173
- isDiff = strings .HasPrefix (lastLine , diffFlag )
175
+ isDiff = strings .HasPrefix (lastLine , diffTag )
174
176
175
177
return isDiff
176
178
}
@@ -208,8 +210,8 @@ func writeOutputFileDeferFunction(tempOutputFile *os.File, failed bool) {
208
210
if failed {
209
211
// Check if the output line starts with "[Diff]"
210
212
if isDiff {
211
- fmt .Fprintf (os .Stdout , "%s Breaking Change Detected] \n " , diffFlag )
212
- fmt .Fprintf (diffFailureFile , "%s %s\n " , diffFlag , testOutput )
213
+ fmt .Fprintf (os .Stdout , "%s Breaking Change Detected] \n " , diffTag )
214
+ fmt .Fprintf (diffFailureFile , "%s %s\n " , diffTag , testOutput )
213
215
} else {
214
216
fmt .Fprintf (regularFailureFile , testOutput )
215
217
fmt .Fprintf (regularFailureFile , "FAILED --- %s\n " , testOutput )
0 commit comments