public inbox for [email protected]help / color / mirror / Atom feed
[pgAdmin][patch] Use unique DB name in ERD API test cases 4+ messages / 2 participants [nested] [flat]
* [pgAdmin][patch] Use unique DB name in ERD API test cases @ 2021-02-03 10:30 Aditya Toshniwal <[email protected]> 0 siblings, 1 reply; 4+ messages in thread From: Aditya Toshniwal @ 2021-02-03 10:30 UTC (permalink / raw) To: pgadmin-hackers Hi Hackers, Attached is the patch to use unique DB names in ERD API test cases to avoid conflict when running test cases in parallel. Please review. -- Thanks, Aditya Toshniwal pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com* <http://edbpostgres.com; "Don't Complain about Heat, Plant a TREE" Attachments: [application/octet-stream] ERD.apitests.patch (5.4K, 3-ERD.apitests.patch) download | inline diff: diff --git a/web/pgadmin/tools/erd/tests/test_close.py b/web/pgadmin/tools/erd/tests/test_close.py index ef7291522..e334bf92a 100644 --- a/web/pgadmin/tools/erd/tests/test_close.py +++ b/web/pgadmin/tools/erd/tests/test_close.py @@ -7,8 +7,7 @@ # ########################################################################## -import json - +import uuid from pgadmin.utils.route import BaseTestGenerator from regression.python_test_utils import test_utils as utils from regression import parent_node_dict @@ -20,7 +19,7 @@ from pgadmin.browser.server_groups.servers.databases.tests import utils as \ class ERDClose(BaseTestGenerator): def setUp(self): - self.db_name = "erdtestdb" + self.db_name = "erdtestdb_{0}".format(str(uuid.uuid4())[1:8]) self.sid = parent_node_dict["server"][-1]["server_id"] self.did = utils.create_database(self.server, self.db_name) self.sgid = config_data["server_group"] diff --git a/web/pgadmin/tools/erd/tests/test_initialize.py b/web/pgadmin/tools/erd/tests/test_initialize.py index 323c009e9..bd6eb2c0c 100644 --- a/web/pgadmin/tools/erd/tests/test_initialize.py +++ b/web/pgadmin/tools/erd/tests/test_initialize.py @@ -8,7 +8,7 @@ ########################################################################## import json - +import uuid from pgadmin.utils.route import BaseTestGenerator from regression.python_test_utils import test_utils as utils from regression import parent_node_dict @@ -20,7 +20,7 @@ from pgadmin.browser.server_groups.servers.databases.tests import utils as \ class ERDInitialize(BaseTestGenerator): def setUp(self): - self.db_name = "erdtestdb" + self.db_name = "erdtestdb_{0}".format(str(uuid.uuid4())[1:8]) self.sid = parent_node_dict["server"][-1]["server_id"] self.did = utils.create_database(self.server, self.db_name) self.sgid = config_data["server_group"] diff --git a/web/pgadmin/tools/erd/tests/test_panel.py b/web/pgadmin/tools/erd/tests/test_panel.py index f04e432b4..63601cb3d 100644 --- a/web/pgadmin/tools/erd/tests/test_panel.py +++ b/web/pgadmin/tools/erd/tests/test_panel.py @@ -7,8 +7,7 @@ # ########################################################################## -import json - +import uuid from pgadmin.utils.route import BaseTestGenerator from regression.python_test_utils import test_utils as utils from regression import parent_node_dict @@ -20,7 +19,7 @@ from pgadmin.browser.server_groups.servers.databases.tests import utils as \ class ERDPanel(BaseTestGenerator): def setUp(self): - self.db_name = "erdtestdb" + self.db_name = "erdtestdb_{0}".format(str(uuid.uuid4())[1:8]) self.sid = parent_node_dict["server"][-1]["server_id"] self.did = utils.create_database(self.server, self.db_name) self.sgid = config_data["server_group"] diff --git a/web/pgadmin/tools/erd/tests/test_prequisite.py b/web/pgadmin/tools/erd/tests/test_prequisite.py index 3cb922599..926280d41 100644 --- a/web/pgadmin/tools/erd/tests/test_prequisite.py +++ b/web/pgadmin/tools/erd/tests/test_prequisite.py @@ -8,7 +8,7 @@ ########################################################################## import json - +import uuid from pgadmin.utils.route import BaseTestGenerator from regression.python_test_utils import test_utils as utils from regression import parent_node_dict @@ -20,7 +20,7 @@ from pgadmin.browser.server_groups.servers.databases.tests import utils as \ class ERDPrequisite(BaseTestGenerator): def setUp(self): - self.db_name = "erdtestdb" + self.db_name = "erdtestdb_{0}".format(str(uuid.uuid4())[1:8]) self.sid = parent_node_dict["server"][-1]["server_id"] self.did = utils.create_database(self.server, self.db_name) self.sgid = config_data["server_group"] diff --git a/web/pgadmin/tools/erd/tests/test_sql.py b/web/pgadmin/tools/erd/tests/test_sql.py index 49e630a78..8240397f3 100644 --- a/web/pgadmin/tools/erd/tests/test_sql.py +++ b/web/pgadmin/tools/erd/tests/test_sql.py @@ -8,7 +8,7 @@ ########################################################################## import json - +import uuid from pgadmin.utils.route import BaseTestGenerator from regression.python_test_utils import test_utils as utils from regression import parent_node_dict @@ -23,7 +23,7 @@ from os import path class ERDSql(BaseTestGenerator): def setUp(self): - self.db_name = "erdtestdb" + self.db_name = "erdtestdb_{0}".format(str(uuid.uuid4())[1:8]) self.sid = parent_node_dict["server"][-1]["server_id"] self.did = utils.create_database(self.server, self.db_name) self.sgid = config_data["server_group"] diff --git a/web/pgadmin/tools/erd/tests/test_tables.py b/web/pgadmin/tools/erd/tests/test_tables.py index 3c5fcf0e7..8c3794eaf 100644 --- a/web/pgadmin/tools/erd/tests/test_tables.py +++ b/web/pgadmin/tools/erd/tests/test_tables.py @@ -9,7 +9,6 @@ import json import uuid - from pgadmin.utils.route import BaseTestGenerator from regression.python_test_utils import test_utils as utils from regression import parent_node_dict @@ -33,7 +32,7 @@ class ERDTables(BaseTestGenerator): utils.drop_database(connection, self.db_name) def setUp(self): - self.db_name = "erdtestdb" + self.db_name = "erdtestdb_{0}".format(str(uuid.uuid4())[1:8]) self.sid = parent_node_dict["server"][-1]["server_id"] self.did = utils.create_database(self.server, self.db_name) ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [pgAdmin][patch] Use unique DB name in ERD API test cases @ 2021-02-03 11:19 Akshay Joshi <[email protected]> parent: Aditya Toshniwal <[email protected]> 0 siblings, 1 reply; 4+ messages in thread From: Akshay Joshi @ 2021-02-03 11:19 UTC (permalink / raw) To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers Thanks, patch applied. On Wed, Feb 3, 2021 at 4:01 PM Aditya Toshniwal < [email protected]> wrote: > Hi Hackers, > > Attached is the patch to use unique DB names in ERD API test cases to > avoid conflict when running test cases in parallel. > Please review. > > -- > Thanks, > Aditya Toshniwal > pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com* > <http://edbpostgres.com; > "Don't Complain about Heat, Plant a TREE" > -- *Thanks & Regards* *Akshay Joshi* *pgAdmin Hacker | Principal Software Architect* *EDB Postgres <http://edbpostgres.com>* *Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [pgAdmin][patch] Use unique DB name in ERD API test cases @ 2021-02-04 09:31 Aditya Toshniwal <[email protected]> parent: Akshay Joshi <[email protected]> 0 siblings, 1 reply; 4+ messages in thread From: Aditya Toshniwal @ 2021-02-04 09:31 UTC (permalink / raw) To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers Hi, Seems like the test cases are still failing on the build machines. Attached is the patch to make the connection ids unique by using random. Please review. On Wed, Feb 3, 2021 at 4:49 PM Akshay Joshi <[email protected]> wrote: > Thanks, patch applied. > > On Wed, Feb 3, 2021 at 4:01 PM Aditya Toshniwal < > [email protected]> wrote: > >> Hi Hackers, >> >> Attached is the patch to use unique DB names in ERD API test cases to >> avoid conflict when running test cases in parallel. >> Please review. >> >> -- >> Thanks, >> Aditya Toshniwal >> pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com* >> <http://edbpostgres.com; >> "Don't Complain about Heat, Plant a TREE" >> > > > -- > *Thanks & Regards* > *Akshay Joshi* > *pgAdmin Hacker | Principal Software Architect* > *EDB Postgres <http://edbpostgres.com>* > > *Mobile: +91 976-788-8246* > -- Thanks, Aditya Toshniwal pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com* <http://edbpostgres.com; "Don't Complain about Heat, Plant a TREE" Attachments: [application/octet-stream] ERD.apitests_v2.patch (7.0K, 3-ERD.apitests_v2.patch) download | inline diff: diff --git a/web/pgadmin/tools/erd/__init__.py b/web/pgadmin/tools/erd/__init__.py index 8294a31a9..97a04d3da 100644 --- a/web/pgadmin/tools/erd/__init__.py +++ b/web/pgadmin/tools/erd/__init__.py @@ -561,6 +561,7 @@ def sql(trans_id, sgid, sid, did): @login_required def tables(trans_id, sgid, sid, did): helper = ERDHelper(trans_id, sid, did) + conn = _get_connection(sid, did, trans_id) status, tables = helper.get_all_tables() if not status: diff --git a/web/pgadmin/tools/erd/tests/test_close.py b/web/pgadmin/tools/erd/tests/test_close.py index e334bf92a..98c51c5f8 100644 --- a/web/pgadmin/tools/erd/tests/test_close.py +++ b/web/pgadmin/tools/erd/tests/test_close.py @@ -8,6 +8,7 @@ ########################################################################## import uuid +import random from pgadmin.utils.route import BaseTestGenerator from regression.python_test_utils import test_utils as utils from regression import parent_node_dict @@ -33,14 +34,15 @@ class ERDClose(BaseTestGenerator): if not db_con["info"] == "Database connected.": raise Exception("Could not connect to database to add the schema.") + trans_id = random.randint(1, 9999999) url = '/erd/initialize/{trans_id}/{sgid}/{sid}/{did}'.format( - trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did) + trans_id=trans_id, sgid=self.sgid, sid=self.sid, did=self.did) response = self.tester.post(url) self.assertEqual(response.status_code, 200) url = '/erd/close/{trans_id}/{sgid}/{sid}/{did}'.format( - trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did) + trans_id=trans_id, sgid=self.sgid, sid=self.sid, did=self.did) response = self.tester.delete(url) self.assertEqual(response.status_code, 200) diff --git a/web/pgadmin/tools/erd/tests/test_initialize.py b/web/pgadmin/tools/erd/tests/test_initialize.py index bd6eb2c0c..9eb6163c5 100644 --- a/web/pgadmin/tools/erd/tests/test_initialize.py +++ b/web/pgadmin/tools/erd/tests/test_initialize.py @@ -9,6 +9,7 @@ import json import uuid +import random from pgadmin.utils.route import BaseTestGenerator from regression.python_test_utils import test_utils as utils from regression import parent_node_dict @@ -34,14 +35,15 @@ class ERDInitialize(BaseTestGenerator): if not db_con["info"] == "Database connected.": raise Exception("Could not connect to database to add the schema.") + trans_id = random.randint(1, 9999999) url = '/erd/initialize/{trans_id}/{sgid}/{sid}/{did}'.format( - trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did) + trans_id=trans_id, sgid=self.sgid, sid=self.sid, did=self.did) response = self.tester.post(url) self.assertEqual(response.status_code, 200) response_data = json.loads(response.data.decode('utf-8')) self.assertEqual(response_data['data'], { - 'connId': '123344', + 'connId': str(trans_id), 'serverVersion': self.server_information['server_version'], }) diff --git a/web/pgadmin/tools/erd/tests/test_panel.py b/web/pgadmin/tools/erd/tests/test_panel.py index 63601cb3d..44adf906b 100644 --- a/web/pgadmin/tools/erd/tests/test_panel.py +++ b/web/pgadmin/tools/erd/tests/test_panel.py @@ -8,6 +8,7 @@ ########################################################################## import uuid +import random from pgadmin.utils.route import BaseTestGenerator from regression.python_test_utils import test_utils as utils from regression import parent_node_dict @@ -25,9 +26,11 @@ class ERDPanel(BaseTestGenerator): self.sgid = config_data["server_group"] def runTest(self): + trans_id = random.randint(1, 9999999) url = '/erd/panel/{trans_id}?sgid={sgid}&sid={sid}&server_type=pg' \ '&did={did}&gen=false'.\ - format(trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did) + format(trans_id=trans_id, sgid=self.sgid, sid=self.sid, + did=self.did) response = self.tester.post( url, data={"title": "panel_title", "close_url": "the/close/url"}, diff --git a/web/pgadmin/tools/erd/tests/test_prequisite.py b/web/pgadmin/tools/erd/tests/test_prequisite.py index 926280d41..138ab74c0 100644 --- a/web/pgadmin/tools/erd/tests/test_prequisite.py +++ b/web/pgadmin/tools/erd/tests/test_prequisite.py @@ -9,6 +9,7 @@ import json import uuid +import random from pgadmin.utils.route import BaseTestGenerator from regression.python_test_utils import test_utils as utils from regression import parent_node_dict @@ -34,8 +35,9 @@ class ERDPrequisite(BaseTestGenerator): if not db_con["info"] == "Database connected.": raise Exception("Could not connect to database to add the schema.") + trans_id = random.randint(1, 9999999) url = '/erd/prequisite/{trans_id}/{sgid}/{sid}/{did}'.format( - trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did) + trans_id=trans_id, sgid=self.sgid, sid=self.sid, did=self.did) response = self.tester.get(url) self.assertEqual(response.status_code, 200) diff --git a/web/pgadmin/tools/erd/tests/test_sql.py b/web/pgadmin/tools/erd/tests/test_sql.py index 8240397f3..15276c1cd 100644 --- a/web/pgadmin/tools/erd/tests/test_sql.py +++ b/web/pgadmin/tools/erd/tests/test_sql.py @@ -9,6 +9,7 @@ import json import uuid +import random from pgadmin.utils.route import BaseTestGenerator from regression.python_test_utils import test_utils as utils from regression import parent_node_dict @@ -62,8 +63,9 @@ class ERDSql(BaseTestGenerator): if not db_con["info"] == "Database connected.": raise Exception("Could not connect to database to add the schema.") + trans_id = random.randint(1, 9999999) url = '/erd/sql/{trans_id}/{sgid}/{sid}/{did}'.format( - trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did) + trans_id=trans_id, sgid=self.sgid, sid=self.sid, did=self.did) curr_dir = path.dirname(__file__) diff --git a/web/pgadmin/tools/erd/tests/test_tables.py b/web/pgadmin/tools/erd/tests/test_tables.py index 8c3794eaf..8bf754c0b 100644 --- a/web/pgadmin/tools/erd/tests/test_tables.py +++ b/web/pgadmin/tools/erd/tests/test_tables.py @@ -9,6 +9,7 @@ import json import uuid +import random from pgadmin.utils.route import BaseTestGenerator from regression.python_test_utils import test_utils as utils from regression import parent_node_dict @@ -64,8 +65,9 @@ class ERDTables(BaseTestGenerator): if not db_con["info"] == "Database connected.": raise Exception("Could not connect to database to add the schema.") + trans_id = random.randint(1, 9999999) url = '/erd/tables/{trans_id}/{sgid}/{sid}/{did}'.format( - trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did) + trans_id=trans_id, sgid=self.sgid, sid=self.sid, did=self.did) response = self.tester.get(url) self.assertEqual(response.status_code, 200) ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [pgAdmin][patch] Use unique DB name in ERD API test cases @ 2021-02-04 10:46 Akshay Joshi <[email protected]> parent: Aditya Toshniwal <[email protected]> 0 siblings, 0 replies; 4+ messages in thread From: Akshay Joshi @ 2021-02-04 10:46 UTC (permalink / raw) To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers Thanks, patch applied. On Thu, Feb 4, 2021 at 3:02 PM Aditya Toshniwal < [email protected]> wrote: > Hi, > > Seems like the test cases are still failing on the build machines. > Attached is the patch to make the connection ids unique by using random. > Please review. > > On Wed, Feb 3, 2021 at 4:49 PM Akshay Joshi <[email protected]> > wrote: > >> Thanks, patch applied. >> >> On Wed, Feb 3, 2021 at 4:01 PM Aditya Toshniwal < >> [email protected]> wrote: >> >>> Hi Hackers, >>> >>> Attached is the patch to use unique DB names in ERD API test cases to >>> avoid conflict when running test cases in parallel. >>> Please review. >>> >>> -- >>> Thanks, >>> Aditya Toshniwal >>> pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com* >>> <http://edbpostgres.com; >>> "Don't Complain about Heat, Plant a TREE" >>> >> >> >> -- >> *Thanks & Regards* >> *Akshay Joshi* >> *pgAdmin Hacker | Principal Software Architect* >> *EDB Postgres <http://edbpostgres.com>* >> >> *Mobile: +91 976-788-8246* >> > > > -- > Thanks, > Aditya Toshniwal > pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com* > <http://edbpostgres.com; > "Don't Complain about Heat, Plant a TREE" > -- *Thanks & Regards* *Akshay Joshi* *pgAdmin Hacker | Principal Software Architect* *EDB Postgres <http://edbpostgres.com>* *Mobile: +91 976-788-8246* ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2021-02-04 10:46 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-02-03 10:30 [pgAdmin][patch] Use unique DB name in ERD API test cases Aditya Toshniwal <[email protected]> 2021-02-03 11:19 ` Akshay Joshi <[email protected]> 2021-02-04 09:31 ` Aditya Toshniwal <[email protected]> 2021-02-04 10:46 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox