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

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Khushboo Vashi <khushboo(dot)vashi(at)enterprisedb(dot)com>
Cc: Victoria Henry <vhenry(at)pivotal(dot)io>, Joao De Almeida Pereira <jdealmeidapereira(at)pivotal(dot)io>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgadmin4][Patch]: Test cases for the backup module
Date: 2018-06-08 09:08:42
Message-ID: CA+OCxoz3rKAmbim2BQxyRSO+6OAwV9frWVPk93BHpYfKuwWktA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi

On Fri, Jun 8, 2018 at 6:33 AM, Khushboo Vashi <
khushboo(dot)vashi(at)enterprisedb(dot)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 Content-Type Size
PGUtilitiesMaintenanceFeatureTest-2018.06.08_09.58.10-Python-2.7.10.png image/png 207.1 KB
CheckDebuggerForXssFeatureTest-2018.06.08_10.02.24-Python-2.7.10.png image/png 207.3 KB
PGUtilitiesBackupFeatureTest-2018.06.08_09.57.51-Python-2.7.10.png image/png 223.3 KB
PGUtilitiesMaintenanceFeatureTest-2018.06.08_09.58.00-Python-2.7.10.png image/png 156.0 KB
PGUtilitiesMaintenanceFeatureTest-2018.06.08_09.58.10-Python-2.7.10.png image/png 207.1 KB

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Victoria Henry 2018-06-08 14:49:20 Re: [pgadmin][patch] Electron version 4.X
Previous Message Dave Page 2018-06-08 08:51:34 Re: [pgAdmin4][Patch]: RM 3362 - Fix the functions for PG v11, and add support procedure for PG v11