@@ -207,11 +207,7 @@ abstract class HiveComparisonTest
207207 }
208208
209209 val installHooksCommand = " (?i)SET.*hooks" .r
210- def createQueryTest (
211- testCaseName : String ,
212- sql : String ,
213- reset : Boolean = true ,
214- tryWithoutResettingFirst : Boolean = false ) {
210+ def createQueryTest (testCaseName : String , sql : String , reset : Boolean = true ) {
215211 // testCaseName must not contain ':', which is not allowed to appear in a filename of Windows
216212 assert(! testCaseName.contains(" :" ))
217213
@@ -242,6 +238,9 @@ abstract class HiveComparisonTest
242238 test(testCaseName) {
243239 logDebug(s " === HIVE TEST: $testCaseName === " )
244240
241+ // Clear old output for this testcase.
242+ outputDirectories.map(new File (_, testCaseName)).filter(_.exists()).foreach(_.delete())
243+
245244 val sqlWithoutComment =
246245 sql.split(" \n " ).filterNot(l => l.matches(" --.*(?<=[^\\\\ ]);" )).mkString(" \n " )
247246 val allQueries =
@@ -268,10 +267,7 @@ abstract class HiveComparisonTest
268267 }.mkString(" \n == Console version of this test ==\n " , " \n " , " \n " )
269268 }
270269
271- def doTest (reset : Boolean , isSpeculative : Boolean = false ): Unit = {
272- // Clear old output for this testcase.
273- outputDirectories.map(new File (_, testCaseName)).filter(_.exists()).foreach(_.delete())
274-
270+ try {
275271 if (reset) {
276272 TestHive .reset()
277273 }
@@ -394,36 +390,12 @@ abstract class HiveComparisonTest
394390 """ .stripMargin
395391
396392 stringToFile(new File (wrongDirectory, testCaseName), errorMessage + consoleTestCase)
397- if (isSpeculative && ! reset) {
398- // TODO: log this at a very low level that won't appear in the console appender
399- // then throw a custom exception
400- fail(" Failed on first run; retrying" )
401- } else {
402- fail(errorMessage)
403- }
393+ fail(errorMessage)
404394 }
405395 }
406396
407397 // Touch passed file.
408398 new FileOutputStream (new File (passedDirectory, testCaseName)).close()
409- }
410-
411- try {
412- try {
413- if (tryWithoutResettingFirst) {
414- doTest(reset = false , isSpeculative = true )
415- } else {
416- doTest(reset)
417- }
418- } catch {
419- case tf : org.scalatest.exceptions.TestFailedException =>
420- if (tryWithoutResettingFirst) {
421- logWarning(" Test failed without reset(); retrying with reset()" )
422- doTest(reset = true )
423- } else {
424- throw tf
425- }
426- }
427399 } catch {
428400 case tf : org.scalatest.exceptions.TestFailedException => throw tf
429401 case originalException : Exception =>
0 commit comments