@@ -84,6 +84,22 @@ abstract class SpringTestBase : RestTestBase() {
8484 setOption(args, " bbExperiments" , " false" )
8585 }
8686
87+
88+ fun executeAndEvaluateBBTest (
89+ outputFormat : OutputFormat ,
90+ outputFolderName : String ,
91+ iterations : Int ,
92+ timeoutMinutes : Int ,
93+ handleFlakyWithTests : Boolean ,
94+ targetLabel : String ,
95+ lambda : Consumer <MutableList <String >>
96+ ){
97+ executeAndEvaluateBBTest(outputFormat, outputFolderName, iterations, timeoutMinutes,
98+ handleFlakyWithTests,
99+ listOf (targetLabel),
100+ lambda)
101+ }
102+
87103 fun executeAndEvaluateBBTest (
88104 outputFormat : OutputFormat ,
89105 outputFolderName : String ,
@@ -93,6 +109,7 @@ abstract class SpringTestBase : RestTestBase() {
93109 lambda : Consumer <MutableList <String >>
94110 ){
95111 executeAndEvaluateBBTest(outputFormat, outputFolderName, iterations, timeoutMinutes,
112+ false ,
96113 listOf (targetLabel),
97114 lambda)
98115 }
@@ -104,16 +121,33 @@ abstract class SpringTestBase : RestTestBase() {
104121 timeoutMinutes : Int ,
105122 targetLabels : Collection <String >,
106123 lambda : Consumer <MutableList <String >>
124+ ){
125+ executeAndEvaluateBBTest(outputFormat, outputFolderName, iterations, timeoutMinutes,
126+ false ,
127+ targetLabels,
128+ lambda)
129+ }
130+
131+ fun executeAndEvaluateBBTest (
132+ outputFormat : OutputFormat ,
133+ outputFolderName : String ,
134+ iterations : Int ,
135+ timeoutMinutes : Int ,
136+ handleFlakyWithTests : Boolean ,
137+ targetLabels : Collection <String >,
138+ lambda : Consumer <MutableList <String >>
107139 ){
108140 assumeTrue(outputFormat != OutputFormat .DEFAULT )
109141
110142 assertFalse(CoveredTargets .areCovered(targetLabels))
111- runBlackBoxEM(outputFormat, outputFolderName, iterations, timeoutMinutes, lambda)
143+ runBlackBoxEM(outputFormat, outputFolderName, iterations, timeoutMinutes, handleFlakyWithTests, lambda)
112144 BlackBoxUtils .checkCoveredTargets(targetLabels)
113145
114- CoveredTargets .reset()
115- runGeneratedTests(outputFormat, outputFolderName)
116- BlackBoxUtils .checkCoveredTargets(targetLabels)
146+ if (! handleFlakyWithTests){
147+ CoveredTargets .reset()
148+ runGeneratedTests(outputFormat, outputFolderName)
149+ BlackBoxUtils .checkCoveredTargets(targetLabels)
150+ }
117151 }
118152
119153
@@ -122,6 +156,7 @@ abstract class SpringTestBase : RestTestBase() {
122156 outputFolderName : String ,
123157 iterations : Int ,
124158 timeoutMinutes : Int ,
159+ handleFlakyWithTests : Boolean ,
125160 lambda : Consumer <MutableList <String >>
126161 ){
127162 val baseLocation = when {
@@ -131,7 +166,7 @@ abstract class SpringTestBase : RestTestBase() {
131166 outputFormat.isKotlin() -> BlackBoxUtils .baseLocationForKotlin
132167 else -> throw IllegalArgumentException (" Not supported output type $outputFormat " )
133168 }
134- runTestForNonJVM(outputFormat, baseLocation, outputFolderName, iterations, timeoutMinutes, lambda)
169+ runTestForNonJVM(outputFormat, baseLocation, outputFolderName, iterations, timeoutMinutes, handleFlakyWithTests, lambda)
135170 }
136171
137172 fun runGeneratedTests (outputFormat : OutputFormat , outputFolderName : String ){
@@ -152,6 +187,7 @@ abstract class SpringTestBase : RestTestBase() {
152187 outputFolderName : String ,
153188 iterations : Int ,
154189 timeoutMinutes : Int ,
190+ handleFlakyWithTests : Boolean ,
155191 lambda : Consumer <MutableList <String >>
156192 ) {
157193 val folder = if (outputFormat.isJavaOrKotlin()){
@@ -185,6 +221,11 @@ abstract class SpringTestBase : RestTestBase() {
185221
186222 defaultSeed++
187223 lambda.accept(ArrayList (args))
224+
225+ if (handleFlakyWithTests){
226+ CoveredTargets .reset()
227+ runGeneratedTests(outputFormat, outputFolderName)
228+ }
188229 }
189230 }
190231 }
0 commit comments