Fixed RE-SQL test cases failed due to the previous commit.

Introduces a new key - replace_regex_pattern to synchronize the
expected SQL with the backend SQL based on the regex string
This commit is contained in:
Aditya Toshniwal 2020-08-27 19:08:00 +05:30 committed by Akshay Joshi
parent 53a5410337
commit 28b637c99c
3 changed files with 13 additions and 4 deletions

View File

@ -81,7 +81,8 @@
"expected_sql_file": "alter_role_options2.sql",
"expected_msql_file": "alter_role_options2.msql",
"convert_timestamp_columns": ["rolvaliduntil"],
"replace_password": true
"replace_password": true,
"replace_regex_pattern": ["VALID UNTIL '[0-9\\-T:+ ]*'"]
},
{
"type": "alter",
@ -95,7 +96,8 @@
"expected_sql_file": "alter_role_options3.sql",
"expected_msql_file": "alter_role_options3.msql",
"convert_timestamp_columns": ["rolvaliduntil"],
"replace_password": true
"replace_password": true,
"replace_regex_pattern": ["VALID UNTIL '[0-9\\-T:+ ]*'"]
},
{
"type": "alter",
@ -112,7 +114,8 @@
"expected_sql_file": "alter_role_options4.sql",
"expected_msql_file": "alter_role_options4.msql",
"convert_timestamp_columns": ["rolvaliduntil"],
"replace_password": true
"replace_password": true,
"replace_regex_pattern": ["VALID UNTIL '[0-9\\-T:+ ]*'"]
},
{
"type": "delete",

View File

@ -45,7 +45,7 @@
z-index: 5;
}
}
&.ajs-frameless,
&.ajs-frameless {
& .ajs-body {
& .ajs-content {

View File

@ -702,6 +702,12 @@ class ReverseEngineeredSQLTestCases(BaseTestGenerator):
sql = sql.replace(self.JSON_PLACEHOLDERS['password'], password)
if 'replace_regex_pattern' in scenario:
for a_patten in scenario['replace_regex_pattern']:
found = re.findall(a_patten, resp_sql)
if len(found) > 0:
sql = re.sub(a_patten, found[0], sql)
# Replace place holder <owner> with the current username
# used to connect to the database
if 'pga_job_id' in scenario: