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

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

From
Khushboo Vashi
Date:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo
Attachment

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

From
Joao De Almeida Pereira
Date:
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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo
Attachment

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

From
Khushboo Vashi
Date:
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,
Khushboo




On Wed, Apr 25, 2018 at 9:40 PM, Joao De Almeida Pereira <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo

Attachment

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

From
Dave Page
Date:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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.

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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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.



 

Thanks,
Khushboo




On Wed, Apr 25, 2018 at 9:40 PM, Joao De Almeida Pereira <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




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

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

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

From
Khushboo Vashi
Date:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




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

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

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

From
Khushboo Vashi
Date:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




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

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


Attachment

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

From
Victoria Henry
Date:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




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

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


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

From
Khushboo Vashi
Date:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




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

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



Attachment

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

From
Dave Page
Date:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




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

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






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

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

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

From
Khushboo Vashi
Date:


On Sat, Jun 2, 2018 at 3:01 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

PFA updated patch. 
Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




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

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






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

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

Attachment

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

From
Joao De Almeida Pereira
Date:
Hi Khushboo,

Some tests are failing in greenplum:
The piece of code responsible for the error is:
if server['default_binary_paths'] is not None:
test_utils.set_preference(server['default_binary_paths'])

config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": ""
}

test_backup_utils.py file name is misleading, these are not tests, are helpers.



Thanks
Victoria & Joao

On Mon, Jun 4, 2018 at 1:36 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Sat, Jun 2, 2018 at 3:01 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

PFA updated patch. 
Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




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

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






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

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

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

From
Khushboo Vashi
Date:


On Mon, Jun 4, 2018 at 8:41 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hi Khushboo,

Some tests are failing in greenplum:
The piece of code responsible for the error is:
if server['default_binary_paths'] is not None:
test_utils.set_preference(server['default_binary_paths'])

config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": ""
}

Can you send me the test_config.json file?  The above code sets the paths to the SQLite database and through the logs couldn't figure out the exact failure. 

test_backup_utils.py file name is misleading, these are not tests, are helpers.



Thanks
Victoria & Joao

On Mon, Jun 4, 2018 at 1:36 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Sat, Jun 2, 2018 at 3:01 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

PFA updated patch. 
Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




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

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






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

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


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

From
Dave Page
Date:
Hi

On Tue, Jun 5, 2018 at 4:39 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Mon, Jun 4, 2018 at 8:41 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hi Khushboo,

Some tests are failing in greenplum:
The piece of code responsible for the error is:
if server['default_binary_paths'] is not None:
test_utils.set_preference(server['default_binary_paths'])

config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": ""
}

Can you send me the test_config.json file?  The above code sets the paths to the SQLite database and through the logs couldn't figure out the exact failure. 

It seems clear from the code shown that it's not setting the binary paths for gpdb database servers. Shouldn't it be something like:

    config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": str(server['default_binary_paths']['gpdb'])
}

 

test_backup_utils.py file name is misleading, these are not tests, are helpers.



Thanks
Victoria & Joao

On Mon, Jun 4, 2018 at 1:36 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Sat, Jun 2, 2018 at 3:01 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

PFA updated patch. 
Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




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

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






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

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





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

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

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

From
Khushboo Vashi
Date:


On Tue, Jun 5, 2018 at 1:36 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Tue, Jun 5, 2018 at 4:39 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Mon, Jun 4, 2018 at 8:41 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hi Khushboo,

Some tests are failing in greenplum:
The piece of code responsible for the error is:
if server['default_binary_paths'] is not None:
test_utils.set_preference(server['default_binary_paths'])

config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": ""
}

Can you send me the test_config.json file?  The above code sets the paths to the SQLite database and through the logs couldn't figure out the exact failure. 

It seems clear from the code shown that it's not setting the binary paths for gpdb database servers. Shouldn't it be something like:

    config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": str(server['default_binary_paths']['gpdb'])
}
Without this code, the test cases should work as I already set  paths through below code.
    test_utils.set_preference(server['default_binary_paths'])
 

test_backup_utils.py file name is misleading, these are not tests, are helpers.



Thanks
Victoria & Joao

On Mon, Jun 4, 2018 at 1:36 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Sat, Jun 2, 2018 at 3:01 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

PFA updated patch. 
Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




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

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






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

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





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

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

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

From
Dave Page
Date:


On Tue, Jun 5, 2018 at 9:37 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 1:36 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Tue, Jun 5, 2018 at 4:39 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Mon, Jun 4, 2018 at 8:41 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hi Khushboo,

Some tests are failing in greenplum:
The piece of code responsible for the error is:
if server['default_binary_paths'] is not None:
test_utils.set_preference(server['default_binary_paths'])

config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": ""
}

Can you send me the test_config.json file?  The above code sets the paths to the SQLite database and through the logs couldn't figure out the exact failure. 

It seems clear from the code shown that it's not setting the binary paths for gpdb database servers. Shouldn't it be something like:

    config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": str(server['default_binary_paths']['gpdb'])
}
Without this code, the test cases should work as I already set  paths through below code.
    test_utils.set_preference(server['default_binary_paths'])

In that case, why is the code above required at all?

 
 

test_backup_utils.py file name is misleading, these are not tests, are helpers.



Thanks
Victoria & Joao

On Mon, Jun 4, 2018 at 1:36 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Sat, Jun 2, 2018 at 3:01 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

PFA updated patch. 
Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




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

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






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

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





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

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




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

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

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

From
Khushboo Vashi
Date:


On Tue, Jun 5, 2018 at 2:09 PM, Dave Page <dpage@pgadmin.org> wrote:


On Tue, Jun 5, 2018 at 9:37 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 1:36 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Tue, Jun 5, 2018 at 4:39 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Mon, Jun 4, 2018 at 8:41 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hi Khushboo,

Some tests are failing in greenplum:
The piece of code responsible for the error is:
if server['default_binary_paths'] is not None:
test_utils.set_preference(server['default_binary_paths'])

config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": ""
}

Can you send me the test_config.json file?  The above code sets the paths to the SQLite database and through the logs couldn't figure out the exact failure. 

It seems clear from the code shown that it's not setting the binary paths for gpdb database servers. Shouldn't it be something like:

    config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": str(server['default_binary_paths']['gpdb'])
}
Without this code, the test cases should work as I already set  paths through below code.
    test_utils.set_preference(server['default_binary_paths'])

In that case, why is the code above required at all?

My bad. Removed this code and also updated set_preference function for greenplum database.
Please find the attached updated patch.
 
 

test_backup_utils.py file name is misleading, these are not tests, are helpers.



Thanks
Victoria & Joao

On Mon, Jun 4, 2018 at 1:36 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Sat, Jun 2, 2018 at 3:01 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

PFA updated patch. 
Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




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

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






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

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





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

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




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

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

Attachment

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

From
Victoria Henry
Date:
Hi Khushboo

The tests are still failing and seems flaky:

Sincerely,

Victoria

On Tue, Jun 5, 2018 at 4:50 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 2:09 PM, Dave Page <dpage@pgadmin.org> wrote:


On Tue, Jun 5, 2018 at 9:37 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 1:36 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Tue, Jun 5, 2018 at 4:39 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Mon, Jun 4, 2018 at 8:41 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hi Khushboo,

Some tests are failing in greenplum:
The piece of code responsible for the error is:
if server['default_binary_paths'] is not None:
test_utils.set_preference(server['default_binary_paths'])

config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": ""
}

Can you send me the test_config.json file?  The above code sets the paths to the SQLite database and through the logs couldn't figure out the exact failure. 

It seems clear from the code shown that it's not setting the binary paths for gpdb database servers. Shouldn't it be something like:

    config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": str(server['default_binary_paths']['gpdb'])
}
Without this code, the test cases should work as I already set  paths through below code.
    test_utils.set_preference(server['default_binary_paths'])

In that case, why is the code above required at all?

My bad. Removed this code and also updated set_preference function for greenplum database.
Please find the attached updated patch.
 
 

test_backup_utils.py file name is misleading, these are not tests, are helpers.



Thanks
Victoria & Joao

On Mon, Jun 4, 2018 at 1:36 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Sat, Jun 2, 2018 at 3:01 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

PFA updated patch. 
Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo

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

From
Khushboo Vashi
Date:
Hi Victoria,

As per the logs, Restore job is failing only for GPDB. As I don't have setup for the greenplum database, can you please check this functionality works well in pgAdmin4 with GPDB?

Thanks,
Khushboo

On Wed, Jun 6, 2018 at 5:13 AM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi Khushboo

The tests are still failing and seems flaky:

Sincerely,

Victoria

On Tue, Jun 5, 2018 at 4:50 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 2:09 PM, Dave Page <dpage@pgadmin.org> wrote:


On Tue, Jun 5, 2018 at 9:37 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 1:36 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Tue, Jun 5, 2018 at 4:39 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Mon, Jun 4, 2018 at 8:41 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hi Khushboo,

