Subject: RE-SQL tests for Roles & Resource Group nodes

From: Murtuza Zabuawala <[email-masked]>
Date: Mon, 1 Jul 2019 11:01:18 +0530

Hi,

PFA patch to add RE-SQL tests for Roles & Resource Group nodes.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

---

From: Dave Page <[email-masked]>
Date: Mon, 1 Jul 2019 15:25:14 +0100

Hi

> PFA patch to add RE-SQL tests for Roles & Resource Group nodes.

Resource Groups don't exist in PG....

=============Running the test cases for 'Regression - PG 11'=============
runTest (regression.re_sql.tests.test_resql.ReverseEngineeredSQLTestCases)
Reverse Engineered SQL Test Cases

Create IMPLICIT Cast
Alter IMPLICIT Cast
Drop IMPLICIT Cast
Create EXPLICIT Cast
Alter EXPLICIT Cast
Drop EXPLICIT Cast

Create Resource groups
 ... 2019-07-01 15:24:16,930: ERROR flask.app: Failed to execute query
(execute_scalar) for the server #2 - DB:postgres (Query-id: 1562639):
Error Message:ERROR:  syntax error at or near "RESOURCE"
LINE 1: CREATE RESOURCE GROUP test_resql_resource_group;
               ^

FAIL

======================================================================
FAIL: runTest
(regression.re_sql.tests.test_resql.ReverseEngineeredSQLTestCases)
Reverse Engineered SQL Test Cases
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/Users/dpage/git/pgadmin4/web/regression/re_sql/tests/test_resql.py", line
88, in runTest
    self.execute_test_case(scenarios)
  File
"/Users/dpage/git/pgadmin4/web/regression/re_sql/tests/test_resql.py", line
145, in execute_test_case
    self.assertEquals(response.status_code, 200)
AssertionError: 500 != 200

----------------------------------------------------------------------
Ran 1 test in 0.767s

FAILED (failures=1)

======================================================================
Test Result Summary
======================================================================

Regression - PG 11:

0 tests passed
1 test failed:
ReverseEngineeredSQLTestCases (Reverse Engineered SQL Test Cases)
0 tests skipped

======================================================================

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

---

From: Murtuza Zabuawala <[email-masked]>
Date: Tue, 2 Jul 2019 12:46:35 +0530

Hi Dave,

Please find the updated patch,

- Added a mechanism to check for supported minimum/maximum version and a
server type in the framework.

Please review.

Thanks,
Murtuza

---

From: Murtuza Zabuawala <[email-masked]>
Date: Tue, 2 Jul 2019 12:47:14 +0530

++ Attaching patch

---

From: Dave Page <[email-masked]>
Date: Tue, 2 Jul 2019 10:20:00 +0100

I think you missed attaching the patch!

EnterpriseDB UK:http://www.enterprisedb.com
The Enterprise PostgreSQL Company

> On 2 Jul 2019, at 08:16, Murtuza Zabuawala <[email-masked]> wrote:
> 
> Hi Dave,
> 
> - Added a mechanism to check for supported minimum/maximum version and a server type in the framework.
> 
> Please review.
> 
> 
> Thanks,
> Murtuza
> 
>>> On Mon, Jul 1, 2019 at 6:31 AM Murtuza Zabuawala <[email-masked]> wrote:
>>> Hi,
>>> 
>>  ... 2019-07-01 15:24:16,930: ERROR	flask.app:	Failed to execute query (execute_scalar) for the server #2 - DB:postgres (Query-id: 1562639):
>> FAIL: runTest (regression.re_sql.tests.test_resql.ReverseEngineeredSQLTestCases)
>>   File "/Users/dpage/git/pgadmin4/web/regression/re_sql/tests/test_resql.py", line 88, in runTest
>>   File "/Users/dpage/git/pgadmin4/web/regression/re_sql/tests/test_resql.py", line 145, in execute_test_case

---

From: Dave Page <[email-masked]>
Date: Tue, 2 Jul 2019 13:22:42 +0100

Hi

>> server type in the framework.
There's still a problem with this I'm afraid - it says in the summary that
the re_sql test cases were all skipped, which is not the case. I think we
should just skip the irrelevant tests in the re_sql module, but not mark
the entire module as being skipped:

Create IMPLICIT Cast

Alter IMPLICIT Cast

Drop IMPLICIT Cast

Create EXPLICIT Cast

Alter EXPLICIT Cast

Drop EXPLICIT Cast

 ... skipped 'Server(Type: #ppas) is not supported for the Resource Groups
module'

Ran 1 test in 0.480s

OK (skipped=1)

Test Result Summary

Regression - PG 11:

0 tests passed

0 tests failed

1 test skipped:

---

From: Murtuza Zabuawala <[email-masked]>
Date: Wed, 3 Jul 2019 09:23:36 +0530

Hi Dave,

PFA updated patch.

Please note that our framework considers test cases from all the modules as
one single test case, If we need module wise detailed summary report for
the reverse engineered SQL tests then we may have to change the framework.

Regards,
Murtuza

>  ... skipped 'Server(Type: #ppas) is not supported for the Resource
> Groups module'
>
>

---

From: Akshay Joshi <[email-masked]>
Date: Wed, 3 Jul 2019 13:04:48 +0530

Hi Murtuza

I have tested the patch and I think below string should be modified:
Server(Type: #ppas) is not supported for the Resource Groups module -
Skipped
Server version(120000) is not supported for the Resource Groups module -
Skipped

It misleads, that server type 'ppas' is not supported for the Resource
Group, it should be changed to "Resource groups are not supported by PG -
Skipped". Similarly for version string should be ''Resource groups are not
supported by PPAS server less/greater than <server version>"

Apart from the above code looks good to me.

On Wed, Jul 3, 2019 at 9:23 AM Murtuza Zabuawala <
[email-masked]> wrote:

> Hi Dave,
>
> PFA updated patch.
>
> Please note that our framework considers test cases from all the modules
> as one single test case, If we need module wise detailed summary report for
>> There's still a problem with this I'm afraid - it says in the summary
>> that the re_sql test cases were all skipped, which is not the case. I think
>> we should just skip the irrelevant tests in the re_sql module, but not mark

-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*

---

From: Dave Page <[email-masked]>
Date: Wed, 3 Jul 2019 13:06:20 +0100

Hi

> supported by PPAS server less/greater than <server version>"

Agreed.

>> the reverse engineered SQL tests then we may have to change the framework.
We're just treating all the re-sql tests as one test in the higher-level
suite. Maybe we'd want to change that in the future, but I think it's fine
for now.

>>> runTest

---

From: Murtuza Zabuawala <[email-masked]>
Date: Wed, 3 Jul 2019 19:00:12 +0530

Hi,

PFA updated patch with corrections in the print messages.

---

From: Dave Page <[email-masked]>
Date: Wed, 3 Jul 2019 14:39:30 +0100

Thanks, applied.

On Wed, Jul 3, 2019 at 2:30 PM Murtuza Zabuawala <
[email-masked]> wrote:

>> On Wed, Jul 3, 2019 at 8:35 AM Akshay Joshi <
>> [email-masked]> wrote:
>>
>>> Hi Murtuza
>>>
>>>> Please note that our framework considers test cases from all the
>>>> modules as one single test case, If we need module wise detailed summary
>>>> report for the reverse engineered SQL tests then we may have to change the
>>>> framework.
>>>>
>>>