Re: pgAdmin 4 commit: Fixed cognitive complexity issues and added some more

Поиск
Список
Период
Сортировка
От Aditya Toshniwal
Тема Re: pgAdmin 4 commit: Fixed cognitive complexity issues and added some more
Дата
Msg-id CAM9w-_ks6HWKS0U2AEvknmR2R3diXMZxAs+N9pE7t2ikCZAHCg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pgAdmin 4 commit: Fixed cognitive complexity issues and added some more  (Aditya Toshniwal <aditya.toshniwal@enterprisedb.com>)
Ответы Re: pgAdmin 4 commit: Fixed cognitive complexity issues and added some more
Список pgadmin-hackers
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.toshniwal@enterprisedb.com> wrote:
Hi,

I'll look into it.

On Thu, Aug 27, 2020 at 2:41 PM Murtuza Zabuawala <murtuza.zabuawala@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


On Thu, Aug 27, 2020 at 1:10 PM Akshay Joshi <akshay.joshi@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.toshniwal@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
"Don't Complain about Heat, Plant a TREE"


--
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | edbpostgres.com
"Don't Complain about Heat, Plant a TREE"
Вложения

В списке pgadmin-hackers по дате отправления:

Предыдущее
От: Rahul Shirsat
Дата:
Сообщение: Re: #4059 Query tool new tab recurrence
Следующее
От: Khushboo Vashi
Дата:
Сообщение: Fwd: Macro Support UI Design