1) Added --exclude-database option for Backup Server.

2) Fixed Jasmine test cases.
This commit is contained in:
Akshay Joshi 2023-07-10 12:43:24 +05:30
parent 115d4afd9e
commit 7686280cb2
5 changed files with 41 additions and 4 deletions

View File

@ -178,6 +178,9 @@ tab to provide other backup options.
table locks at the beginning of the dump. Instead, fail if unable to lock a
table within the specified timeout.
* Use the *Exclude database* field to not dump databases whose name matches
pattern.
When youve specified the details that will be incorporated into the pg_dumpall
command:

View File

@ -253,7 +253,7 @@ def _get_args_params_values(data, conn, backup_obj_type, backup_file, server,
# --blobs is deprecated from v16
if manager.version >= 160000:
set_param('blobs', 'large-objects',
set_param('blobs', '--large-objects',
data['format'] in ['custom', 'tar'])
else:
set_param('blobs', '--blobs', data['format'] in ['custom', 'tar'])
@ -334,6 +334,8 @@ def _get_args_params_values(data, conn, backup_obj_type, backup_file, server,
set_value('extra_float_digits', '--extra-float-digits', None,
manager.version >= 120000)
set_value('lock_wait_timeout', '--lock-wait-timeout')
set_value('exclude_database', '--exclude-database', None,
manager.version >= 160000)
args.extend(
functools.reduce(operator.iconcat, map(

View File

@ -341,6 +341,7 @@ export class MiscellaneousSchema extends BaseUISchema {
get baseFields() {
let obj = this;
return [{
id: 'verbose',
label: gettext('Verbose messages'),
@ -372,6 +373,14 @@ export class MiscellaneousSchema extends BaseUISchema {
type: 'int',
disabled: false,
group: gettext('Miscellaneous')
}, {
id: 'exclude_database',
label: gettext('Exclude database'),
type: 'text',
disabled: false,
min_version: 160000,
group: gettext('Miscellaneous'),
visible: isVisibleForObjectBackup(obj.backupType)
}];
}
}

View File

@ -1052,6 +1052,31 @@ class BackupCreateJobTest(BaseTestGenerator):
not_expected_cmd_opts=[],
expected_exit_code=[0, None]
)),
('When backup the server with option - Exclude database',
dict(
class_params=dict(
sid=1,
name='test_backup_server',
port=5444,
host='localhost',
database='postgres',
bfile='test_backup',
username='postgres'
),
params=dict(
file='test_backup_server_file',
type='server',
verbose=True,
exclude_database="db*"
),
url=BACKUP_SERVER_URL,
expected_cmd_opts=[VERBOSE, '--exclude-database', 'db*'],
not_expected_cmd_opts=[],
server_min_version=160000,
expected_exit_code=[0, None],
message='Backup server with --exclude-database are not '
'supported by EPAS/PG server less than 16.0'
)),
('When backup the server with encoding',
dict(
class_params=dict(

View File

@ -12,7 +12,7 @@ import '../helper/enzyme.helper';
import { createMount } from '@material-ui/core/test-utils';
import pgAdmin from 'sources/pgadmin';
import SchemaView from '../../../pgadmin/static/js/SchemaView';
import BackupSchema, {getSectionSchema, getTypeObjSchema, getSaveOptSchema, getQueryOptionSchema, getDisabledOptionSchema, getMiscellaneousSchema} from '../../../pgadmin/tools/backup/static/js/backup.ui';
import BackupSchema, {getSectionSchema, getTypeObjSchema, getSaveOptSchema, getDisabledOptionSchema, getMiscellaneousSchema} from '../../../pgadmin/tools/backup/static/js/backup.ui';
import Theme from '../../../pgadmin/static/js/Theme';
@ -29,7 +29,6 @@ describe('BackupSchema', ()=>{
()=> getSectionSchema(),
()=> getTypeObjSchema(),
()=> getSaveOptSchema({nodeInfo: {server: {version: 11000}}}),
()=> getQueryOptionSchema({nodeInfo: {server: {version: 11000}}}),
()=> getDisabledOptionSchema({nodeInfo: {server: {version: 11000}}}),
()=> getMiscellaneousSchema({nodeInfo: {server: {version: 11000}}}),
{
@ -66,7 +65,6 @@ describe('BackupSchema', ()=>{
()=> getSectionSchema(),
()=> getTypeObjSchema(),
()=> getSaveOptSchema({nodeInfo: {server: {version: 11000}}}),
()=> getQueryOptionSchema({nodeInfo: {server: {version: 11000}}}),
()=> getDisabledOptionSchema({nodeInfo: {server: {version: 11000}}}),
()=> getMiscellaneousSchema({nodeInfo: {server: {version: 11000}}}),
{