[PGAGENT] Upgrade pgAgent from unpackaged version

2018-06-12 Thread Ashesh Vashi
Hi Dave,

As per my conversation with Rushabh, we need to rename the
pgagent--unpackaged--3.4.sql to pgagent--unpackaged--4.0.sql as it the
current version has changed. We also need to update the schema version
function for the unpackaged extension.

Please find the attached patch for the same.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company



*http://www.linkedin.com/in/asheshvashi*



pgagent_extension_from_unpackaged.sql
Description: Binary data


Re: RM#3294 - User need to reset the layout to see the changed preferences parameters

2018-06-12 Thread Victoria Henry
Hi Aditya,


It is not possible to fire event in another tab/new browser window. For
>>> example, query tool can be open in another tab. And thus, changes are not
>>> reflected there. There are solutions available like updating the
>>> localStorage of the browser but those are not reliable and does not work
>>> properly on different browsers.
>>>
>> To communicate between browser tabs we can use cookie polling on client
>> side it self (at least it will avoid polling over http).
>> The main tab will update only preference specific cookie when preference
>> is updated and other tabs will poll required cookies (not all)
>> with specific interval (1 second can be configurable).
>>
> Polling is a solution but I think it should be the last option. http polls
> will not be required anyway as we have preference cache in the browser
> object.
>

Maybe it's better to poll only when an editor is open in a separate
window?  What would we be polling for and how would be tell the backend
that something changed during the poll?

Thanks
Victoria & Joao


Re: [pgAdmin4][Patch]: RM 3362 - Fix the functions for PG v11, and add support procedure for PG v11

2018-06-12 Thread Victoria Henry
Hi Khushboo,

The following change is allowing the creation of procedures in postgresql
versions less then 11 and also GreenPlum

--- 
a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/procedure.js
+++ 
b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/procedure.js
@@ -71,11 +71,7 @@ define('pgadmin.node.procedure', [
 if ('catalog' in node_hierarchy)
   return false;

-// Procedures supported only in PPAS
-return (
-  'server' in node_hierarchy &&
-node_hierarchy['server'].server_type == 'ppas'
-);
+return true;

Now that the Procedures are a thing in Postgresql maybe they should live in
their own module.
In the tests for trigger functions we are not consistent on the naming of
the utils , in some places we call it funcs_utils in others
trigger_funcs_utils.

Thanks
​
Victoria & Joao

On Tue, Jun 12, 2018 at 3:10 AM Khushboo Vashi <
khushboo.va...@enterprisedb.com> wrote:

> Hi,
>
> Please find the attached updated patch.
>
> On Fri, Jun 8, 2018 at 2:21 PM, Dave Page  wrote:
>
>> Hi
>>
>> On Thu, Jun 7, 2018 at 11:27 AM, Khushboo Vashi <
>> khushboo.va...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>
>>> Please ignore my previous patch, find the attached updated one.
>>>
>>
>> I found a couple of issues with this:
>>
>> - Clicking the + button on the Parameters tab does nothing in either
>> Create or Edit modes
>>
>> Fixed
>
>> - The debugger fails to start (though, perhaps that's because the plugin
>> doesn't have Ashesh's latest patches in it).
>>
>> FYI, I was trying to test the debugger with:
>>
>> -- PROCEDURE: public.dummy_proc(integer)
>>
>> -- DROP PROCEDURE public.dummy_proc(integer);
>>
>> CREATE OR REPLACE  PROCEDURE public.dummy_proc(
>> id integer)
>> LANGUAGE 'plpgsql'
>>
>> AS $BODY$BEGIN
>>   raise notice 'id is %', id;
>> END;$BODY$;
>>
>> Fixed. Tested with the latest code of the plugin.
>
>> Thanks!
>>
>> 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

2018-06-12 Thread Victoria Henry
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, 999)))
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.va...@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.va...@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  wrote:
>>
>>> Hi
>>>
>>> On Fri, Jun 8, 2018 at 6:33 AM, Khushboo Vashi <
>>> khushboo.va...@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
>>> 

Re: [pgadmin4][Patch]: Support for create multiple test classes in one test file

2018-06-12 Thread Joao De Almeida Pereira
Hello Hackers,
Instead of doing this change and include more test harnessing to the setup
we have, do you think we can try to push to get pytest into the code base
and all these features will come by default?

Thanks
Joao
​

On Tue, Jun 12, 2018 at 9:30 AM Akshay Joshi 
wrote:

> Hi Hackers,
>
> Attached is the patch to create multiple test classes in one test file.
>
> For example: I have one test file *test_feature.py *where I wrote
> multiple test classes
> class TestX(BaseTestGenerator):
>   class TestY(BaseTestGenerator):
>   class TestZ(BaseTestGenerator):
>
> So with current implementation it will run the test cases for *TestZ*
> class.
>
> --
> *Akshay Joshi*
>
> *Sr. Software Architect *
>
>
>
> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>


[pgadmin4][Patch]: Support for create multiple test classes in one test file

2018-06-12 Thread Akshay Joshi
Hi Hackers,

Attached is the patch to create multiple test classes in one test file.

For example: I have one test file *test_feature.py *where I wrote multiple
test classes
class TestX(BaseTestGenerator):
  class TestY(BaseTestGenerator):
  class TestZ(BaseTestGenerator):

So with current implementation it will run the test cases for *TestZ* class.

-- 
*Akshay Joshi*

*Sr. Software Architect *



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


multiple_class_support.patch
Description: Binary data