@@ -47,6 +47,7 @@ const (
47
47
suffixOutFileDiffEndpoints = "endpointsDiff"
48
48
suffixOutFileExplain = "explain"
49
49
suffixOutFileDetail = "_detail"
50
+ consistencyEdgesExternal = "_EdgeConsistent"
50
51
txtOutSuffix = ".txt"
51
52
mdOutSuffix = ".md"
52
53
JSONOutSuffix = ".json"
@@ -86,6 +87,7 @@ func getTestFileName(testName string,
86
87
grouping bool ,
87
88
noLbAbstract bool ,
88
89
detailExplain bool ,
90
+ addConsistencyEdgesExternal bool ,
89
91
format vpcmodel.OutFormat ,
90
92
configName string ,
91
93
allVPCs bool ,
@@ -128,6 +130,9 @@ func getTestFileName(testName string,
128
130
if detailExplain {
129
131
res += suffixOutFileDetail
130
132
}
133
+ if addConsistencyEdgesExternal {
134
+ res += consistencyEdgesExternal
135
+ }
131
136
if ! allVPCs {
132
137
res += strings .ReplaceAll (strings .Join (vpcIDs , "" ), ":" , "" )
133
138
}
@@ -174,9 +179,10 @@ func (tt *VpcTestCommon) initTest() {
174
179
}
175
180
176
181
func (tt * VpcTestCommon ) initTestFileNames (uc vpcmodel.OutputUseCase ,
177
- vpcName string , allVPCs , detailExplain bool , testDirOut string , grouping , noLbAbstract bool ) error {
182
+ vpcName string , allVPCs , detailExplain bool , testDirOut string , grouping , noLbAbstract ,
183
+ addConsistencyEdgesExternal bool ) error {
178
184
expectedFileName , actualFileName , err := getTestFileName (
179
- tt .Name , uc , grouping , noLbAbstract , detailExplain , tt .Format , vpcName , allVPCs , tt .VpcList )
185
+ tt .Name , uc , grouping , noLbAbstract , detailExplain , addConsistencyEdgesExternal , tt .Format , vpcName , allVPCs , tt .VpcList )
180
186
if err != nil {
181
187
return err
182
188
}
@@ -191,17 +197,23 @@ func (tt *VpcTestCommon) runTestPerUseCase(t *testing.T,
191
197
uc vpcmodel.OutputUseCase ,
192
198
mode testMode ,
193
199
outDir string ,
194
- grouping , noLbAbstract bool ,
200
+ groupingType int ,
201
+ noLbAbstract bool ,
195
202
explanationArgs * vpcmodel.ExplanationArgs ) error {
196
203
detailExplain := false
197
204
if explanationArgs != nil {
198
205
detailExplain = explanationArgs .Detail
199
206
}
200
207
allVpcs := len (tt .VpcList ) == 0
201
- if err := tt .initTestFileNames (uc , "" , allVpcs , detailExplain , outDir , grouping , noLbAbstract ); err != nil {
208
+ grouping := groupingType == vpcmodel .GroupingNoConsistencyEdges ||
209
+ groupingType == vpcmodel .GroupingWithConsistencyEdges
210
+ addConsistencyEdgesExternal := groupingType == vpcmodel .NoGroupingWithConsistencyEdges ||
211
+ groupingType == vpcmodel .GroupingWithConsistencyEdges
212
+ if err := tt .initTestFileNames (uc , "" , allVpcs , detailExplain , outDir , grouping , noLbAbstract ,
213
+ addConsistencyEdgesExternal ); err != nil {
202
214
return err
203
215
}
204
- og , err := vpcmodel .NewOutputGenerator (cConfigs , grouping , uc , tt .Format == vpcmodel .ARCHDRAWIO ,
216
+ og , err := vpcmodel .NewOutputGenerator (cConfigs , groupingType , uc , tt .Format == vpcmodel .ARCHDRAWIO ,
205
217
explanationArgs , tt .Format , ! noLbAbstract )
206
218
if err != nil {
207
219
return err
@@ -326,7 +338,7 @@ func (tt *VpcTestCommon) setMode(mode testMode) {
326
338
}
327
339
328
340
func (tt * VpcTestCommon ) runSingleCommonTest (t * testing.T , testDir string , rc commonvpc.ResourcesContainer ,
329
- grouping , noLbAbstract bool , explanationArgs * vpcmodel.ExplanationArgs ) {
341
+ groupingType int , noLbAbstract bool , explanationArgs * vpcmodel.ExplanationArgs ) {
330
342
// init test - set the input/output file names according to test name
331
343
tt .initTest ()
332
344
@@ -335,7 +347,8 @@ func (tt *VpcTestCommon) runSingleCommonTest(t *testing.T, testDir string, rc co
335
347
336
348
// generate actual output for all use cases specified for this test
337
349
for _ , uc := range tt .UseCases {
338
- err := tt .runTestPerUseCase (t , vpcConfigs , uc , tt .Mode , testDir , grouping , noLbAbstract , explanationArgs )
350
+ err := tt .runTestPerUseCase (t , vpcConfigs , uc , tt .Mode , testDir , groupingType , noLbAbstract ,
351
+ explanationArgs )
339
352
require .Equal (t , tt .ErrPerUseCase [uc ], err , "comparing actual err to expected err" )
340
353
}
341
354
for uc , outFile := range tt .ActualOutput {
0 commit comments