Re: [pgAdmin4][Patch] Feature #3204 Notify/Listen not working in version 2.1

2018-05-29 Thread Akshay Joshi
Hi Joao

On Tue, May 29, 2018 at 9:10 PM, Joao De Almeida Pereira  wrote:

> Hello Akshay,
>
> The code looks good, we do have some minor notes for next time:
>
> . To make the code easier to understand we should decide on 1 term and not
> have notifies and notifications to reference the same thing.
>
 Fixed and used 'notifies' where it reference the same, but still at
some places 'notifications' is used because the new tab represents the
'Notifications'.


> . It would be nice if we tried not to use XPATH to get the HTML components
> that we are testing on. Maybe try to use CSS classes. Selenium also has a
> driver.select_by_class_name which would work well in this case.
>
 Tried to use both CSS_SELECTOR and CLASS_NAME, but it doesn't support
string comparison(contains method). I have googled for this and most of the
sites suggested to use XPATH where we can use contains() method.


> The error that we are seeing in CI is related to pg_notify. This function
> was introduced in 9.0 and Greenplum is still not there yet. In order to
> solve this need to skip that part of the tests. There is an example in that
> same file using the function _test_explain_plan_feature to skip a tests
> depending on the Version.
>
OK. I have skip that part of the tests as per your suggestion. I have
rename the method "_test_explain_plan_feature" to
"_supported_server_version" which is more meaningful then the previous one.

   Attached is the modified patch. Please review it.


> Thanks
> Anthony && Joao
> ​
>
> On Mon, May 28, 2018 at 1:34 AM Akshay Joshi <
> akshay.jo...@enterprisedb.com> wrote:
>
>> Hi Hakers,
>>
>> On my last patch feature tests were failed for GreenPlum5 database only
>> not for PostgreSQL. I have verified that on https://gpdb-dev.bosh.
>> pivotalci.info/teams/pgadmin/pipelines/pgadmin-patch/jobs/
>> run-tests/builds/93.
>>
>> Can someone from Pivotal team help me, as I don't have GreenPlum database
>> and don't know why it is failing.
>>
>> On Sat, May 26, 2018 at 5:47 PM, Akshay Joshi <
>> akshay.jo...@enterprisedb.com> wrote:
>>
>>> Hi Hackers,
>>>
>>> As per suggestion by Dave and discussion with in the team, I have
>>> modified the logic again. Following are the modifications:
>>>
>>>- Instead of waiting for another query to execute on the session
>>>where 'LISTEN' command has been executed, we fetched the notify messages 
>>> in
>>>the connection status polling logic. Doing this user will get the notify
>>>messages asap.
>>>- Instead of showing all the notifications in single alertify dialog,
>>>we call *alertify.info ('') *for
>>>individual notifications.
>>>- Created new tab 'Notifications' in Query Tool where all the notify
>>>messages will be recorded with the timestamp and payload.
>>>
>>> Please review the latest patch.
>>>
>>> On Tue, May 22, 2018 at 2:43 PM, Dave Page  wrote:
>>>


 On Tue, May 22, 2018 at 10:01 AM, Akshay Joshi <
 akshay.jo...@enterprisedb.com> wrote:

> Hi Dave
>
> On Tue, May 22, 2018 at 2:02 PM, Dave Page  wrote:
>
>>
>>
>> On Tue, May 22, 2018 at 9:13 AM, Dave Page  wrote:
>>
>>> Hi
>>>
>>> On Tue, May 22, 2018 at 7:07 AM, Akshay Joshi <
>>> akshay.jo...@enterprisedb.com> wrote:
>>>
 Hi Hackers,

 As per suggestion by Dave, I have modified the logic and now
 notifications are popped up in alertify dialog(refer
 Notify_Messages.png) as and when received on that session where
 "LISTEN" is executed. Attached is the modified patch, please review it.

 To test this feature following steps need to perform:

- Apply the patch.
- Run pgAdmin4
- Connect to any database server and open query tool.
- Execute 'LISTEN foo;' command.
- Open another query tool window and execute 'NOTIFY foo'.
(This is without payload).
- Execute 'select pg_notify('foo', 'Hello')' query (with
payload).
- Go to the query tool window from where 'LISTEN' was executed
and run any other query.

 I think there was a small misunderstanding here - I was suggesting
