def test_hive_error_msg(): msg = ( '{...} errorMessage="Error while compiling statement: FAILED: ' "SemanticException [Error 10001]: Line 4" ":5 Table not found 'fact_ridesfdslakj'\", statusCode=3, " "sqlState='42S02', errorCode=10001)){...}" ) assert HiveEngineSpec.extract_error_message(Exception(msg)) == ( "hive error: Error while compiling statement: FAILED: " "SemanticException [Error 10001]: Line 4:5 " "Table not found 'fact_ridesfdslakj'" ) e = Exception("Some string that doesn't match the regex") assert HiveEngineSpec.extract_error_message(e) == f"hive error: {e}" msg = ( "errorCode=10001, " 'errorMessage="Error while compiling statement"), operationHandle' '=None)"' ) assert ( HiveEngineSpec.extract_error_message(Exception(msg)) == "hive error: Error while compiling statement" )
def test_hive_error_msg(self): msg = ('{...} errorMessage="Error while compiling statement: FAILED: ' 'SemanticException [Error 10001]: Line 4' ':5 Table not found \'fact_ridesfdslakj\'", statusCode=3, ' "sqlState='42S02', errorCode=10001)){...}") self.assertEquals(('Error while compiling statement: FAILED: ' 'SemanticException [Error 10001]: Line 4:5 ' "Table not found 'fact_ridesfdslakj'"), HiveEngineSpec.extract_error_message(Exception(msg))) e = Exception("Some string that doesn't match the regex") self.assertEquals(str(e), HiveEngineSpec.extract_error_message(e)) msg = ( 'errorCode=10001, ' 'errorMessage="Error while compiling statement"), operationHandle' '=None)"') self.assertEquals(('Error while compiling statement'), HiveEngineSpec.extract_error_message(Exception(msg)))