public inbox for [email protected]  
help / color / mirror / Atom feed
From: Navnath Gadakh <[email protected]>
To: Dave Page <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Cc: Kanchan Mohitey <[email protected]>
Cc: Ikram Khan <[email protected]>
Cc: Hamid Quddus <[email protected]>
Subject: Re: pgAdmin4: Test-suite OS compatability issue
Date: Thu, 4 May 2017 17:23:02 +0530
Message-ID: <CAOAJCYpvAzq_QYVKXw2B0A2nSPzb1KG=3UJOUHoyRztQ8kRNMA@mail.gmail.com> (raw)
In-Reply-To: <CA+OCxoyrA8z6D4LBnjFJ0xzj+VvROQPoKZysVgigV7zo54xiNg@mail.gmail.com>
References: <CAOAJCYrRH_E-=TwsVK7=FsiV86xBgwKOQnVHanOQ9sMeBECe-g@mail.gmail.com>
	<CA+OCxozWSsEe=NWMd4GD7YvkcnHf60=1n8+RmCHUPOb--7YV8g@mail.gmail.com>
	<CAOAJCYpnE6hBb2NdLL6W_UD39H=kKZ+OJ61U7GyOMt8S6+3_5g@mail.gmail.com>
	<CA+OCxowfyY0OqTWKv6QUr77Bh_H+u4S6DHTZT=2VZOYbmK0VaA@mail.gmail.com>
	<CAOAJCYrxxm4qLH+LqJvPGc0=TLGT9ndsN=cJyw-LabnSdRcppA@mail.gmail.com>
	<CA+OCxoyrA8z6D4LBnjFJ0xzj+VvROQPoKZysVgigV7zo54xiNg@mail.gmail.com>
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi Dave,

        Please find the revised patch. I have added some print statements
for debug purpose, so that I can get which line causing this issue. Most
probably issue should be in the cleanup process.

Please apply the patch and run the regression. Send me your console output
and *regression.log* file

Thanks!






On Thu, May 4, 2017 at 2:18 PM, Dave Page <[email protected]> wrote:

> I still see the issue. See the attached screenshot. Killing process 32287
> caused the test suite to exit.[image: Inline image 1]
>
> On Wed, May 3, 2017 at 1:32 PM, Navnath Gadakh <
> [email protected]> wrote:
>
>> It's getting strange now. I just updated my Mac OS from EI Capitan(10.11.6)
>> to Sierra(10.12.4). I have applied the patch and it ran successfully
>> without any hangup.
>>
>> This is my console output:
>>
>> *======================================================================*
>>
>> *Test Result Summary*
>>
>> *======================================================================*
>>
>> *REGRESSION TEST 1 PostgreSQL 9.6:*
>>
>> *140 tests passed*
>>
>> *0 test failed*
>>
>> *16 tests skipped:*
>>
>> *PackageAddTestCase (Fetch Package Node URL)*
>>
>> *PackageDeleteTestCase (Fetch Package Node URL)*
>>
>> *PackageGetTestCase (Fetch Package Node URL)*
>>
>> *PackagePutTestCase (Fetch Package Node URL)*
>>
>> *SynonymAddTestCase (Default Node URL)*
>>
>> *SynonymDeleteTestCase (Fetch synonym Node URL)*
>>
>> *SynonymGetTestCase (Fetch synonym Node URL)*
>>
>> *SynonymPutTestCase (Fetch synonym Node URL)*
>>
>> *ResourceGroupsAddTestCase (Add resource groups)*
>>
>> *ResourceGroupsDeleteTestCase (Delete resource groups)*
>>
>> *ResourceGroupsPutTestCase (Put resource groups)*
>>
>> *ResourceGroupsGetTestCase (Get resource groups)*
>>
>> *TableSpaceAddTestCase (Check Tablespace Node)*
>>
>> *TableSpaceDeleteTestCase (Check Tablespace Node)*
>>
>> *TablespaceGetTestCase (Check Tablespace Node)*
>>
>> *TableSpaceUpdateTestCase (Check Tablespace Node)*
>>
>> *======================================================================*
>>
>> *Please check output in file:
>> /Users/edb/Navnath/pgadmin4/web/regression/regression.log*
>>
>> *(pgenv36) Laptop227-pn-in:regression Navnath$ *
>>
>>
>>
>> On Wed, May 3, 2017 at 1:39 PM, Dave Page <[email protected]> wrote:
>>
>>> 10.12.3 (Sierra), 16GB MBP. Running in a virtualenv built from the
>>> system Python installation. Packages are:
>>>
>>> (pgadmin4)piranha:~ dpage$ pip freeze
>>> alabaster==0.7.10
>>> alembic==0.9.1
>>> args==0.1.0
>>> Babel==1.3
>>> beautifulsoup4==4.4.1
>>> blinker==1.3
>>> chromedriver-installer==0.0.6
>>> click==6.6
>>> clint==0.5.1
>>> dateutils==0.6.6
>>> docutils==0.13.1
>>> extras==1.0.0
>>> fixtures==3.0.0
>>> Flask==0.11.1
>>> Flask-Babel==0.11.1
>>> Flask-Gravatar==0.4.2
>>> Flask-HTMLmin==1.2
>>> Flask-Login==0.3.2
>>> Flask-Mail==0.9.1
>>> Flask-Migrate==2.0.3
>>> Flask-Principal==0.4.0
>>> Flask-Script==2.0.5
>>> Flask-Security==1.7.5
>>> Flask-SQLAlchemy==2.1
>>> Flask-WTF==0.12
>>> html5lib==1.0b3
>>> htmlmin==0.1.10
>>> imagesize==0.7.1
>>> importlib==1.0.3
>>> itsdangerous==0.24
>>> Jinja2==2.7.3
>>> linecache2==1.0.0
>>> Mako==1.0.6
>>> MarkupSafe==0.23
>>> minify==0.1.4
>>> passlib==1.6.2
>>> pbr==2.0.0
>>> pkginfo==1.4.1
>>> psycopg2==2.6.2
>>> pycrypto==2.6.1
>>> Pygments==2.2.0
>>> pyperclip==1.5.27
>>> pyrsistent==0.12.1
>>> python-dateutil==2.5.0
>>> python-editor==1.0.3
>>> python-mimeparse==1.6.0
>>> pytz==2014.10
>>> requests==2.13.0
>>> requests-toolbelt==0.7.1
>>> selenium==3.3.1
>>> simplejson==3.6.5
>>> six==1.10.0
>>> snowballstemmer==1.2.1
>>> speaklater==1.3
>>> Sphinx==1.5.3
>>> SQLAlchemy==1.0.14
>>> sqlparse==0.1.19
>>> testscenarios==0.5.0
>>> testtools==2.0.0
>>> traceback2==1.4.0
>>> unittest2==1.1.0
>>> Werkzeug==0.9.6
>>> WTForms==2.0.2
>>>
>>>
>>> On Wed, May 3, 2017 at 7:13 AM, Navnath Gadakh <
>>> [email protected]> wrote:
>>>
>>>> Hi Dave,
>>>>
>>>>          I have applied and run this patch on Mac and it ran
>>>> successfully without hang up.
>>>>
>>>> I used different OS:
>>>>        OS X Yosemite Version 10.10.2
>>>>        OS X EI Capitan Version 10.11.6
>>>>
>>>> What is your system config?
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, May 2, 2017 at 4:39 PM, Dave Page <[email protected]> wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> When testing on Mac, the testsuite never exits with this patch
>>>>> applied. It just hangs after printing the result summary.
>>>>>
>>>>> On Fri, Apr 28, 2017 at 2:51 PM, Navnath Gadakh <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi Dave,
>>>>>>
>>>>>>          Please find the patch for OS compatability issue of
>>>>>> test-suite.
>>>>>>
>>>>>> *Code Changes:*
>>>>>>
>>>>>>             1. Minor code changes done related to os module in
>>>>>> *pgadmin4/web/regression/feature_utils/app_starter.py*
>>>>>>             2. Code added in pgadmin4/*web/pgadmin/utils/tests/test_versioned_template_loader.py
>>>>>> *to handle path for SQL file.
>>>>>>             3. Code added to convert unicode to string in some .py
>>>>>> files.
>>>>>>
>>>>>> *Note:*
>>>>>>              With python2.6.6 test-suite is failed to execute. I have
>>>>>> created the RM 2367 <https://redmine.postgresql.org/issues/2367;
>>>>>>
>>>>>> Thank you!
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Regards,
>>>>>> Navnath Gadakh
>>>>>>
>>>>>> EnterpriseDB Corporation
>>>>>> The Enterprise PostgreSQL Company
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Sent via pgadmin-hackers mailing list ([email protected]
>>>>>> )
>>>>>> To make changes to your subscription:
>>>>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Dave Page
>>>>> Blog: http://pgsnake.blogspot.com
>>>>> Twitter: @pgsnake
>>>>>
>>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>> The Enterprise PostgreSQL Company
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Navnath Gadakh
>>>>
>>>> EnterpriseDB Corporation
>>>> The Enterprise PostgreSQL Company
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>>
>> --
>> Regards,
>> Navnath Gadakh
>>
>> EnterpriseDB Corporation
>> The Enterprise PostgreSQL Company
>>
>>
>>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>



-- 
Regards,
Navnath Gadakh

EnterpriseDB Corporation
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [image/png] Screen Shot 2017-05-04 at 09.32.53.png (60.3K, 3-Screen%20Shot%202017-05-04%20at%2009.32.53.png)
  download | view image

  [application/octet-stream] testsuite_os_compatability_issue_v2.patch (7.3K, 4-testsuite_os_compatability_issue_v2.patch)
  download | inline diff:
diff --git a/web/pgadmin/utils/tests/test_versioned_template_loader.py b/web/pgadmin/utils/tests/test_versioned_template_loader.py
index 5374b87..4ba5603 100644
--- a/web/pgadmin/utils/tests/test_versioned_template_loader.py
+++ b/web/pgadmin/utils/tests/test_versioned_template_loader.py
@@ -33,34 +33,37 @@ class TestVersionedTemplateLoader(BaseTestGenerator):
     def test_get_source_returns_a_template(self):
         expected_content = "Some SQL" \
                            "\nsome more stuff on a new line\n"
-
+        # For cross platform we join the SQL path (This solves the slashes issue)
+        sql_path = os.path.join("some_feature", "sql", "9.1_plus", "some_action.sql")
         content, filename, up_to_dateness = self.loader.get_source(None, "some_feature/sql/9.1_plus/some_action.sql")
-
-        self.assertEqual(expected_content, content)
-        self.assertIn("some_feature/sql/9.1_plus/some_action.sql", filename)
+        self.assertEqual(expected_content, str(content).replace("\r",""))
+        self.assertIn(sql_path, filename)
 
     def test_get_source_when_the_version_is_9_1_returns_9_1_template(self):
         expected_content = "Some SQL" \
                            "\nsome more stuff on a new line\n"
-
+        # For cross platform we join the SQL path (This solves the slashes issue)
+        sql_path = os.path.join("some_feature", "sql", "9.1_plus", "some_action.sql")
         content, filename, up_to_dateness = self.loader.get_source(None, "some_feature/sql/#90100#/some_action.sql")
 
-        self.assertEqual(expected_content, content)
-        self.assertIn("some_feature/sql/9.1_plus/some_action.sql", filename)
+        self.assertEqual(expected_content, str(content).replace("\r",""))
+        self.assertIn(sql_path, filename)
 
     def test_get_source_when_the_version_is_9_3_and_there_are_templates_for_9_2_and_9_1_returns_9_2_template(self):
-
+        # For cross platform we join the SQL path (This solves the slashes issue)
+        sql_path = os.path.join("some_feature", "sql", "9.2_plus", "some_action.sql")
         content, filename, up_to_dateness = self.loader.get_source(None, "some_feature/sql/#90300#/some_action.sql")
 
-        self.assertEqual("Some 9.2 SQL", content)
-        self.assertIn("some_feature/sql/9.2_plus/some_action.sql", filename)
+        self.assertEqual("Some 9.2 SQL", str(content).replace("\r",""))
+        self.assertIn(sql_path, filename)
 
     def test_get_source_when_the_version_is_9_0_and_there_are_templates_for_9_1_and_9_2_returns_default_template(self):
-
+        # For cross platform we join the SQL path (This solves the slashes issue)
+        sql_path = os.path.join("some_feature", "sql", "default", "some_action_with_default.sql")
         content, filename, up_to_dateness = self.loader.get_source(None, "some_feature/sql/#90000#/some_action_with_default.sql")
 
-        self.assertEqual("Some default SQL", content)
-        self.assertIn("some_feature/sql/default/some_action_with_default.sql", filename)
+        self.assertEqual("Some default SQL", str(content).replace("\r",""))
+        self.assertIn(sql_path, filename)
 
     def test_raise_not_found_exception_when_postgres_version_less_than_all_available_sql_templates(self):
 
diff --git a/web/regression/feature_utils/app_starter.py b/web/regression/feature_utils/app_starter.py
index b03f2a9..edfda05 100644
--- a/web/regression/feature_utils/app_starter.py
+++ b/web/regression/feature_utils/app_starter.py
@@ -7,7 +7,8 @@
 #
 ##########################################################################
 
-import os
+from __future__ import print_function
+import os, sys
 import subprocess
 
 import signal
@@ -27,13 +28,11 @@ class AppStarter:
         random_server_port = str(random.randint(10000, 65535))
         env = {
             "PGADMIN_PORT": random_server_port,
-            "SQLITE_PATH": self.app_config.TEST_SQLITE_PATH
+            "SQLITE_PATH": str(self.app_config.TEST_SQLITE_PATH)
                }
         env.update(os.environ)
-
         self.pgadmin_process = subprocess.Popen(["python", "pgAdmin4.py"],
                                                 shell=False,
-                                                preexec_fn=os.setsid,
                                                 stderr=open(os.devnull, 'w'),
                                                 env=env)
 
@@ -42,5 +41,8 @@ class AppStarter:
         self.driver.get("http://" + self.app_config.DEFAULT_SERVER + ":" + random_server_port)
 
     def stop_app(self):
+        print("I am in stop_app() function.", file=sys.stderr)
         self.driver.quit()
-        os.killpg(os.getpgid(self.pgadmin_process.pid), signal.SIGTERM)
+        print("Quitting driver.", file=sys.stderr)
+        os.kill(self.pgadmin_process.pid, signal.SIGTERM)
+        print("pgAdmin4.py process killed.", file=sys.stderr)
diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py
index 2b7c695..7cd0965 100644
--- a/web/regression/python_test_utils/test_utils.py
+++ b/web/regression/python_test_utils/test_utils.py
@@ -474,21 +474,25 @@ def _cleanup(tester, app_starter):
         for database in test_databases:
             connection = get_db_server(database["server_id"])
             if connection:
+                print("Dropping databases.", file=sys.stderr)
                 drop_database(connection, database["db_name"])
         # Delete table spaces
         for tablespace in test_table_spaces:
             connection = get_db_server(tablespace["server_id"])
             if connection:
+                print("Dropping tablespaces.", file=sys.stderr)
                 regression.tablespace_utils.delete_tablespace(
                     connection, tablespace["tablespace_name"])
         # Delete roles
         for role in test_roles:
             connection = get_db_server(role["server_id"])
             if connection:
+                print("Dropping roles.", file=sys.stderr)
                 regression.roles_utils.delete_role(connection,
                                                    role["role_name"])
         # Delete servers
         for server in test_servers:
+            print("Deleting servers.", file=sys.stderr)
             delete_server_with_api(tester, server["server_id"])
     except Exception:
         traceback.print_exc(file=sys.stderr)
@@ -498,6 +502,7 @@ def _cleanup(tester, app_starter):
         # Remove SQLite db file
         remove_db_file()
         if app_starter:
+            print("Stopping app.", file=sys.stderr)
             app_starter.stop_app()
 
 
diff --git a/web/regression/runtests.py b/web/regression/runtests.py
index 5f4a3d0..3ab7512 100644
--- a/web/regression/runtests.py
+++ b/web/regression/runtests.py
@@ -67,10 +67,10 @@ if pgadmin_credentials:
                for item in ['login_username', 'login_password']):
             pgadmin_credentials = pgadmin_credentials[
                 'pgAdmin4_login_credentials']
-            os.environ['PGADMIN_SETUP_EMAIL'] = pgadmin_credentials[
-                'login_username']
-            os.environ['PGADMIN_SETUP_PASSWORD'] = pgadmin_credentials[
-                'login_password']
+            os.environ['PGADMIN_SETUP_EMAIL'] = str(pgadmin_credentials[
+                'login_username'])
+            os.environ['PGADMIN_SETUP_PASSWORD'] = str(pgadmin_credentials[
+                'login_password'])
 
 # Execute the setup file
 exec (open("setup.py").read())


view thread (10+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: pgAdmin4: Test-suite OS compatability issue
  In-Reply-To: <CAOAJCYpvAzq_QYVKXw2B0A2nSPzb1KG=3UJOUHoyRztQ8kRNMA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox