Hi,

Problem doesn't seem to go away for the newly added test cases. The default
roles like pg_monitor, etc. do not exist for PG9.6 and below, and so the
RESQL test cases are failing :(.
I've modified the test cases to add 2 new roles for testing and then drop
them later.

Please review.


On Thu, Aug 27, 2020 at 7:22 PM Akshay Joshi <akshay.jo...@enterprisedb.com>
wrote:

> Thanks, patch applied.
>
> On Thu, Aug 27, 2020 at 4:31 PM Aditya Toshniwal <
> aditya.toshni...@enterprisedb.com> wrote:
>
>> Hi Hackers,
>>
>> Attached patch introduces a new key - replace_regex_pattern for RE-SQL
>> test cases. It will synchronize the expected SQL with the backend SQL based
>> on the regex string.
>> This will help fix the timezone mismatch issue occurring in RESQL test
>> cases for roles.
>> Please review.
>>
>>
>> On Thu, Aug 27, 2020 at 10:12 AM Aditya Toshniwal <
>> aditya.toshni...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>
>>> I'll look into it.
>>>
>>> On Thu, Aug 27, 2020 at 2:41 PM Murtuza Zabuawala <
>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> RE-SQL test for the role node is failing if the timezone of DB is
>>>> different.
>>>>
>>>> Traceback (most recent call last):
>>>>   File
>>>> "/home/murtuza/projects/PEM/web/regression/re_sql/tests/test_resql.py",
>>>> line 500, in check_re_sql
>>>>     self.assertEquals(sql, resp_sql)
>>>>   File "/usr/lib/python3.6/unittest/case.py", line 1321, in
>>>> deprecated_func
>>>>     return original_func(*args, **kwargs)
>>>>   File "/usr/lib/python3.6/unittest/case.py", line 829, in assertEqual
>>>>     assertion_func(first, second, msg=msg)
>>>>   File "/usr/lib/python3.6/unittest/case.py", line 1203, in
>>>> assertMultiLineEqual
>>>>     self.fail(self._formatMessage(msg, standardMsg))
>>>>   File "/usr/lib/python3.6/unittest/case.py", line 670, in fail
>>>>     raise self.failureException(msg)
>>>> AssertionError: '-- R[313 chars] \'2050-01-01
>>>> 00:00:00+05:30\';\n\nGRANT pg_si[300 chars]n\';' != '-- R[313 chars]
>>>> \'2049-12-31 10:30:00-08\';\n\nGRANT pg_signa[297 chars]n\';'
>>>>   -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
>>>>   -- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
>>>>
>>>>   CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
>>>>     NOLOGIN
>>>>     SUPERUSER
>>>>     INHERIT
>>>>     CREATEDB
>>>>     NOCREATEROLE
>>>>     NOREPLICATION
>>>>     CONNECTION LIMIT 100
>>>>     ENCRYPTED PASSWORD 'md5cc9a2576a43b841dcacea0f65d961e41'
>>>> -   VALID UNTIL '2050-01-01 00:00:00+05:30';
>>>> +   VALID UNTIL '2049-12-31 10:30:00-08';
>>>>
>>>>   GRANT pg_signal_backend TO "Role2_$%{}[]()&*^!@""'`\/#";
>>>>   GRANT pg_monitor TO "Role2_$%{}[]()&*^!@""'`\/#" WITH ADMIN OPTION;
>>>>
>>>>   ALTER ROLE "Role2_$%{}[]()&*^!@""'`\/#" IN DATABASE postgres SET
>>>> application_name TO 'pg4';
>>>>
>>>>   COMMENT ON ROLE "Role2_$%{}[]()&*^!@""'`\/#" IS 'This is detailed
>>>> description';
>>>> Alter Role options 2  Expected SQL File:alter_role_options2.sql... FAIL
>>>> Alter Role options 3 (MSQL) ... ok
>>>> Traceback (most recent call last):
>>>>   File
>>>> "/home/murtuza/projects/PEM/web/regression/re_sql/tests/test_resql.py",
>>>> line 500, in check_re_sql
>>>>     self.assertEquals(sql, resp_sql)
>>>>   File "/usr/lib/python3.6/unittest/case.py", line 1321, in
>>>> deprecated_func
>>>>     return original_func(*args, **kwargs)
>>>>   File "/usr/lib/python3.6/unittest/case.py", line 829, in assertEqual
>>>>     assertion_func(first, second, msg=msg)
>>>>   File "/usr/lib/python3.6/unittest/case.py", line 1203, in
>>>> assertMultiLineEqual
>>>>     self.fail(self._formatMessage(msg, standardMsg))
>>>>   File "/usr/lib/python3.6/unittest/case.py", line 670, in fail
>>>>     raise self.failureException(msg)
>>>> AssertionError: '-- R[313 chars] \'2050-01-01
>>>> 00:00:00+05:30\';\n\nGRANT pg_mo[240 chars]n\';' != '-- R[313 chars]
>>>> \'2049-12-31 10:30:00-08\';\n\nGRANT pg_monit[237 chars]n\';'
>>>>   -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
>>>>   -- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
>>>>
>>>>   CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
>>>>     NOLOGIN
>>>>     SUPERUSER
>>>>     INHERIT
>>>>     CREATEDB
>>>>     NOCREATEROLE
>>>>     NOREPLICATION
>>>>     CONNECTION LIMIT 100
>>>>     ENCRYPTED PASSWORD 'md5cc9a2576a43b841dcacea0f65d961e41'
>>>> -   VALID UNTIL '2050-01-01 00:00:00+05:30';
>>>> +   VALID UNTIL '2049-12-31 10:30:00-08';
>>>>
>>>>   GRANT pg_monitor TO "Role2_$%{}[]()&*^!@""'`\/#" WITH ADMIN OPTION;
>>>>
>>>>   ALTER ROLE "Role2_$%{}[]()&*^!@""'`\/#" IN DATABASE postgres SET
>>>> application_name TO 'pg4';
>>>>
>>>>   COMMENT ON ROLE "Role2_$%{}[]()&*^!@""'`\/#" IS 'This is detailed
>>>> description';
>>>> Alter Role options 3  Expected SQL File:alter_role_options3.sql... FAIL
>>>> Alter Role options 4 (MSQL) ... ok
>>>> Traceback (most recent call last):
>>>>   File
>>>> "/home/murtuza/projects/PEM/web/regression/re_sql/tests/test_resql.py",
>>>> line 500, in check_re_sql
>>>>     self.assertEquals(sql, resp_sql)
>>>>   File "/usr/lib/python3.6/unittest/case.py", line 1321, in
>>>> deprecated_func
>>>>     return original_func(*args, **kwargs)
>>>>   File "/usr/lib/python3.6/unittest/case.py", line 829, in assertEqual
>>>>     assertion_func(first, second, msg=msg)
>>>>   File "/usr/lib/python3.6/unittest/case.py", line 1203, in
>>>> assertMultiLineEqual
>>>>     self.fail(self._formatMessage(msg, standardMsg))
>>>>   File "/usr/lib/python3.6/unittest/case.py", line 670, in fail
>>>>     raise self.failureException(msg)
>>>> AssertionError: '-- R[313 chars] \'2050-01-01
>>>> 00:00:00+05:30\';\n\nGRANT pg_mo[259 chars]n\';' != '-- R[313 chars]
>>>> \'2049-12-31 10:30:00-08\';\n\nGRANT pg_monit[256 chars]n\';'
>>>>   -- Role: "Role2_$%{}[]()&*^!@""'`\/#"
>>>>   -- DROP ROLE "Role2_$%{}[]()&*^!@""'`\/#";
>>>>
>>>>   CREATE ROLE "Role2_$%{}[]()&*^!@""'`\/#" WITH
>>>>     NOLOGIN
>>>>     SUPERUSER
>>>>     INHERIT
>>>>     CREATEDB
>>>>     NOCREATEROLE
>>>>     NOREPLICATION
>>>>     CONNECTION LIMIT 100
>>>>     ENCRYPTED PASSWORD 'md5cc9a2576a43b841dcacea0f65d961e41'
>>>> -   VALID UNTIL '2050-01-01 00:00:00+05:30';
>>>> +   VALID UNTIL '2049-12-31 10:30:00-08';
>>>>
>>>>   GRANT pg_monitor, pg_signal_backend TO "Role2_$%{}[]()&*^!@""'`\/#"
>>>> WITH ADMIN OPTION;
>>>>
>>>>   ALTER ROLE "Role2_$%{}[]()&*^!@""'`\/#" IN DATABASE postgres SET
>>>> application_name TO 'pg4';
>>>>
>>>>   COMMENT ON ROLE "Role2_$%{}[]()&*^!@""'`\/#" IS 'This is detailed
>>>> description';
>>>> Alter Role options 4  Expected SQL File:alter_role_options4.sql... FAIL
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Murtuza Zabuawala
>>>> *EDB*
>>>> *POWER TO POSTGRES*
>>>> https://www.edbpostgres.com
>>>>
>>>>
>>>> On Thu, Aug 27, 2020 at 1:10 PM Akshay Joshi <
>>>> akshay.jo...@enterprisedb.com> wrote:
>>>>
>>>>> Fixed cognitive complexity issues and added some more RESQL test cases
>>>>> for roles module.
>>>>>
>>>>> Branch
>>>>> ------
>>>>> master
>>>>>
>>>>> Details
>>>>> -------
>>>>>
>>>>> https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=53a54103379840795fc03f5940cb53dd99ff0ee9
>>>>> Author: Aditya Toshniwal <aditya.toshni...@enterprisedb.com>
>>>>>
>>>>> Modified Files
>>>>> --------------
>>>>> .../server_groups/servers/roles/__init__.py        | 609
>>>>> +++++++++------------
>>>>> .../templates/roles/sql/9.4_plus/properties.sql    |   1 +
>>>>> ..._role_options.msql => alter_role_options1.msql} |   4 +-
>>>>> .../roles/tests/9.4_plus/alter_role_options1.sql   |  20 +
>>>>> .../roles/tests/9.4_plus/alter_role_options2.msql  |   2 +
>>>>> .../roles/tests/9.4_plus/alter_role_options2.sql   |  20 +
>>>>> .../roles/tests/9.4_plus/alter_role_options3.msql  |   1 +
>>>>> ...er_role_options.sql => alter_role_options3.sql} |   4 +-
>>>>> .../roles/tests/9.4_plus/alter_role_options4.msql  |   1 +
>>>>> .../roles/tests/9.4_plus/alter_role_options4.sql   |  19 +
>>>>> .../servers/roles/tests/9.4_plus/test.json         |  54 +-
>>>>> 11 files changed, 370 insertions(+), 365 deletions(-)
>>>>>
>>>>>
>>>
>>> --
>>> Thanks,
>>> Aditya Toshniwal
>>> pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com*
>>> <http://edbpostgres.com>
>>> "Don't Complain about Heat, Plant a TREE"
>>>
>>
>>
>> --
>> Thanks,
>> Aditya Toshniwal
>> pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com*
>> <http://edbpostgres.com>
>> "Don't Complain about Heat, Plant a TREE"
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Sr. Software Architect*
> *EDB Postgres <http://edbpostgres.com>*
>
> *Mobile: +91 976-788-8246*
>


-- 
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com*
<http://edbpostgres.com>
"Don't Complain about Heat, Plant a TREE"

Attachment: resql.roles.membership.patch
Description: Binary data

Reply via email to