Some tests are failing in greenplum:
The piece of code responsible for the error is:
if server['default_binary_paths'] is not None:
test_utils.set_preference(server['default_binary_paths'])

config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": ""
}

Can you send me the test_config.json file?  The above code sets the paths to the SQLite database and through the logs couldn't figure out the exact failure. 

It seems clear from the code shown that it's not setting the binary paths for gpdb database servers. Shouldn't it be something like:

    config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": str(server['default_binary_paths']['gpdb'])
}
Without this code, the test cases should work as I already set  paths through below code.
    test_utils.set_preference(server['default_binary_paths'])

In that case, why is the code above required at all?

My bad. Removed this code and also updated set_preference function for greenplum database.
Please find the attached updated patch.
 
 

test_backup_utils.py file name is misleading, these are not tests, are helpers.



Thanks
Victoria & Joao

On Mon, Jun 4, 2018 at 1:36 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Sat, Jun 2, 2018 at 3:01 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

PFA updated patch. 
Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo


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

From
Khushboo Vashi
Date:
Hi Dave,

As per our discussion I have added the code to clean up the generated files.
Please find the attached updated patch.

Thanks,
Khushboo

On Wed, Jun 6, 2018 at 9:37 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

As per the logs, Restore job is failing only for GPDB. As I don't have setup for the greenplum database, can you please check this functionality works well in pgAdmin4 with GPDB?

Thanks,
Khushboo

On Wed, Jun 6, 2018 at 5:13 AM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi Khushboo

The tests are still failing and seems flaky:

Sincerely,

Victoria

On Tue, Jun 5, 2018 at 4:50 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 2:09 PM, Dave Page <dpage@pgadmin.org> wrote:


On Tue, Jun 5, 2018 at 9:37 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 1:36 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Tue, Jun 5, 2018 at 4:39 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Mon, Jun 4, 2018 at 8:41 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hi Khushboo,

Some tests are failing in greenplum:
The piece of code responsible for the error is:
if server['default_binary_paths'] is not None:
test_utils.set_preference(server['default_binary_paths'])

config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": ""
}

Can you send me the test_config.json file?  The above code sets the paths to the SQLite database and through the logs couldn't figure out the exact failure. 

It seems clear from the code shown that it's not setting the binary paths for gpdb database servers. Shouldn't it be something like:

    config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": str(server['default_binary_paths']['gpdb'])
}
Without this code, the test cases should work as I already set  paths through below code.
    test_utils.set_preference(server['default_binary_paths'])

In that case, why is the code above required at all?

My bad. Removed this code and also updated set_preference function for greenplum database.
Please find the attached updated patch.
 
 

test_backup_utils.py file name is misleading, these are not tests, are helpers.



Thanks
Victoria & Joao

On Mon, Jun 4, 2018 at 1:36 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Sat, Jun 2, 2018 at 3:01 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

PFA updated patch. 
Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo



Attachment

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

From
Khushboo Vashi
Date:
Please find the atatched patch with the PEP8 fixes.

On Wed, Jun 6, 2018 at 10:42 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Dave,

As per our discussion I have added the code to clean up the generated files.
Please find the attached updated patch.

Thanks,
Khushboo

On Wed, Jun 6, 2018 at 9:37 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

As per the logs, Restore job is failing only for GPDB. As I don't have setup for the greenplum database, can you please check this functionality works well in pgAdmin4 with GPDB?

Thanks,
Khushboo

On Wed, Jun 6, 2018 at 5:13 AM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi Khushboo

The tests are still failing and seems flaky:

Sincerely,

Victoria

On Tue, Jun 5, 2018 at 4:50 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 2:09 PM, Dave Page <dpage@pgadmin.org> wrote:


On Tue, Jun 5, 2018 at 9:37 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 1:36 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Tue, Jun 5, 2018 at 4:39 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Mon, Jun 4, 2018 at 8:41 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hi Khushboo,

Some tests are failing in greenplum:
The piece of code responsible for the error is:
if server['default_binary_paths'] is not None:
test_utils.set_preference(server['default_binary_paths'])

config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": ""
}

Can you send me the test_config.json file?  The above code sets the paths to the SQLite database and through the logs couldn't figure out the exact failure. 

It seems clear from the code shown that it's not setting the binary paths for gpdb database servers. Shouldn't it be something like:

    config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": str(server['default_binary_paths']['gpdb'])
}
Without this code, the test cases should work as I already set  paths through below code.
    test_utils.set_preference(server['default_binary_paths'])

In that case, why is the code above required at all?

My bad. Removed this code and also updated set_preference function for greenplum database.
Please find the attached updated patch.
 
 

test_backup_utils.py file name is misleading, these are not tests, are helpers.



Thanks
Victoria & Joao

On Mon, Jun 4, 2018 at 1:36 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Sat, Jun 2, 2018 at 3:01 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

PFA updated patch. 
Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo




Attachment

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

From
Khushboo Vashi
Date:


On Wed, Jun 6, 2018 at 2:30 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

I'm seeing various failures with this patch. Many of them appear to be being caused by the notification popups obscuring elements. Perhaps they need to be explicitly closed? Errors below, screenshots attached.
Notifications should be taken care by test cases. On my MAC and Linux these are working fine.
I will check with someone else's machine.
======================================================================
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 97, in runTest
    self.page.find_by_xpath("//div[contains(@class,'wcFloatingFocus')"
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath
    lambda driver: driver.find_element_by_xpath(xpath)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element
    return self._wait_for("element to exist", element_if_it_exists)
  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 element to exist


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_file_manager_test.CheckFileManagerFeatureTest)
Tests to check if File manager is vulnerable to XSS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/base_feature_test.py", line 66, in tearDown
    self.after()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_file_manager_test.py", line 46, in after
    self.page.close_query_tool('sql', False)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 104, in close_query_tool
    "//li[contains(@class, 'context-menu-item')]/span[contains(text(),"
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath
    lambda driver: driver.find_element_by_xpath(xpath)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element
    return self._wait_for("element to exist", element_if_it_exists)
  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 element to exist


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_panels_and_query_tool_test.CheckForXssFeatureTest)
Test XSS check for panels and query tool
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py", line 57, in runTest
    self.page.add_server(self.server)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 65, in add_server
    self.find_by_xpath("//button[contains(.,'Save')]").click()
  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 <button type="save" class="btn btn-primary" title="Save this object.">...</button> is not clickable at point (661, 761). Other element would receive the click: <div class="pg-bg-etime">...</div>
  (Session info: chrome=66.0.3359.181)
  (Driver info: chromedriver=2.38.552518 (183d19265345f54ce39cbb94cf81ba5f15905011),platform=Mac OS X 10.12.6 x86_64)


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_panels_and_query_tool_test.CheckForXssFeatureTest)
Test XSS check for panels and query tool
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/base_feature_test.py", line 66, in tearDown
    self.after()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py", line 69, in after
    self.page.remove_server(self.server)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 124, in remove_server
    "' and @class='aciTreeItem']")
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath
    lambda driver: driver.find_element_by_xpath(xpath)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element
    return self._wait_for("element to exist", element_if_it_exists)
  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 element to exist


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_pgadmin_debugger_test.CheckDebuggerForXssFeatureTest)
Tests to check if Debugger is vulnerable to XSS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 41, in runTest
    self.page.add_server(self.server)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 65, in add_server
    self.find_by_xpath("//button[contains(.,'Save')]").click()
  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 <button type="save" class="btn btn-primary" title="Save this object.">...</button> is not clickable at point (661, 761). Other element would receive the click: <div class="pg-bg-etime">...</div>
  (Session info: chrome=66.0.3359.181)
  (Driver info: chromedriver=2.38.552518 (183d19265345f54ce39cbb94cf81ba5f15905011),platform=Mac OS X 10.12.6 x86_64)


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_pgadmin_debugger_test.CheckDebuggerForXssFeatureTest)
Tests to check if Debugger is vulnerable to XSS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/base_feature_test.py", line 66, in tearDown
    self.after()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 46, in after
    self.page.remove_server(self.server)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 124, in remove_server
    "' and @class='aciTreeItem']")
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath
    lambda driver: driver.find_element_by_xpath(xpath)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element
    return self._wait_for("element to exist", element_if_it_exists)
  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 element to exist


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_roles_control_test.CheckRoleMembershipControlFeatureTest)
Tests to check if Role membership control is vulnerable to XSS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_roles_control_test.py", line 37, in runTest
    self.page.add_server(self.server)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 65, in add_server
    self.find_by_xpath("//button[contains(.,'Save')]").click()
  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 <button type="save" class="btn btn-primary" title="Save this object.">...</button> is not clickable at point (661, 761). Other element would receive the click: <div class="pg-bg-etime">...</div>
  (Session info: chrome=66.0.3359.181)
  (Driver info: chromedriver=2.38.552518 (183d19265345f54ce39cbb94cf81ba5f15905011),platform=Mac OS X 10.12.6 x86_64)


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_roles_control_test.CheckRoleMembershipControlFeatureTest)
Tests to check if Role membership control is vulnerable to XSS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/base_feature_test.py", line 66, in tearDown
    self.after()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_roles_control_test.py", line 42, in after
    self.page.remove_server(self.server)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 124, in remove_server
    "' and @class='aciTreeItem']")
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath
    lambda driver: driver.find_element_by_xpath(xpath)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element
    return self._wait_for("element to exist", element_if_it_exists)
  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 element to exist


======================================================================
FAIL: runTest (pgadmin.feature_tests.pg_utilities_maintenance_test.PGUtilitiesMaintenanceFeatureTest)
Test for PG maintenance: database pg_maintenance
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 63, in runTest
    self._verify_command()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 90, in _verify_command
    self.assertEquals(command, "VACUUM "
AssertionError: u'Backing up an object on the server \'Regression - PG 9.4 Feature Tests (localhost:5432)\' from database \'pg_utility_test_db\'...\nRunning command:\n/Library/PostgreSQL/9.4/bin/pg_dump --file "/Users/dpage/test_backup" --host "localhost" --port "5432" --username "postgres" --no-password --verbose --format=c --blobs "pg_utility_test_db"' != 'VACUUM (VERBOSE)\nRunning Query:\nVACUUM VERBOSE;'

======================================================================
FAIL: 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 63, in runTest
    self._verify_command()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 97, in _verify_command
    " public." + self.table_name + ";")
AssertionError: u'Backing up an object on the server \'Regression - PG 9.4 Feature Tests (localhost:5432)\' from database \'pg_utility_test_db\'...\nRunning command:\n/Library/PostgreSQL/9.4/bin/pg_dump --file "/Users/dpage/test_backup" --host "localhost" --port "5432" --username "postgres" --no-password --verbose --format=c --blobs "pg_utility_test_db"' != 'VACUUM (VERBOSE)\nRunning Query:\nVACUUM VERBOSE public.pg_maintenance_table;'

======================================================================
FAIL: runTest (pgadmin.tools.maintenance.tests.test_create_maintenance_job.MaintenanceJobTest)
When maintenance the object with the default options
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/maintenance/tests/test_create_maintenance_job.py", line 85, in runTest
    self.assertIn(self.expected_cmd, process_list[0]['details'])
AssertionError: 'VACUUM VERBOSE' not found in u'<div class="h5">Backing up an object on the server \'Regression - PG 9.4 Feature Tests (localhost:5432)\' from database \'pg_utility_test_db\'...</div><div class="h5">Running command:</b><br><span class="pg-bg-cmd enable-selection">/Library/PostgreSQL/9.4/bin/pg_dump --file "/Users/dpage/test_backup" --host "localhost" --port "5432" --username "postgres" --no-password --verbose --format=c --blobs "pg_utility_test_db"</span></div>'

----------------------------------------------------------------------
Ran 369 tests in 493.707s

FAILED (failures=3, errors=8, skipped=21)



On Wed, Jun 6, 2018 at 7:57 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Please find the atatched patch with the PEP8 fixes.

On Wed, Jun 6, 2018 at 10:42 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Dave,

As per our discussion I have added the code to clean up the generated files.
Please find the attached updated patch.

Thanks,
Khushboo

On Wed, Jun 6, 2018 at 9:37 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

As per the logs, Restore job is failing only for GPDB. As I don't have setup for the greenplum database, can you please check this functionality works well in pgAdmin4 with GPDB?

Thanks,
Khushboo

On Wed, Jun 6, 2018 at 5:13 AM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi Khushboo

The tests are still failing and seems flaky:

Sincerely,

Victoria

On Tue, Jun 5, 2018 at 4:50 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 2:09 PM, Dave Page <dpage@pgadmin.org> wrote:


On Tue, Jun 5, 2018 at 9:37 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 1:36 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Tue, Jun 5, 2018 at 4:39 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Mon, Jun 4, 2018 at 8:41 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hi Khushboo,

Some tests are failing in greenplum:
The piece of code responsible for the error is:
if server['default_binary_paths'] is not None:
test_utils.set_preference(server['default_binary_paths'])

config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": ""
}

Can you send me the test_config.json file?  The above code sets the paths to the SQLite database and through the logs couldn't figure out the exact failure. 

It seems clear from the code shown that it's not setting the binary paths for gpdb database servers. Shouldn't it be something like:

    config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": str(server['default_binary_paths']['gpdb'])
}
Without this code, the test cases should work as I already set  paths through below code.
    test_utils.set_preference(server['default_binary_paths'])

In that case, why is the code above required at all?

My bad. Removed this code and also updated set_preference function for greenplum database.
Please find the attached updated patch.
 
 

test_backup_utils.py file name is misleading, these are not tests, are helpers.



Thanks
Victoria & Joao

On Mon, Jun 4, 2018 at 1:36 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Sat, Jun 2, 2018 at 3:01 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

PFA updated patch. 
Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo







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

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

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

From
Khushboo Vashi
Date:
Hi Dave,

As per our discussion I have changed the window size to 1280X800, before it was 1280X900.
Please find the attached updated patch.


Thanks,
Khushboo

On Wed, Jun 6, 2018 at 3:54 PM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, Jun 6, 2018 at 2:30 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

I'm seeing various failures with this patch. Many of them appear to be being caused by the notification popups obscuring elements. Perhaps they need to be explicitly closed? Errors below, screenshots attached.
Notifications should be taken care by test cases. On my MAC and Linux these are working fine.
I will check with someone else's machine.
======================================================================
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 97, in runTest
    self.page.find_by_xpath("//div[contains(@class,'wcFloatingFocus')"
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath
    lambda driver: driver.find_element_by_xpath(xpath)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element
    return self._wait_for("element to exist", element_if_it_exists)
  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 element to exist


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_file_manager_test.CheckFileManagerFeatureTest)
Tests to check if File manager is vulnerable to XSS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/base_feature_test.py", line 66, in tearDown
    self.after()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_file_manager_test.py", line 46, in after
    self.page.close_query_tool('sql', False)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 104, in close_query_tool
    "//li[contains(@class, 'context-menu-item')]/span[contains(text(),"
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath
    lambda driver: driver.find_element_by_xpath(xpath)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element
    return self._wait_for("element to exist", element_if_it_exists)
  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 element to exist


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_panels_and_query_tool_test.CheckForXssFeatureTest)
Test XSS check for panels and query tool
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py", line 57, in runTest
    self.page.add_server(self.server)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 65, in add_server
    self.find_by_xpath("//button[contains(.,'Save')]").click()
  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 <button type="save" class="btn btn-primary" title="Save this object.">...</button> is not clickable at point (661, 761). Other element would receive the click: <div class="pg-bg-etime">...</div>
  (Session info: chrome=66.0.3359.181)
  (Driver info: chromedriver=2.38.552518 (183d19265345f54ce39cbb94cf81ba5f15905011),platform=Mac OS X 10.12.6 x86_64)


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_panels_and_query_tool_test.CheckForXssFeatureTest)
Test XSS check for panels and query tool
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/base_feature_test.py", line 66, in tearDown
    self.after()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py", line 69, in after
    self.page.remove_server(self.server)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 124, in remove_server
    "' and @class='aciTreeItem']")
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath
    lambda driver: driver.find_element_by_xpath(xpath)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element
    return self._wait_for("element to exist", element_if_it_exists)
  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 element to exist


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_pgadmin_debugger_test.CheckDebuggerForXssFeatureTest)
Tests to check if Debugger is vulnerable to XSS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 41, in runTest
    self.page.add_server(self.server)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 65, in add_server
    self.find_by_xpath("//button[contains(.,'Save')]").click()
  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 <button type="save" class="btn btn-primary" title="Save this object.">...</button> is not clickable at point (661, 761). Other element would receive the click: <div class="pg-bg-etime">...</div>
  (Session info: chrome=66.0.3359.181)
  (Driver info: chromedriver=2.38.552518 (183d19265345f54ce39cbb94cf81ba5f15905011),platform=Mac OS X 10.12.6 x86_64)


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_pgadmin_debugger_test.CheckDebuggerForXssFeatureTest)
Tests to check if Debugger is vulnerable to XSS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/base_feature_test.py", line 66, in tearDown
    self.after()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 46, in after
    self.page.remove_server(self.server)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 124, in remove_server
    "' and @class='aciTreeItem']")
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath
    lambda driver: driver.find_element_by_xpath(xpath)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element
    return self._wait_for("element to exist", element_if_it_exists)
  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 element to exist


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_roles_control_test.CheckRoleMembershipControlFeatureTest)
Tests to check if Role membership control is vulnerable to XSS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_roles_control_test.py", line 37, in runTest
    self.page.add_server(self.server)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 65, in add_server
    self.find_by_xpath("//button[contains(.,'Save')]").click()
  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 <button type="save" class="btn btn-primary" title="Save this object.">...</button> is not clickable at point (661, 761). Other element would receive the click: <div class="pg-bg-etime">...</div>
  (Session info: chrome=66.0.3359.181)
  (Driver info: chromedriver=2.38.552518 (183d19265345f54ce39cbb94cf81ba5f15905011),platform=Mac OS X 10.12.6 x86_64)


======================================================================
ERROR: runTest (pgadmin.feature_tests.xss_checks_roles_control_test.CheckRoleMembershipControlFeatureTest)
Tests to check if Role membership control is vulnerable to XSS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/base_feature_test.py", line 66, in tearDown
    self.after()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_roles_control_test.py", line 42, in after
    self.page.remove_server(self.server)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 124, in remove_server
    "' and @class='aciTreeItem']")
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath
    lambda driver: driver.find_element_by_xpath(xpath)
  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element
    return self._wait_for("element to exist", element_if_it_exists)
  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 element to exist


======================================================================
FAIL: runTest (pgadmin.feature_tests.pg_utilities_maintenance_test.PGUtilitiesMaintenanceFeatureTest)
Test for PG maintenance: database pg_maintenance
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 63, in runTest
    self._verify_command()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 90, in _verify_command
    self.assertEquals(command, "VACUUM "
AssertionError: u'Backing up an object on the server \'Regression - PG 9.4 Feature Tests (localhost:5432)\' from database \'pg_utility_test_db\'...\nRunning command:\n/Library/PostgreSQL/9.4/bin/pg_dump --file "/Users/dpage/test_backup" --host "localhost" --port "5432" --username "postgres" --no-password --verbose --format=c --blobs "pg_utility_test_db"' != 'VACUUM (VERBOSE)\nRunning Query:\nVACUUM VERBOSE;'

======================================================================
FAIL: 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 63, in runTest
    self._verify_command()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 97, in _verify_command
    " public." + self.table_name + ";")
AssertionError: u'Backing up an object on the server \'Regression - PG 9.4 Feature Tests (localhost:5432)\' from database \'pg_utility_test_db\'...\nRunning command:\n/Library/PostgreSQL/9.4/bin/pg_dump --file "/Users/dpage/test_backup" --host "localhost" --port "5432" --username "postgres" --no-password --verbose --format=c --blobs "pg_utility_test_db"' != 'VACUUM (VERBOSE)\nRunning Query:\nVACUUM VERBOSE public.pg_maintenance_table;'

======================================================================
FAIL: runTest (pgadmin.tools.maintenance.tests.test_create_maintenance_job.MaintenanceJobTest)
When maintenance the object with the default options
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/maintenance/tests/test_create_maintenance_job.py", line 85, in runTest
    self.assertIn(self.expected_cmd, process_list[0]['details'])
AssertionError: 'VACUUM VERBOSE' not found in u'<div class="h5">Backing up an object on the server \'Regression - PG 9.4 Feature Tests (localhost:5432)\' from database \'pg_utility_test_db\'...</div><div class="h5">Running command:</b><br><span class="pg-bg-cmd enable-selection">/Library/PostgreSQL/9.4/bin/pg_dump --file "/Users/dpage/test_backup" --host "localhost" --port "5432" --username "postgres" --no-password --verbose --format=c --blobs "pg_utility_test_db"</span></div>'

----------------------------------------------------------------------
Ran 369 tests in 493.707s

FAILED (failures=3, errors=8, skipped=21)



On Wed, Jun 6, 2018 at 7:57 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Please find the atatched patch with the PEP8 fixes.

On Wed, Jun 6, 2018 at 10:42 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Dave,

As per our discussion I have added the code to clean up the generated files.
Please find the attached updated patch.

Thanks,
Khushboo

On Wed, Jun 6, 2018 at 9:37 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

As per the logs, Restore job is failing only for GPDB. As I don't have setup for the greenplum database, can you please check this functionality works well in pgAdmin4 with GPDB?

Thanks,
Khushboo

On Wed, Jun 6, 2018 at 5:13 AM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi Khushboo

The tests are still failing and seems flaky:

Sincerely,

Victoria

On Tue, Jun 5, 2018 at 4:50 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 2:09 PM, Dave Page <dpage@pgadmin.org> wrote:


On Tue, Jun 5, 2018 at 9:37 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Tue, Jun 5, 2018 at 1:36 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Tue, Jun 5, 2018 at 4:39 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Mon, Jun 4, 2018 at 8:41 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hi Khushboo,

Some tests are failing in greenplum:
The piece of code responsible for the error is:
if server['default_binary_paths'] is not None:
test_utils.set_preference(server['default_binary_paths'])

config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": ""
}

Can you send me the test_config.json file?  The above code sets the paths to the SQLite database and through the logs couldn't figure out the exact failure. 

It seems clear from the code shown that it's not setting the binary paths for gpdb database servers. Shouldn't it be something like:

    config.DEFAULT_BINARY_PATHS = {
"pg": str(server['default_binary_paths']['pg']),
"ppas": str(server['default_binary_paths']['ppas']),
"gpdb": str(server['default_binary_paths']['gpdb'])
}
Without this code, the test cases should work as I already set  paths through below code.
    test_utils.set_preference(server['default_binary_paths'])

In that case, why is the code above required at all?

My bad. Removed this code and also updated set_preference function for greenplum database.
Please find the attached updated patch.
 
 

test_backup_utils.py file name is misleading, these are not tests, are helpers.



Thanks
Victoria & Joao

On Mon, Jun 4, 2018 at 1:36 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Sat, Jun 2, 2018 at 3:01 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

This looks good, except that it's leaving the test_restore_database behind. Can we clean that up please?

PFA updated patch. 
Thanks.

On Fri, Jun 1, 2018 at 7:06 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,

Thanks for reviewing the patch.
The tests were failing due to the latest commit #2b4605a9d390cb44e5dfe9967c3adf2b28d04f1f  - Ensure backup/restore/maintenance work via SSH tunnels. Fixes #3355

I have fixed the issues and attached the updated patch.

Thanks,
Khushboo 

On Thu, May 31, 2018 at 10:00 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi there,

We've been noticing some issues with the tests on both our CI and local Mac workstations.
  1. When the following code blocks are invoked - we get plenty of app.context() issues. It must not be valid when running tests.
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
manager = driver.connection_manager(self.sid)

host = manager.local_bind_host if manager.use_ssh_tunnel else s.host
port = manager.local_bind_port if manager.use_ssh_tunnel else s.port 
2. When we finally enable 
"default_binary_paths": {
in our test_config, we get more failing tests that look like:
======================================================================
FAIL: runTest (pgadmin.tools.restore.tests.test_restore_create_job_unit_test.RestoreCreateJobTest)
When restore object with option - Miscellaneous
----------------------------------------------------------------------
Traceback (most recent call last): File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/unittest/mock.py", line 1179, in patched   return func(*args, **keywargs) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py", line 295, in runTest   self.assertEquals(response.status_code, 200)
AssertionError: 410 != 200

And

When restore object with the sections options ... 2018-05-31 12:24:42,988: ERROR    pgadmin:    illegal environment variable name
Traceback (most recent call last): File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/tools/restore/__init__.py", line 352, in create_restore_job   manager.export_password_env(p.id) File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 365, in export_password_env   os.environ[str(env)] = password File "/Users/pivotal/.pyenv/versions/3.6.5/lib/python3.6/os.py", line 675, in __setitem__   self.putenv(key, value)
ValueError: illegal environment variable name
FAIL

Sincerely,

Victoria && Anthony

On Thu, May 31, 2018 at 1:16 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch with the fixes.
The test cases were only failing on MAC not on Linux.

Thanks,
Khushboo

On Wed, May 30, 2018 at 10:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:


On Wed, May 30, 2018 at 1:05 AM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, May 28, 2018 at 8:09 AM, Khushboo Vashi <khushboo.vashi@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 <span class="aciTreeItem">...</span> is not clickable at point (223, 604). Other element would receive the click: <div class="wcFrameCenter wcPanelBackground wcScrollableX wcScrollableY" style="left: 0px; right: 0px; bottom: 0px;">...</div>

  (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 <jdealmeidapereira@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_tests/pg_utilities_backup_test.py:59: [E501] line too long (85 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:62: [E501] line too long (96 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:63: [E501] line too long (91 > 79 characters)
./pgadmin/feature_tests/pg_utilities_backup_test.py:70: [E501] line too long (118 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:37: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_backup_message.py:48: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:49: [E251] unexpected spaces around keyword / parameter equals
./pgadmin/tools/backup/tests/test_backup_message.py:51: [E501] line too long (91 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:52: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:53: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:81: [E501] line too long (113 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:82: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:83: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:111: [E501] line too long (100 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:113: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:114: [E501] line too long (108 > 79 characters)
./pgadmin/tools/backup/tests/test_backup_message.py:147: [E501] line too long (93 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:40: [E121] continuation line under-indented for hanging indent
./pgadmin/tools/backup/tests/test_batch_process.py:51: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:135: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:137: [E501] line too long (83 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:138: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:139: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:140: [E122] continuation line missing indentation or outdented
./pgadmin/tools/backup/tests/test_batch_process.py:191: [E501] line too long (81 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:203: [E501] line too long (80 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:204: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E128] continuation line under-indented for visual indent
./pgadmin/tools/backup/tests/test_batch_process.py:205: [E501] line too long (94 > 79 characters)
./pgadmin/tools/backup/tests/test_batch_process.py:216: [W391] blank line at end of file
./pgadmin/tools/backup/tests/test_create_backup_job.py:296: [E501] line too long (97 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:317: [E303] too many blank lines (2)
./pgadmin/tools/backup/tests/test_create_backup_job.py:336: [E501] line too long (84 > 79 characters)
./pgadmin/tools/backup/tests/test_create_backup_job.py:371: [W391] blank line at end of file
2 E121 continuation line under-indented for hanging indent
5 E122 continuation line missing indentation or outdented
2 E128 continuation line under-indented for visual indent
2 E251 unexpected spaces around keyword / parameter equals
1 E303 too many blank lines (2)
24 E501 line too long (91 > 79 characters)
2 W391 blank line at end of file
38

For the feature tests, we realized we had to update the configuration, and we did that, but we get the following error attached. We spent some time trying to understand the problem but we were not successful.


Codewise:
- We just found some One Letter Variables in the code...
- Looks like there is a bug report in this area of the code and we do not have coverage for it: https://redmine.postgresql.org/issues/3232
  Looks like in some of the unit tests we only have happy path tests, maybe we should see if there are any sad paths that also need coverage.

The configuration change, maybe need to be updated. When we install multiple versions of postgres the binaries live in `/usr/lib/postgresql/{{db_version}}/bin`, which makes us think that this configuration should live near the server configuration, maybe? Also to maintain coherency on the naming maybe we should make it all lower case.
Just as an aside, you can add the gpdb configuration as well in you patch.

Thanks
Victoria & Joao

On Wed, Apr 25, 2018 at 5:20 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch which covers test cases for the backup module (RM #3206).

1. Unit test cases
2. End to end regression test cases 
3. Feature test cases

Thanks,
Khushboo







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

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


Attachment

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

From
Dave Page
Date:
Hi

On Fri, Jun 8, 2018 at 6:33 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Dave,

As per our discussion I have changed the window size to 1280X800, before it was 1280X900.
Please find the attached updated patch
 
I'm not sure that actually made any difference on my system. The window continued to look taller than it is wide, so I wonder if the code to set the size is being ignored, or is at the wrong place?

Anyway, I got 10 failures with this patch :-(

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

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 97, in runTest

    self.page.find_by_xpath("//div[contains(@class,'wcFloatingFocus')"

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.feature_tests.xss_checks_pgadmin_debugger_test.CheckDebuggerForXssFeatureTest)

Tests to check if Debugger is vulnerable to XSS

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 42, in runTest

    self._function_node_expandable()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 57, in _function_node_expandable

    self.page.select_tree_item("a_test_function()")

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 135, in select_tree_item

    "' and @class='aciTreeItem']").click()

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.tools.backup.tests.test_create_backup_job.BackupJobTest)

When backup the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_create_backup_job.py", line 58, in runTest

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.maintenance.tests.test_create_maintenance_job.MaintenanceJobTest)

When maintenance the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/maintenance/tests/test_create_maintenance_job.py", line 71, in runTest

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.restore.tests.test_create_restore_job.RestoreJobTest)

When restore the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 95, in runTest

    self.create_backup()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 86, in create_backup

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

FAIL: runTest (pgadmin.browser.server_groups.servers.databases.schemas.functions.tests.test_trigger_func_add.TriggerFuncAddTestCase)

Fetch Trigger Function Node URL

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/test_trigger_func_add.py", line 111, in runTest

    self.assertEquals(response.status_code, 200)

AssertionError: 500 != 200


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

FAIL: runTest (pgadmin.browser.server_groups.servers.databases.schemas.functions.tests.test_trigger_func_delete.TriggerFuncDeleteTestCase)

Fetch Trigger Function Node URL

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/test_trigger_func_delete.py", line 72, in runTest

    self.assertEquals(response.status_code, 200)

AssertionError: 500 != 200


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

FAIL: runTest (pgadmin.browser.server_groups.servers.databases.schemas.functions.tests.test_trigger_func_get.TriggerFuncGetTestCase)

Fetch Trigger Function Node URL

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/test_trigger_func_get.py", line 72, in runTest

    self.assertEquals(response.status_code, 200)

AssertionError: 500 != 200


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

FAIL: runTest (pgadmin.browser.server_groups.servers.databases.schemas.functions.tests.test_trigger_func_put.TriggerFuncPutTestCase)

Fetch Trigger Function Node URL

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/test_trigger_func_put.py", line 87, in runTest

    self.assertEquals(put_response.status_code, 200)

AssertionError: 500 != 200


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

FAIL: runTest (pgadmin.feature_tests.pg_utilities_maintenance_test.PGUtilitiesMaintenanceFeatureTest)

Test for PG maintenance: database pg_maintenance

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 63, in runTest

    self._verify_command()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 90, in _verify_command

    self.assertEquals(command, "VACUUM "

AssertionError: u'Backing up an object on the server \'Regression - PG 11 Feature Tests (localhost:5436)\' from database \'pg_utility_test_db\'...\nRunning command:\n/Library/PostgreSQL/11/bin/pg_dump --file "/Users/dpage/test_backup" --host "localhost" --port "5436" --username "postgres" --no-password --verbose --format=c --blobs "pg_utility_test_db"' != 'VACUUM (VERBOSE)\nRunning Query:\nVACUUM VERBOSE;'


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

FAIL: 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 63, in runTest

    self._verify_command()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 97, in _verify_command

    " public." + self.table_name + ";")

AssertionError: u'Backing up an object on the server \'Regression - PG 11 Feature Tests (localhost:5436)\' from database \'pg_utility_test_db\'...\nRunning command:\n/Library/PostgreSQL/11/bin/pg_dump --file "/Users/dpage/test_backup" --host "localhost" --port "5436" --username "postgres" --no-password --verbose --format=c --blobs "pg_utility_test_db"' != 'VACUUM (VERBOSE)\nRunning Query:\nVACUUM VERBOSE public.pg_maintenance_table;'


----------------------------------------------------------------------

Ran 369 tests in 417.660s


FAILED (failures=6, errors=5, skipped=13)


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

Test Result Summary

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


Regression - PG 11:


346 tests passed

10 tests failed:

TriggerFuncGetTestCase (Fetch Trigger Function Node URL)

MaintenanceJobTest (When maintenance the object with the default options)

TriggerFuncDeleteTestCase (Fetch Trigger Function Node URL)

TriggerFuncPutTestCase (Fetch Trigger Function Node URL)

RestoreJobTest (When restore the object with the default options)

CheckDebuggerForXssFeatureTest (Tests to check if Debugger is vulnerable to XSS)

TriggerFuncAddTestCase (Fetch Trigger Function Node URL)

PGUtilitiesBackupFeatureTest (Test for PG utilities - Backup and Restore)

PGUtilitiesMaintenanceFeatureTest (Test for PG maintenance: database,

Test for PG maintenance: database pg_maintenance)

BackupJobTest (When backup the object with the default options)

13 tests skipped:

SynonymDeleteTestCase (Fetch synonym Node URL)

SynonymGetTestCase (Fetch synonym Node URL)

PackageDeleteTestCase (Fetch Package Node URL)

ResourceGroupsGetTestCase (Get resource groups)

TestSSLConnection (Test for SSL connection)

ResourceGroupsAddTestCase (Add resource groups)

PackagePutTestCase (Fetch Package Node URL)

SynonymPutTestCase (Fetch synonym Node URL)

ResourceGroupsPutTestCase (Put resource groups)

ResourceGroupsDeleteTestCase (Delete resource groups)

SynonymAddTestCase (Default Node URL)

PackageAddTestCase (Fetch Package Node URL)

PackageGetTestCase (Fetch Package Node URL)


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

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

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

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

From
Khushboo Vashi
Date:
Hi,

Please find the attached patch excluding feature test cases.
Python test cases are working fine, so we can commit this patch. I am working on fixing the feature tests which are failing on the different window sizes.

Thanks,
Khushboo

On Fri, Jun 8, 2018 at 2:38 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Fri, Jun 8, 2018 at 6:33 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Dave,

As per our discussion I have changed the window size to 1280X800, before it was 1280X900.
Please find the attached updated patch
 
I'm not sure that actually made any difference on my system. The window continued to look taller than it is wide, so I wonder if the code to set the size is being ignored, or is at the wrong place?

Anyway, I got 10 failures with this patch :-(

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

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 97, in runTest

    self.page.find_by_xpath("//div[contains(@class,'wcFloatingFocus')"

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.feature_tests.xss_checks_pgadmin_debugger_test.CheckDebuggerForXssFeatureTest)

Tests to check if Debugger is vulnerable to XSS

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 42, in runTest

    self._function_node_expandable()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 57, in _function_node_expandable

    self.page.select_tree_item("a_test_function()")

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 135, in select_tree_item

    "' and @class='aciTreeItem']").click()

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.tools.backup.tests.test_create_backup_job.BackupJobTest)

When backup the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_create_backup_job.py", line 58, in runTest

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.maintenance.tests.test_create_maintenance_job.MaintenanceJobTest)

When maintenance the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/maintenance/tests/test_create_maintenance_job.py", line 71, in runTest

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.restore.tests.test_create_restore_job.RestoreJobTest)

When restore the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 95, in runTest

    self.create_backup()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 86, in create_backup

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

FAIL: runTest (pgadmin.browser.server_groups.servers.databases.schemas.functions.tests.test_trigger_func_add.TriggerFuncAddTestCase)

Fetch Trigger Function Node URL

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/test_trigger_func_add.py", line 111, in runTest

    self.assertEquals(response.status_code, 200)

AssertionError: 500 != 200


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

FAIL: runTest (pgadmin.browser.server_groups.servers.databases.schemas.functions.tests.test_trigger_func_delete.TriggerFuncDeleteTestCase)

Fetch Trigger Function Node URL

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/test_trigger_func_delete.py", line 72, in runTest

    self.assertEquals(response.status_code, 200)

AssertionError: 500 != 200


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

FAIL: runTest (pgadmin.browser.server_groups.servers.databases.schemas.functions.tests.test_trigger_func_get.TriggerFuncGetTestCase)

Fetch Trigger Function Node URL

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/test_trigger_func_get.py", line 72, in runTest

    self.assertEquals(response.status_code, 200)

AssertionError: 500 != 200


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

FAIL: runTest (pgadmin.browser.server_groups.servers.databases.schemas.functions.tests.test_trigger_func_put.TriggerFuncPutTestCase)

Fetch Trigger Function Node URL

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/test_trigger_func_put.py", line 87, in runTest

    self.assertEquals(put_response.status_code, 200)

AssertionError: 500 != 200


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

FAIL: runTest (pgadmin.feature_tests.pg_utilities_maintenance_test.PGUtilitiesMaintenanceFeatureTest)

Test for PG maintenance: database pg_maintenance

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 63, in runTest

    self._verify_command()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 90, in _verify_command

    self.assertEquals(command, "VACUUM "

AssertionError: u'Backing up an object on the server \'Regression - PG 11 Feature Tests (localhost:5436)\' from database \'pg_utility_test_db\'...\nRunning command:\n/Library/PostgreSQL/11/bin/pg_dump --file "/Users/dpage/test_backup" --host "localhost" --port "5436" --username "postgres" --no-password --verbose --format=c --blobs "pg_utility_test_db"' != 'VACUUM (VERBOSE)\nRunning Query:\nVACUUM VERBOSE;'


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

FAIL: 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 63, in runTest

    self._verify_command()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 97, in _verify_command

    " public." + self.table_name + ";")

AssertionError: u'Backing up an object on the server \'Regression - PG 11 Feature Tests (localhost:5436)\' from database \'pg_utility_test_db\'...\nRunning command:\n/Library/PostgreSQL/11/bin/pg_dump --file "/Users/dpage/test_backup" --host "localhost" --port "5436" --username "postgres" --no-password --verbose --format=c --blobs "pg_utility_test_db"' != 'VACUUM (VERBOSE)\nRunning Query:\nVACUUM VERBOSE public.pg_maintenance_table;'


----------------------------------------------------------------------

Ran 369 tests in 417.660s


FAILED (failures=6, errors=5, skipped=13)


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

Test Result Summary

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


Regression - PG 11:


346 tests passed

10 tests failed:

TriggerFuncGetTestCase (Fetch Trigger Function Node URL)

MaintenanceJobTest (When maintenance the object with the default options)

TriggerFuncDeleteTestCase (Fetch Trigger Function Node URL)

TriggerFuncPutTestCase (Fetch Trigger Function Node URL)

RestoreJobTest (When restore the object with the default options)

CheckDebuggerForXssFeatureTest (Tests to check if Debugger is vulnerable to XSS)

TriggerFuncAddTestCase (Fetch Trigger Function Node URL)

PGUtilitiesBackupFeatureTest (Test for PG utilities - Backup and Restore)

PGUtilitiesMaintenanceFeatureTest (Test for PG maintenance: database,

Test for PG maintenance: database pg_maintenance)

BackupJobTest (When backup the object with the default options)

13 tests skipped:

SynonymDeleteTestCase (Fetch synonym Node URL)

SynonymGetTestCase (Fetch synonym Node URL)

PackageDeleteTestCase (Fetch Package Node URL)

ResourceGroupsGetTestCase (Get resource groups)

TestSSLConnection (Test for SSL connection)

ResourceGroupsAddTestCase (Add resource groups)

PackagePutTestCase (Fetch Package Node URL)

SynonymPutTestCase (Fetch synonym Node URL)

ResourceGroupsPutTestCase (Put resource groups)

ResourceGroupsDeleteTestCase (Delete resource groups)

SynonymAddTestCase (Default Node URL)

PackageAddTestCase (Fetch Package Node URL)

PackageGetTestCase (Fetch Package Node URL)


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

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

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

Attachment

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

From
Khushboo Vashi
Date:
Please find the attached updated patch with some code cleanup.

On Tue, Jun 12, 2018 at 3:54 PM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch excluding feature test cases.
Python test cases are working fine, so we can commit this patch. I am working on fixing the feature tests which are failing on the different window sizes.

Thanks,
Khushboo

On Fri, Jun 8, 2018 at 2:38 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Fri, Jun 8, 2018 at 6:33 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Dave,

As per our discussion I have changed the window size to 1280X800, before it was 1280X900.
Please find the attached updated patch
 
I'm not sure that actually made any difference on my system. The window continued to look taller than it is wide, so I wonder if the code to set the size is being ignored, or is at the wrong place?

Anyway, I got 10 failures with this patch :-(

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

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 97, in runTest

    self.page.find_by_xpath("//div[contains(@class,'wcFloatingFocus')"

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.feature_tests.xss_checks_pgadmin_debugger_test.CheckDebuggerForXssFeatureTest)

Tests to check if Debugger is vulnerable to XSS

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 42, in runTest

    self._function_node_expandable()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 57, in _function_node_expandable

    self.page.select_tree_item("a_test_function()")

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 135, in select_tree_item

    "' and @class='aciTreeItem']").click()

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.tools.backup.tests.test_create_backup_job.BackupJobTest)

When backup the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_create_backup_job.py", line 58, in runTest

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.maintenance.tests.test_create_maintenance_job.MaintenanceJobTest)

When maintenance the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/maintenance/tests/test_create_maintenance_job.py", line 71, in runTest

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.restore.tests.test_create_restore_job.RestoreJobTest)

When restore the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 95, in runTest

    self.create_backup()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 86, in create_backup

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

FAIL: runTest (pgadmin.browser.server_groups.servers.databases.schemas.functions.tests.test_trigger_func_add.TriggerFuncAddTestCase)

Fetch Trigger Function Node URL

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/test_trigger_func_add.py", line 111, in runTest

    self.assertEquals(response.status_code, 200)

AssertionError: 500 != 200


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

FAIL: runTest (pgadmin.browser.server_groups.servers.databases.schemas.functions.tests.test_trigger_func_delete.TriggerFuncDeleteTestCase)

Fetch Trigger Function Node URL

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/test_trigger_func_delete.py", line 72, in runTest

    self.assertEquals(response.status_code, 200)

AssertionError: 500 != 200


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

FAIL: runTest (pgadmin.browser.server_groups.servers.databases.schemas.functions.tests.test_trigger_func_get.TriggerFuncGetTestCase)

Fetch Trigger Function Node URL

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/test_trigger_func_get.py", line 72, in runTest

    self.assertEquals(response.status_code, 200)

AssertionError: 500 != 200


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

FAIL: runTest (pgadmin.browser.server_groups.servers.databases.schemas.functions.tests.test_trigger_func_put.TriggerFuncPutTestCase)

Fetch Trigger Function Node URL

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/tests/test_trigger_func_put.py", line 87, in runTest

    self.assertEquals(put_response.status_code, 200)

AssertionError: 500 != 200


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

FAIL: runTest (pgadmin.feature_tests.pg_utilities_maintenance_test.PGUtilitiesMaintenanceFeatureTest)

Test for PG maintenance: database pg_maintenance

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 63, in runTest

    self._verify_command()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 90, in _verify_command

    self.assertEquals(command, "VACUUM "

AssertionError: u'Backing up an object on the server \'Regression - PG 11 Feature Tests (localhost:5436)\' from database \'pg_utility_test_db\'...\nRunning command:\n/Library/PostgreSQL/11/bin/pg_dump --file "/Users/dpage/test_backup" --host "localhost" --port "5436" --username "postgres" --no-password --verbose --format=c --blobs "pg_utility_test_db"' != 'VACUUM (VERBOSE)\nRunning Query:\nVACUUM VERBOSE;'


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

FAIL: 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 63, in runTest

    self._verify_command()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 97, in _verify_command

    " public." + self.table_name + ";")

AssertionError: u'Backing up an object on the server \'Regression - PG 11 Feature Tests (localhost:5436)\' from database \'pg_utility_test_db\'...\nRunning command:\n/Library/PostgreSQL/11/bin/pg_dump --file "/Users/dpage/test_backup" --host "localhost" --port "5436" --username "postgres" --no-password --verbose --format=c --blobs "pg_utility_test_db"' != 'VACUUM (VERBOSE)\nRunning Query:\nVACUUM VERBOSE public.pg_maintenance_table;'


----------------------------------------------------------------------

Ran 369 tests in 417.660s


FAILED (failures=6, errors=5, skipped=13)


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

Test Result Summary

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


Regression - PG 11:


346 tests passed

10 tests failed:

TriggerFuncGetTestCase (Fetch Trigger Function Node URL)

MaintenanceJobTest (When maintenance the object with the default options)

TriggerFuncDeleteTestCase (Fetch Trigger Function Node URL)

TriggerFuncPutTestCase (Fetch Trigger Function Node URL)

RestoreJobTest (When restore the object with the default options)

CheckDebuggerForXssFeatureTest (Tests to check if Debugger is vulnerable to XSS)

TriggerFuncAddTestCase (Fetch Trigger Function Node URL)

PGUtilitiesBackupFeatureTest (Test for PG utilities - Backup and Restore)

PGUtilitiesMaintenanceFeatureTest (Test for PG maintenance: database,

Test for PG maintenance: database pg_maintenance)

BackupJobTest (When backup the object with the default options)

13 tests skipped:

SynonymDeleteTestCase (Fetch synonym Node URL)

SynonymGetTestCase (Fetch synonym Node URL)

PackageDeleteTestCase (Fetch Package Node URL)

ResourceGroupsGetTestCase (Get resource groups)

TestSSLConnection (Test for SSL connection)

ResourceGroupsAddTestCase (Add resource groups)

PackagePutTestCase (Fetch Package Node URL)

SynonymPutTestCase (Fetch synonym Node URL)

ResourceGroupsPutTestCase (Put resource groups)

ResourceGroupsDeleteTestCase (Delete resource groups)

SynonymAddTestCase (Default Node URL)

PackageAddTestCase (Fetch Package Node URL)

PackageGetTestCase (Fetch Package Node URL)


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

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

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


Attachment

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

From
Victoria Henry
Date:
Hi Khushboo
can you explain a little bit more this while loop?

cnt = 0
while 1:
if cnt > 1:
break
# Check the process list
response1 = self.tester.get('/misc/bgprocess/?_='.format(
random.randint(1, 9999999)))
self.assertEquals(response1.status_code, 200)
process_list = json.loads(response1.data.decode('utf-8'))

if len(process_list) > 0 and 'execution_time' in process_list[0]:
break
time.sleep(0.5)
cnt += 1
From what it looks like this will only run twice, maybe a for would be a better solution because we know it will only run twice. Also are we sure we only want it to run twice?

We are using PyCharm to do our developments and we notice there are a big group of unused variables throughout. We should remove them if they are not needed. Not sure if your editor also shows that information or not. 
Do you know if there is a configuration in pycodestyle to enable the check for unused variables? That would help a lot.

The code
assert 'execution_time' in process_list[0]
assert 'stime' in process_list[0]
assert 'exit_code' in process_list[0]
assert process_list[0]['exit_code'] in self.expected_exit_code

in test_Create_restore_job should use self.assertEqual or similar from unittest instead of plain assert. Because when something fails we do not have a way to understand what was wrong.
The tests on the restore are still failing GreenPlum.




Thanks
Victoria & Joao

On Tue, Jun 12, 2018 at 6:44 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Please find the attached updated patch with some code cleanup.

On Tue, Jun 12, 2018 at 3:54 PM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch excluding feature test cases.
Python test cases are working fine, so we can commit this patch. I am working on fixing the feature tests which are failing on the different window sizes.

Thanks,
Khushboo

On Fri, Jun 8, 2018 at 2:38 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Fri, Jun 8, 2018 at 6:33 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Dave,

As per our discussion I have changed the window size to 1280X800, before it was 1280X900.
Please find the attached updated patch
 
I'm not sure that actually made any difference on my system. The window continued to look taller than it is wide, so I wonder if the code to set the size is being ignored, or is at the wrong place?

Anyway, I got 10 failures with this patch :-(

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

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 97, in runTest

    self.page.find_by_xpath("//div[contains(@class,'wcFloatingFocus')"

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.feature_tests.xss_checks_pgadmin_debugger_test.CheckDebuggerForXssFeatureTest)

Tests to check if Debugger is vulnerable to XSS

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 42, in runTest

    self._function_node_expandable()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 57, in _function_node_expandable

    self.page.select_tree_item("a_test_function()")

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 135, in select_tree_item

    "' and @class='aciTreeItem']").click()

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.tools.backup.tests.test_create_backup_job.BackupJobTest)

When backup the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_create_backup_job.py", line 58, in runTest

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.maintenance.tests.test_create_maintenance_job.MaintenanceJobTest)

When maintenance the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/maintenance/tests/test_create_maintenance_job.py", line 71, in runTest

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.restore.tests.test_create_restore_job.RestoreJobTest)

When restore the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 95, in runTest

    self.create_backup()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 86, in create_backup

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

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

From
Khushboo Vashi
Date:
Hi Victoria,


On Tue, Jun 12, 2018 at 9:06 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi Khushboo
can you explain a little bit more this while loop?

cnt = 0
while 1:
if cnt > 1:
break
# Check the process list
response1 = self.tester.get('/misc/bgprocess/?_='.format(
random.randint(1, 9999999)))
self.assertEquals(response1.status_code, 200)
process_list = json.loads(response1.data.decode('utf-8'))

if len(process_list) > 0 and 'execution_time' in process_list[0]:
break
time.sleep(0.5)
cnt += 1
From what it looks like this will only run twice, maybe a for would be a better solution because we know it will only run twice. Also are we sure we only want it to run twice?

The code waits till the background process completes. So, while I originally developed, not intended to run only twice. 
But after that I put a kind of break point and that remains there. So, I will remove that if condition which is not required.
We are using PyCharm to do our developments and we notice there are a big group of unused variables throughout. We should remove them if they are not needed. Not sure if your editor also shows that information or not.  
Do you know if there is a configuration in pycodestyle to enable the check for unused variables? That would help a lot.

Thanks for sharing the information. 
The code
assert 'execution_time' in process_list[0]
assert 'stime' in process_list[0]
assert 'exit_code' in process_list[0]
assert process_list[0]['exit_code'] in self.expected_exit_code

in test_Create_restore_job should use self.assertEqual or similar from unittest instead of plain assert. Because when something fails we do not have a way to understand what was wrong.

Will do. 

The tests on the restore are still failing GreenPlum.

It is failing because, Restore is not working with GreenPlum. Can you please look into the Restore functionality for GPDB?


Thanks,
Khushboo 



Thanks
Victoria & Joao

On Tue, Jun 12, 2018 at 6:44 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Please find the attached updated patch with some code cleanup.

On Tue, Jun 12, 2018 at 3:54 PM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch excluding feature test cases.
Python test cases are working fine, so we can commit this patch. I am working on fixing the feature tests which are failing on the different window sizes.

Thanks,
Khushboo

On Fri, Jun 8, 2018 at 2:38 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Fri, Jun 8, 2018 at 6:33 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Dave,

As per our discussion I have changed the window size to 1280X800, before it was 1280X900.
Please find the attached updated patch
 
I'm not sure that actually made any difference on my system. The window continued to look taller than it is wide, so I wonder if the code to set the size is being ignored, or is at the wrong place?

Anyway, I got 10 failures with this patch :-(

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

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 97, in runTest

    self.page.find_by_xpath("//div[contains(@class,'wcFloatingFocus')"

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.feature_tests.xss_checks_pgadmin_debugger_test.CheckDebuggerForXssFeatureTest)

Tests to check if Debugger is vulnerable to XSS

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 42, in runTest

    self._function_node_expandable()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 57, in _function_node_expandable

    self.page.select_tree_item("a_test_function()")

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 135, in select_tree_item

    "' and @class='aciTreeItem']").click()

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.tools.backup.tests.test_create_backup_job.BackupJobTest)