>>> that each notification be displayed in an Alertify notification, e.g. 
>>> using
>>> alertify.message('A notification of FOO was received with payload
>>> '1234'...')
>>>
>>
>If there are too many notifications then it's annoying for user
> to popped up N number of alertify dialogs. Notification is only
> receives when any other query execute on the session where "LISTEN" 
> command
> executes. So for example I have NOTIFY 10 times from different sessions 
> and
> execute any other query on the session("LISTEN" one), 10 alertify
> dialog will be popped up.
>

 Sure, but then a) it's the users choice to listen for something very
>

Re: [pgadmin4][Patch]: Test cases for the backup module

2018-05-29 Thread Khushboo Vashi
On Wed, May 30, 2018 at 1:05 AM, Dave Page  wrote:

> Hi
>
> On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <
> khushboo.va...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> please find the attached updated patch for the test cases of Backup,
>> Restore and Maintenance modules which includes:
>>
>> 1. Unit test cases
>> 2. End to end regression test cases
>> 3. Feature test cases
>>
>
> Thanks. I've yet to be able to run the feature tests successfully. Here's
> what I've found so far:
>
> 1) DEFAULT_BINARY_PATHS should be default_binary_paths in the JSON config
> file.
>
> Will do.

> 2) I've hit screensize related issues:
>
> ==
>
> ERROR: runTest (pgadmin.feature_tests.pg_utilities_maintenance_test.
> PGUtilitiesMaintenanceFeatureTest)
>
> Test for PG maintenance: database
>
> --
>
> Traceback (most recent call last):
>
>   File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_
> utilities_maintenance_test.py", line 56, in runTest
>
> self._open_maintenance_dialogue()
>
>   File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_
> utilities_maintenance_test.py", line 75, in _open_maintenance_dialogue
>
> "*[.='" + self.table_name + "']/../*[@class='aciTreeItem'"
>
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/selenium/webdriver/remote/webelement.py", line 80, in click
>
> self._execute(Command.CLICK_ELEMENT)
>
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/selenium/webdriver/remote/webelement.py", line 628, in _execute
>
> return self._parent.execute(command, params)
>
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
>
> self.error_handler.check_response(response)
>
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/selenium/webdriver/remote/errorhandler.py", line 242, in
> check_response
>
> raise exception_class(message, screen, stacktrace)
>
> WebDriverException: Message: unknown error: Element  class="aciTreeItem">... is not clickable at point (223, 604). Other
> element would receive the click: ...
>
>   (Session info: chrome=66.0.3359.181)
>
>   (Driver info: chromedriver=2.38.552518 
> (183d19265345f54ce39cbb94cf81ba5f15905011),platform=Mac
> OS X 10.12.6 x86_64)
>
> 3) One time the test did start, but then I saw this failure:
>
> ==
>
> ERROR: runTest (pgadmin.feature_tests.pg_utilities_backup_restore_test.
> PGUtilitiesBackupFeatureTest)
>
> Test for PG utilities - Backup and Restore
>
> --
>
> Traceback (most recent call last):
>
>   File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_
> utilities_backup_restore_test.py", line 93, in runTest
>
> self.page.fill_input_by_field_name("file", "test_backup_file")
>
>   File 
> "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py",
> line 211, in fill_input_by_field_name
>
> self.wait_for_input_field_content(field_name, field_content)
>
>   File 
> "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py",
> line 251, in wait_for_input_field_content
>
> "field to contain '" + str(content) + "'", input_field_has_content
>
>   File 
> "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py",
> line 337, in _wait_for
>
> "Timed out waiting for " + waiting_for_message
>
>   File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/selenium/webdriver/support/wait.py", line 80, in until
>
> raise TimeoutException(message, screen, stacktrace)
>
> TimeoutException: Message: Timed out waiting for field to contain
> 'test_backup_file'
>
>
>
> (with screenshot attached)
>
> Thanks.
>
> I have ran the feature tests with multiple servers many times but didn't
get a single failure.
I have asked Akshay to run on his machine, let see what he gets.

>
>
>
>
>>
>> Thanks,
>> Khushboo
>>
>>
>>
>>
>> On Wed, Apr 25, 2018 at 9:40 PM, Joao De Almeida Pereira <
>> jdealmeidapere...@pivotal.io> wrote:
>>
>>> Hi Khushboo,
>>>
>>> We reviewed the patch and it is very nice to see some more coverage in
>>> this area. Good job :D
>>>
>>> We passed the tests through our CI the feature tests are not passing,
>>> but the linter fails:
>>>
>>> ./pgadmin/feature_tests/pg_utilities_backup_test.py:37: [E501] line too 
>>> long (91 > 79 characters)
>>>  
>>> 
>>> ./pgadmin/feature_tests/pg_utilities_backup_test.py:53: [E501] line too 
>>> long (104 > 79 characters)
>>>  
>>> 
>>> ./pgadmin/feature_test

