mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
1. Added check to skip debugger test case if the plugin is not installed.
2. Added code to delete the existing "pldbgapi" extension and create a new extension. 3. Updated a few test cases that are falling on specific servers. 4. Fixed test cases for pgAgent. Fixed by: Nikhil & Yogesh
This commit is contained in:
parent
5f5818ba78
commit
21333490ef
@ -9,7 +9,7 @@
|
||||
|
||||
"""Implements the pgAgent Jobs Node"""
|
||||
from functools import wraps
|
||||
import json
|
||||
import simplejson as json
|
||||
from datetime import datetime, time
|
||||
|
||||
from flask import render_template, request, jsonify
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
"""Implements pgAgent Job Schedule Node"""
|
||||
|
||||
import json
|
||||
import simplejson as json
|
||||
from functools import wraps
|
||||
|
||||
from flask import render_template, request, jsonify
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
"""Implements pgAgent Job Step Node"""
|
||||
|
||||
import json
|
||||
import simplejson as json
|
||||
from functools import wraps
|
||||
|
||||
from flask import render_template, request, jsonify
|
||||
|
@ -21,7 +21,7 @@
|
||||
"mocking_required": true,
|
||||
"node_type": "function",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"test_data": {},
|
||||
"mock_data": {
|
||||
"function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_dict",
|
||||
@ -37,7 +37,7 @@
|
||||
"is_positive_test": false,
|
||||
"mocking_required": true,
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"node_type": "function",
|
||||
"test_data": {},
|
||||
"mock_data": {
|
||||
@ -54,7 +54,7 @@
|
||||
"is_positive_test": false,
|
||||
"mocking_required": true,
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"node_type": "function",
|
||||
"test_data": {},
|
||||
"mock_data": {
|
||||
@ -72,7 +72,7 @@
|
||||
"mocking_required": true,
|
||||
"mock_multiple_calls": true,
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"node_type": "function",
|
||||
"test_data": {},
|
||||
"mock_data": {
|
||||
@ -89,7 +89,7 @@
|
||||
"is_positive_test": false,
|
||||
"mocking_required": false,
|
||||
"invalid_name": true,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"node_type": "function",
|
||||
"test_data": {},
|
||||
"mock_data": {
|
||||
@ -105,7 +105,7 @@
|
||||
"mocking_required": true,
|
||||
"mock_multiple_calls": true,
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"node_type": "function",
|
||||
"test_data": {},
|
||||
"mock_data": {
|
||||
@ -138,14 +138,15 @@
|
||||
"expected_data": {
|
||||
"status_code": 200
|
||||
}
|
||||
},{
|
||||
},
|
||||
{
|
||||
"name": "Debugger initialization for trigger: fail",
|
||||
"url": "/debugger/init/trigger/",
|
||||
"is_positive_test": false,
|
||||
"mocking_required": true,
|
||||
"node_type": "trigger",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"test_data": {
|
||||
"name": "PLACE_HOLDER",
|
||||
"is_row_trigger": true,
|
||||
@ -178,7 +179,8 @@
|
||||
"expected_data": {
|
||||
"status_code": 200
|
||||
}
|
||||
},{
|
||||
},
|
||||
{
|
||||
"name": "Debugger initialize target direct negative",
|
||||
"url": "/debugger/initialize_target/direct/",
|
||||
"is_positive_test": false,
|
||||
@ -186,7 +188,7 @@
|
||||
"node_type": "trigger",
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"test_data": {},
|
||||
"mock_data": {
|
||||
"function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_dict",
|
||||
@ -204,7 +206,7 @@
|
||||
"node_type": "trigger",
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"test_data": {},
|
||||
"mock_data": {
|
||||
"function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_scalar",
|
||||
@ -222,7 +224,7 @@
|
||||
"node_type": "trigger",
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"test_data": {},
|
||||
"mock_data": {
|
||||
"function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.execute_scalar",
|
||||
@ -240,7 +242,7 @@
|
||||
"node_type": "trigger",
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"test_data": {},
|
||||
"mock_data": {
|
||||
"function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.connect",
|
||||
@ -258,7 +260,7 @@
|
||||
"node_type": "trigger",
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"test_data": {},
|
||||
"mock_data": {},
|
||||
"expected_data": {
|
||||
@ -274,7 +276,7 @@
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"create_trigger_func": true,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"test_data": {
|
||||
"name": "PLACE_HOLDER",
|
||||
"is_row_trigger": true,
|
||||
@ -296,7 +298,7 @@
|
||||
"node_type": "trigger",
|
||||
"invalid_name": false,
|
||||
"create_trigger_func": true,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"type": "direct",
|
||||
"test_data": {
|
||||
"name": "PLACE_HOLDER",
|
||||
@ -313,7 +315,8 @@
|
||||
"expected_data": {
|
||||
"status_code": 500
|
||||
}
|
||||
},{
|
||||
},
|
||||
{
|
||||
"name": "Debugger initialize target direct with trigger id fail",
|
||||
"url": "/debugger/initialize_target/direct/",
|
||||
"is_positive_test": false,
|
||||
@ -322,7 +325,7 @@
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"create_trigger_func": true,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"mock_multiple": true,
|
||||
"test_data": {
|
||||
"name": "PLACE_HOLDER",
|
||||
@ -349,7 +352,7 @@
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"create_trigger_func": true,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"mock_multiple": false,
|
||||
"test_data": {
|
||||
"name": "PLACE_HOLDER",
|
||||
@ -376,7 +379,7 @@
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"create_trigger_func": true,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"mock_multiple": true,
|
||||
"test_data": {
|
||||
"name": "PLACE_HOLDER",
|
||||
@ -435,7 +438,7 @@
|
||||
"type": "trigger",
|
||||
"invalid_name": false,
|
||||
"init_target": true,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"test_data": {},
|
||||
"mock_data": {},
|
||||
"expected_data": {
|
||||
@ -450,7 +453,7 @@
|
||||
"type": "trigger",
|
||||
"invalid_name": false,
|
||||
"init_target": true,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"test_data": {},
|
||||
"mock_data": {
|
||||
"function_name": "pgadmin.utils.driver.psycopg2.connection.Connection.connected",
|
||||
@ -498,7 +501,7 @@
|
||||
"mocking_required": false,
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": false,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -527,7 +530,7 @@
|
||||
"mocking_required": true,
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -559,7 +562,7 @@
|
||||
"mocking_required": false,
|
||||
"type": "indirect",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -589,7 +592,7 @@
|
||||
"mocking_required": true,
|
||||
"type": "indirect",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -645,14 +648,15 @@
|
||||
"expected_data": {
|
||||
"status_code": 200
|
||||
}
|
||||
},{
|
||||
},
|
||||
{
|
||||
"name": "Debugger Messages: connection fail",
|
||||
"url": "debugger/messages/",
|
||||
"is_positive_test": false,
|
||||
"mocking_required": true,
|
||||
"type": "indirect",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -676,14 +680,15 @@
|
||||
"expected_data": {
|
||||
"status_code": 500
|
||||
}
|
||||
},{
|
||||
},
|
||||
{
|
||||
"name": "Debugger Messages: debugger instace fail",
|
||||
"url": "debugger/messages/",
|
||||
"is_positive_test": false,
|
||||
"mocking_required": false,
|
||||
"type": "indirect",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": false,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -777,7 +782,7 @@
|
||||
"is_positive_test": false,
|
||||
"mocking_required": true,
|
||||
"type": "direct",
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -808,7 +813,7 @@
|
||||
"is_positive_test": false,
|
||||
"mocking_required": true,
|
||||
"type": "direct",
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -870,7 +875,7 @@
|
||||
"is_positive_test": false,
|
||||
"mocking_required": false,
|
||||
"type": "direct",
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"invalid_trans": true,
|
||||
"init_target": true,
|
||||
"test_data": {
|
||||
@ -977,7 +982,7 @@
|
||||
"type": "direct",
|
||||
"query_type": "wait_for_breakpoint",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"abort_debugger": true,
|
||||
"test_data": {
|
||||
@ -1011,7 +1016,7 @@
|
||||
"type": "direct",
|
||||
"query_type": "wait_for_breakpoint",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": false,
|
||||
"abort_debugger": true,
|
||||
"test_data": {
|
||||
@ -1043,7 +1048,7 @@
|
||||
"type": "direct",
|
||||
"query_type": "continue",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"abort_debugger": false,
|
||||
"test_data": {
|
||||
@ -1075,7 +1080,7 @@
|
||||
"type": "direct",
|
||||
"query_type": "wait_for_breakpoint",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"abort_debugger": true,
|
||||
"test_data": {
|
||||
@ -1109,7 +1114,7 @@
|
||||
"type": "direct",
|
||||
"query_type": "continue",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"abort_debugger": true,
|
||||
"test_data": {
|
||||
@ -1166,14 +1171,15 @@
|
||||
"expected_data": {
|
||||
"status_code": 200
|
||||
}
|
||||
},{
|
||||
},
|
||||
{
|
||||
"name": "Debugger poll result: Disconnected",
|
||||
"url": "debugger/poll_result/",
|
||||
"is_positive_test": false,
|
||||
"mocking_required": true,
|
||||
"type": "indirect",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -1197,14 +1203,15 @@
|
||||
"expected_data": {
|
||||
"status_code": 200
|
||||
}
|
||||
},{
|
||||
},
|
||||
{
|
||||
"name": "Debugger poll result: poll error",
|
||||
"url": "debugger/poll_result/",
|
||||
"is_positive_test": false,
|
||||
"mocking_required": true,
|
||||
"type": "indirect",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -1228,14 +1235,15 @@
|
||||
"expected_data": {
|
||||
"status_code": 200
|
||||
}
|
||||
},{
|
||||
},
|
||||
{
|
||||
"name": "Debugger poll result: Debugger instance fail",
|
||||
"url": "debugger/poll_result/",
|
||||
"is_positive_test": false,
|
||||
"mocking_required": true,
|
||||
"type": "indirect",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": false,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -1300,7 +1308,7 @@
|
||||
"mocking_required": false,
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": false,
|
||||
"query_type": 1,
|
||||
"test_data": {
|
||||
@ -1331,7 +1339,7 @@
|
||||
"mocking_required": true,
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"query_type": 1,
|
||||
"test_data": {
|
||||
@ -1364,7 +1372,7 @@
|
||||
"mocking_required": true,
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"query_type": 1,
|
||||
"test_data": {
|
||||
@ -1397,7 +1405,7 @@
|
||||
"mocking_required": false,
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"query_type": 2,
|
||||
"test_data": {
|
||||
@ -1460,7 +1468,7 @@
|
||||
"mocking_required": false,
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": false,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -1490,7 +1498,7 @@
|
||||
"mocking_required": true,
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -1522,7 +1530,7 @@
|
||||
"mocking_required": true,
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"test_data": {
|
||||
"acl": [],
|
||||
@ -1554,7 +1562,7 @@
|
||||
"mocking_required": false,
|
||||
"type": "direct",
|
||||
"invalid_name": false,
|
||||
"add_extension": false,
|
||||
"add_extension": true,
|
||||
"init_target": true,
|
||||
"no_breakpoint": true,
|
||||
"test_data": {
|
||||
|
@ -43,7 +43,7 @@ class CloseDebugger(BaseTestGenerator):
|
||||
self.func_id = function_info[0]
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
self.trans_id = json.loads(init_debugger.data)['data']['trans_id']
|
||||
|
@ -42,7 +42,7 @@ class DebuggerClearAllBreakpoint(BaseTestGenerator):
|
||||
self.func_id = json.loads(function_info.data)['node']['_id']
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
|
||||
@ -52,7 +52,7 @@ class DebuggerClearAllBreakpoint(BaseTestGenerator):
|
||||
debugger_utils.initialize_target(self, utils)
|
||||
|
||||
debugger_utils.start_listener(self)
|
||||
self.port_no = debugger_utils.messages(self)
|
||||
self.port_no = debugger_utils.messages(self, utils, db_utils)
|
||||
debugger_utils.start_execution(self)
|
||||
breakpoint = debugger_utils.set_breakpoint(self)
|
||||
|
||||
|
@ -42,7 +42,7 @@ class DebuggerClearArguments(BaseTestGenerator):
|
||||
self.func_id = json.loads(function_info.data)['node']['_id']
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
|
||||
|
@ -42,7 +42,7 @@ class DebuggerDirect(BaseTestGenerator):
|
||||
self.func_id = json.loads(function_info.data)['node']['_id']
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
|
||||
|
@ -41,7 +41,7 @@ class DebuggerExecuteQuery(BaseTestGenerator):
|
||||
self.func_id = json.loads(function_info.data)['node']['_id']
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
|
||||
@ -51,7 +51,7 @@ class DebuggerExecuteQuery(BaseTestGenerator):
|
||||
debugger_utils.initialize_target(self, utils)
|
||||
debugger_utils.start_listener(self)
|
||||
|
||||
self.port_no = debugger_utils.messages(self)
|
||||
self.port_no = debugger_utils.messages(self, utils, db_utils)
|
||||
debugger_utils.start_execution(self)
|
||||
|
||||
def execute_query(self):
|
||||
|
@ -42,7 +42,7 @@ class DebuggerPollExecutionResult(BaseTestGenerator):
|
||||
self.func_id = json.loads(function_info.data)['node']['_id']
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
|
||||
@ -52,7 +52,7 @@ class DebuggerPollExecutionResult(BaseTestGenerator):
|
||||
debugger_utils.initialize_target(self, utils)
|
||||
|
||||
debugger_utils.start_listener(self)
|
||||
self.port_no = debugger_utils.messages(self)
|
||||
self.port_no = debugger_utils.messages(self, utils, db_utils)
|
||||
debugger_utils.start_execution(self)
|
||||
|
||||
def poll_execution_result(self):
|
||||
|
@ -42,7 +42,7 @@ class DebuggerPollResult(BaseTestGenerator):
|
||||
self.func_id = json.loads(function_info.data)['node']['_id']
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
|
||||
|
@ -42,7 +42,7 @@ class DebuggerSetArguments(BaseTestGenerator):
|
||||
self.func_id = json.loads(function_info.data)['node']['_id']
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
|
||||
|
@ -42,7 +42,7 @@ class DebuggerSetBreakpoint(BaseTestGenerator):
|
||||
self.func_id = json.loads(function_info.data)['node']['_id']
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
|
||||
@ -52,7 +52,7 @@ class DebuggerSetBreakpoint(BaseTestGenerator):
|
||||
debugger_utils.initialize_target(self, utils)
|
||||
|
||||
debugger_utils.start_listener(self)
|
||||
self.port_no = debugger_utils.messages(self)
|
||||
self.port_no = debugger_utils.messages(self, utils, db_utils)
|
||||
debugger_utils.start_execution(self)
|
||||
|
||||
if self.query_type == 2:
|
||||
|
@ -72,7 +72,7 @@ class InitDebugger(BaseTestGenerator):
|
||||
self.func_id = function_info[0]
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
def initialize_debugger(self):
|
||||
if self.node_type == 'function':
|
||||
|
@ -62,7 +62,7 @@ class InitDebugger(BaseTestGenerator):
|
||||
self.trigger_id = debugger_utils.create_trigger(self, utils)
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, False, db_utils=db_utils)
|
||||
|
||||
def initialize_debugger(self):
|
||||
if self.node_type == 'trigger':
|
||||
|
@ -53,7 +53,7 @@ class InitTargetDebugger(BaseTestGenerator):
|
||||
self.func_id = function_info[0]
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
|
||||
@ -125,7 +125,6 @@ class InitTargetDebugger(BaseTestGenerator):
|
||||
actual_response_code = response.status_code
|
||||
expected_response_code = self.expected_data['status_code']
|
||||
if response.json['errormsg'] == self.debugger_error:
|
||||
print(self.debugger_error)
|
||||
self.assertEqual(actual_response_code, actual_response_code)
|
||||
else:
|
||||
self.assertEqual(actual_response_code, expected_response_code)
|
||||
|
@ -42,7 +42,7 @@ class DebuggerMessages(BaseTestGenerator):
|
||||
self.func_id = json.loads(function_info.data)['node']['_id']
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
self.trans_id = json.loads(init_debugger.data)['data']['trans_id']
|
||||
|
@ -43,7 +43,7 @@ class RestartDebugger(BaseTestGenerator):
|
||||
self.func_id = function_info[0]
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
|
||||
|
@ -42,7 +42,7 @@ class DebuggerStartExecution(BaseTestGenerator):
|
||||
self.func_id = json.loads(function_info.data)['node']['_id']
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
|
||||
@ -52,7 +52,7 @@ class DebuggerStartExecution(BaseTestGenerator):
|
||||
debugger_utils.initialize_target(self, utils)
|
||||
|
||||
debugger_utils.start_listener(self)
|
||||
self.port_no = debugger_utils.messages(self)
|
||||
self.port_no = debugger_utils.messages(self, utils, db_utils)
|
||||
|
||||
def start_execution(self):
|
||||
return self.tester.get(
|
||||
|
@ -45,7 +45,7 @@ class DebuggerStartListener(BaseTestGenerator):
|
||||
self.func_id = json.loads(function_info.data)['node']['_id']
|
||||
|
||||
if self.add_extension:
|
||||
debugger_utils.add_extension(self, utils)
|
||||
debugger_utils.add_extension(self, utils, db_utils=db_utils)
|
||||
|
||||
init_debugger = debugger_utils.init_debugger_function(self)
|
||||
self.trans_id = json.loads(init_debugger.data)['data']['trans_id']
|
||||
|
@ -1,6 +1,8 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import uuid
|
||||
import traceback
|
||||
|
||||
|
||||
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||
@ -52,7 +54,7 @@ def abort_debugger(self):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
def add_extension(self, utils):
|
||||
def add_extension(self, utils, del_function=True, db_utils=None):
|
||||
extension_url = '/browser/extension/obj/{0}/{1}/{2}/'.format(
|
||||
str(utils.SERVER_GROUP), str(self.server_id), str(self.db_id))
|
||||
extension_data = {
|
||||
@ -69,6 +71,9 @@ def add_extension(self, utils):
|
||||
self.server['port'],
|
||||
self.server['sslmode'])
|
||||
pg_cursor = connection.cursor()
|
||||
# Drop existing extension.
|
||||
pg_cursor.execute('''DROP EXTENSION IF EXISTS "%s" ''' % 'pldbgapi')
|
||||
|
||||
# Create pldbgapi extension if not exist.
|
||||
pg_cursor.execute('''CREATE EXTENSION IF NOT EXISTS
|
||||
"%s" WITH SCHEMA "%s" VERSION
|
||||
@ -77,7 +82,16 @@ def add_extension(self, utils):
|
||||
|
||||
connection.commit()
|
||||
except Exception as e:
|
||||
print('Unable to create "pldbgapi" extension.')
|
||||
print(
|
||||
"============================================================="
|
||||
"=========\n",
|
||||
file=sys.stderr
|
||||
)
|
||||
if del_function:
|
||||
delete_function(self, utils)
|
||||
|
||||
db_utils.disconnect_database(self, self.server_id, self.db_id)
|
||||
self.skipTest('The debugger plugin is not installed.')
|
||||
|
||||
|
||||
def init_debugger_function(self):
|
||||
@ -134,12 +148,19 @@ def create_trigger(self, utils):
|
||||
return json.loads(response.data)['node']['_id']
|
||||
|
||||
|
||||
def messages(self):
|
||||
def messages(self, utils, db_utils):
|
||||
response = self.tester.get(
|
||||
'debugger/messages/' + str(self.trans_id) + '/',
|
||||
content_type='application/json')
|
||||
|
||||
return json.loads(response.data)['data']['result']
|
||||
port = json.loads(response.data)['data']['result']
|
||||
if not port:
|
||||
close_debugger(self)
|
||||
delete_function(self, utils)
|
||||
db_utils.disconnect_database(
|
||||
self, self.server_id, self.db_id)
|
||||
self.skipTest('Debugger is in Busy state.')
|
||||
else:
|
||||
return port
|
||||
|
||||
|
||||
def start_execution(self):
|
||||
|
Loading…
Reference in New Issue
Block a user