When backup the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_create_backup_job.py", line 58, in runTest

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.maintenance.tests.test_create_maintenance_job.MaintenanceJobTest)

When maintenance the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/maintenance/tests/test_create_maintenance_job.py", line 71, in runTest

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.restore.tests.test_create_restore_job.RestoreJobTest)

When restore the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 95, in runTest

    self.create_backup()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 86, in create_backup

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)


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

From
Khushboo Vashi
Date:
Hi,

Please find the attached updated patch.

On Wed, Jun 13, 2018 at 5:42 PM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,


On Tue, Jun 12, 2018 at 9:06 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi Khushboo
can you explain a little bit more this while loop?

cnt = 0
while 1:
if cnt > 1:
break
# Check the process list
response1 = self.tester.get('/misc/bgprocess/?_='.format(
random.randint(1, 9999999)))
self.assertEquals(response1.status_code, 200)
process_list = json.loads(response1.data.decode('utf-8'))

if len(process_list) > 0 and 'execution_time' in process_list[0]:
break
time.sleep(0.5)
cnt += 1
From what it looks like this will only run twice, maybe a for would be a better solution because we know it will only run twice. Also are we sure we only want it to run twice?

The code waits till the background process completes. So, while I originally developed, not intended to run only twice. 
But after that I put a kind of break point and that remains there. So, I will remove that if condition which is not required.
I have made maximum 5 attempts. 
We are using PyCharm to do our developments and we notice there are a big group of unused variables throughout. We should remove them if they are not needed. Not sure if your editor also shows that information or not.  
Do you know if there is a configuration in pycodestyle to enable the check for unused variables? That would help a lot.