Re: [pgAdmin4][Patch] RM #3355 User can not perform operation of backup,Backup all, Backup global and Maintenance DB with ssh tunneling

2018-05-29 Thread Akshay Joshi
Hi Joao

On Tue, May 29, 2018 at 9:24 PM, Joao De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:

> Hello Akshay,
>
> Looks like the tests failed, but it is just flakes. We assume no
> regression was made with this code, despite the fact that no tests were
> added to ensure the new code is working.
>

   Thanks for reviewing it. Yes tests were failed, but it is nothing to do
with this patch. I haven't change any logic in feature test. This patch
contains the changes where instead of using host and port of the database
server it uses 'localhost' and the local bind port returned by SSH Tunnel
module.

   Khushboo has send the patch where she wrote test cases for Utility
module (not committed yet) and anyways we can't replicate the SSH
Tunnelling scenario using test cases.

>
> Thanks
> Anthony && Joao
>
> On Tue, May 29, 2018 at 6:41 AM Akshay Joshi <
> akshay.jo...@enterprisedb.com> wrote:
>
>> Hi Hackers,
>>
>> Attached is the patch to fix RM #3355 User can not perform operation of
>> backup, Backup all, Backup global and Maintenance DB with ssh tunneling.
>>
>> Please review it.
>>
>> --
>> *Akshay Joshi*
>>
>> *Sr. Software Architect *
>>
>>
>>
>> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>>
>


-- 
*Akshay Joshi*

*Sr. Software Architect *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


Re: [pgAdmin4][Patch] RM #3355 User can not perform operation of backup,Backup all, Backup global and Maintenance DB with ssh tunneling

2018-05-29 Thread Joao De Almeida Pereira
Hello Akshay,

Looks like the tests failed, but it is just flakes. We assume no regression
was made with this code, despite the fact that no tests were added to
ensure the new code is working.

Thanks
Anthony && Joao

On Tue, May 29, 2018 at 6:41 AM Akshay Joshi 
wrote:

> Hi Hackers,
>
> Attached is the patch to fix RM #3355 User can not perform operation of
> backup, Backup all, Backup global and Maintenance DB with ssh tunneling.
>
> Please review it.
>
> --
> *Akshay Joshi*
>
> *Sr. Software Architect *
>
>
>
> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>


Re: [pgAdmin4][Patch] Feature #3204 Notify/Listen not working in version 2.1

2018-05-29 Thread Joao De Almeida Pereira
Hello Akshay,

The code looks good, we do have some minor notes for next time:

. To make the code easier to understand we should decide on 1 term and not
have notifies and notifications to reference the same thing.
. It would be nice if we tried not to use XPATH to get the HTML components
that we are testing on. Maybe try to use CSS classes. Selenium also has a
driver.select_by_class_name which would work well in this case.

The error that we are seeing in CI is related to pg_notify. This function
was introduced in 9.0 and Greenplum is still not there yet. In order to
solve this need to skip that part of the tests. There is an example in that
same file using the function _test_explain_plan_feature to skip a tests
depending on the Version.

Thanks
Anthony && Joao
​

On Mon, May 28, 2018 at 1:34 AM Akshay Joshi 
wrote:

> Hi Hakers,
>
> On my last patch feature tests were failed for GreenPlum5 database only
> not for PostgreSQL. I have verified that on
> https://gpdb-dev.bosh.pivotalci.info/teams/pgadmin/pipelines/pgadmin-patch/jobs/run-tests/builds/93
> .
>
> Can someone from Pivotal team help me, as I don't have GreenPlum database
> and don't know why it is failing.
>
> On Sat, May 26, 2018 at 5:47 PM, Akshay Joshi <
> akshay.jo...@enterprisedb.com> wrote:
>
>> Hi Hackers,
>>
>> As per suggestion by Dave and discussion with in the team, I have
>> modified the logic again. Following are the modifications:
>>
>>- Instead of waiting for another query to execute on the session
>>where 'LISTEN' command has been executed, we fetched the notify messages 
>> in
>>the connection status polling logic. Doing this user will get the notify
>>messages asap.
>>- Instead of showing all the notifications in single alertify dialog,
>>we call *alertify.info ('') *for
>>individual notifications.
>>- Created new tab 'Notifications' in Query Tool where all the notify
>>messages will be recorded with the timestamp and payload.
>>
>> Please review the latest patch.
>>
>> On Tue, May 22, 2018 at 2:43 PM, Dave Page  wrote:
>>
>>>
>>>
>>> On Tue, May 22, 2018 at 10:01 AM, Akshay Joshi <
>>> akshay.jo...@enterprisedb.com> wrote:
>>>
 Hi Dave

 On Tue, May 22, 2018 at 2:02 PM, Dave Page  wrote:

>
>
> On Tue, May 22, 2018 at 9:13 AM, Dave Page  wrote:
>
>> Hi
>>
>> On Tue, May 22, 2018 at 7:07 AM, Akshay Joshi <
>> akshay.jo...@enterprisedb.com> wrote:
>>
>>> Hi Hackers,
>>>
>>> As per suggestion by Dave, I have modified the logic and now
>>> notifications are popped up in alertify dialog(refer
>>> Notify_Messages.png) as and when received on that session where
>>> "LISTEN" is executed. Attached is the modified patch, please review it.
>>>
>>> To test this feature following steps need to perform:
>>>
>>>- Apply the patch.
>>>- Run pgAdmin4
>>>- Connect to any database server and open query tool.
>>>- Execute 'LISTEN foo;' command.
>>>- Open another query tool window and execute 'NOTIFY foo'. (This
>>>is without payload).
>>>- Execute 'select pg_notify('foo', 'Hello')' query (with
>>>payload).
>>>- Go to the query tool window from where 'LISTEN' was executed
>>>and run any other query.
>>>
>>> I think there was a small misunderstanding here - I was suggesting
>> that each notification be displayed in an Alertify notification, e.g. 
>> using
>> alertify.message('A notification of FOO was received with payload
>> '1234'...')
>>
>
If there are too many notifications then it's annoying for user
 to popped up N number of alertify dialogs. Notification is only
 receives when any other query execute on the session where "LISTEN" command
 executes. So for example I have NOTIFY 10 times from different sessions and
 execute any other query on the session("LISTEN" one), 10 alertify
 dialog will be popped up.

>>>
>>> Sure, but then a) it's the users choice to listen for something very
>>> noisey, and b) if there are many notifications then the message box
>>> dialogue will become huge.
>>>
>>> The other nice thing about using notifications is that they don't
>>> require any acknowledgement; they show you the event happened, and then get
>>> out of the way, allowing you to jump to the messages tab if needed.
>>>
>>>


>
> And it failed tests:
> https://gpdb-dev.bosh.pivotalci.info/teams/pgadmin/pipelines/pgadmin-patch/jobs/run-tests/builds/85
> :-(
>
> Again it's timeout issue, not able to reproduce on my machine will
 look into it. Maybe will have to add webDriverWait.

>>>
>>> OK.
>>>
>>>

>>
>>
>>>
>>>-
>>>
>>>
>>>
>>>
>>> On Mon, May 21, 2018 at 1:36 PM, Akshay Joshi <
>>> akshay.jo...@enterprisedb.com> wrote:
>>>
 Hi Dave

 On Fri, May

pgadmin, docker and ipv6

2018-05-29 Thread Александр Шишенко
Hello, I was running my pgadmin4 v2 on my ipv6-only subnet using docker image. After the update, I noticed, that you have changed your webserver from Apache to gunicorn, and it is configured to listen only on ipv4 network (0.0.0.0), so it is unreachable from my network without using docker-proxy (and I can't use that on my configuration). Please, consider switching to dual-stack networking in your configuration. It is just as simple as changing '--bind 0.0.0.0:${PGADMIN_LISTEN_PORT:-443}' to '--bind [::]:${PGADMIN_LISTEN_PORT:-443}' in your pkg/docker/entrypoint.sh.--  

[pgAdmin4][Patch] RM #3355 User can not perform operation of backup,Backup all, Backup global and Maintenance DB with ssh tunneling

2018-05-29 Thread Akshay Joshi
Hi Hackers,

Attached is the patch to fix RM #3355 User can not perform operation of
backup, Backup all, Backup global and Maintenance DB with ssh tunneling.

Please review it.

-- 
*Akshay Joshi*

*Sr. Software Architect *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


RM_3355_v1.patch
Description: Binary data