Removed unused local variables. 
Thanks for sharing the information. 
The code
assert 'execution_time' in process_list[0]
assert 'stime' in process_list[0]
assert 'exit_code' in process_list[0]
assert process_list[0]['exit_code'] in self.expected_exit_code

in test_Create_restore_job should use self.assertEqual or similar from unittest instead of plain assert. Because when something fails we do not have a way to understand what was wrong.

Will do. 
Done 

The tests on the restore are still failing GreenPlum.

It is failing because, Restore is not working with GreenPlum. Can you please look into the Restore functionality for GPDB?


Thanks,
Khushboo 


Thanks,
Khushboo 

Thanks
Victoria & Joao

On Tue, Jun 12, 2018 at 6:44 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Please find the attached updated patch with some code cleanup.

On Tue, Jun 12, 2018 at 3:54 PM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch excluding feature test cases.
Python test cases are working fine, so we can commit this patch. I am working on fixing the feature tests which are failing on the different window sizes.

Thanks,
Khushboo

On Fri, Jun 8, 2018 at 2:38 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Fri, Jun 8, 2018 at 6:33 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Dave,

As per our discussion I have changed the window size to 1280X800, before it was 1280X900.
Please find the attached updated patch
 
I'm not sure that actually made any difference on my system. The window continued to look taller than it is wide, so I wonder if the code to set the size is being ignored, or is at the wrong place?

Anyway, I got 10 failures with this patch :-(

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

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 97, in runTest

    self.page.find_by_xpath("//div[contains(@class,'wcFloatingFocus')"

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.feature_tests.xss_checks_pgadmin_debugger_test.CheckDebuggerForXssFeatureTest)

Tests to check if Debugger is vulnerable to XSS

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 42, in runTest

    self._function_node_expandable()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 57, in _function_node_expandable

    self.page.select_tree_item("a_test_function()")

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 135, in select_tree_item

    "' and @class='aciTreeItem']").click()

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.tools.backup.tests.test_create_backup_job.BackupJobTest)

When backup the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_create_backup_job.py", line 58, in runTest

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.maintenance.tests.test_create_maintenance_job.MaintenanceJobTest)

When maintenance the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/maintenance/tests/test_create_maintenance_job.py", line 71, in runTest

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.restore.tests.test_create_restore_job.RestoreJobTest)

When restore the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 95, in runTest

    self.create_backup()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 86, in create_backup

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)



Attachment

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

From
Dave Page
Date:
Thanks, applied with a few tweaks to remove some unused imports and a couple of variables.

On Fri, Jun 15, 2018 at 8:13 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached updated patch.

On Wed, Jun 13, 2018 at 5:42 PM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Victoria,


On Tue, Jun 12, 2018 at 9:06 PM, Victoria Henry <vhenry@pivotal.io> wrote:
Hi Khushboo
can you explain a little bit more this while loop?

cnt = 0
while 1:
if cnt > 1:
break
# Check the process list
response1 = self.tester.get('/misc/bgprocess/?_='.format(
random.randint(1, 9999999)))
self.assertEquals(response1.status_code, 200)
process_list = json.loads(response1.data.decode('utf-8'))

if len(process_list) > 0 and 'execution_time' in process_list[0]:
break
time.sleep(0.5)
cnt += 1
From what it looks like this will only run twice, maybe a for would be a better solution because we know it will only run twice. Also are we sure we only want it to run twice?

The code waits till the background process completes. So, while I originally developed, not intended to run only twice. 
But after that I put a kind of break point and that remains there. So, I will remove that if condition which is not required.
I have made maximum 5 attempts. 
We are using PyCharm to do our developments and we notice there are a big group of unused variables throughout. We should remove them if they are not needed. Not sure if your editor also shows that information or not.  
Do you know if there is a configuration in pycodestyle to enable the check for unused variables? That would help a lot.

Removed unused local variables. 
Thanks for sharing the information. 
The code
assert 'execution_time' in process_list[0]
assert 'stime' in process_list[0]
assert 'exit_code' in process_list[0]
assert process_list[0]['exit_code'] in self.expected_exit_code

in test_Create_restore_job should use self.assertEqual or similar from unittest instead of plain assert. Because when something fails we do not have a way to understand what was wrong.

Will do. 
Done 

The tests on the restore are still failing GreenPlum.

It is failing because, Restore is not working with GreenPlum. Can you please look into the Restore functionality for GPDB?


Thanks,
Khushboo 


Thanks,
Khushboo 

Thanks
Victoria & Joao

On Tue, Jun 12, 2018 at 6:44 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Please find the attached updated patch with some code cleanup.

On Tue, Jun 12, 2018 at 3:54 PM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

Please find the attached patch excluding feature test cases.
Python test cases are working fine, so we can commit this patch. I am working on fixing the feature tests which are failing on the different window sizes.

Thanks,
Khushboo

On Fri, Jun 8, 2018 at 2:38 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Fri, Jun 8, 2018 at 6:33 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Dave,

As per our discussion I have changed the window size to 1280X800, before it was 1280X900.
Please find the attached updated patch
 
I'm not sure that actually made any difference on my system. The window continued to look taller than it is wide, so I wonder if the code to set the size is being ignored, or is at the wrong place?

Anyway, I got 10 failures with this patch :-(

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

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 97, in runTest

    self.page.find_by_xpath("//div[contains(@class,'wcFloatingFocus')"

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.feature_tests.xss_checks_pgadmin_debugger_test.CheckDebuggerForXssFeatureTest)

Tests to check if Debugger is vulnerable to XSS

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 42, in runTest

    self._function_node_expandable()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py", line 57, in _function_node_expandable

    self.page.select_tree_item("a_test_function()")

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 135, in select_tree_item

    "' and @class='aciTreeItem']").click()

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 171, in find_by_xpath

    lambda driver: driver.find_element_by_xpath(xpath)

  File "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py", line 263, in wait_for_element

    return self._wait_for("element to exist", element_if_it_exists)

  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 element to exist



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

ERROR: runTest (pgadmin.tools.backup.tests.test_create_backup_job.BackupJobTest)

When backup the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_create_backup_job.py", line 58, in runTest

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.maintenance.tests.test_create_maintenance_job.MaintenanceJobTest)

When maintenance the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/maintenance/tests/test_create_maintenance_job.py", line 71, in runTest

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask_login.py", line 792, in decorated_view

    return func(*args, **kwargs)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/__init__.py", line 62, in index

    return make_response(response=BatchProcess.list())

  File "/Users/dpage/git/pgadmin4/web/pgadmin/misc/bgprocess/processes.py", line 584, in list

    details = desc.details(p.command, args)

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 159, in details

    name, host, port = self.get_server_details()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/__init__.py", line 122, in get_server_details

    host = manager.local_bind_host if manager.use_ssh_tunnel else s.host

AttributeError: 'NoneType' object has no attribute 'use_ssh_tunnel'


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

ERROR: runTest (pgadmin.tools.restore.tests.test_create_restore_job.RestoreJobTest)

When restore the object with the default options

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 95, in runTest

    self.create_backup()

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/restore/tests/test_create_restore_job.py", line 86, in create_backup

    self.assertNotIn

  File "/Users/dpage/git/pgadmin4/web/pgadmin/tools/backup/tests/test_backup_utils.py", line 33, in run_backup_job

    random.randint(1, 9999999)))

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 830, in get

    return self.open(*args, **kw)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/testing.py", line 127, in open

    follow_redirects=follow_redirects)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 803, in open

    response = self.run_wsgi_app(environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 716, in run_wsgi_app

    rv = run_wsgi_app(self.application, environ, buffered=buffered)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/werkzeug/test.py", line 923, in run_wsgi_app

    app_rv = app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app

    response = self.handle_exception(e)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

    response = self.full_dispatch_request()

  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

    rv = self.handle_user_exception(e)






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

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