Skip to content

[tests] ProbackupTest::backup_node always requires valid 'node' object #631

@dmitry-lipetsk

Description

@dmitry-lipetsk

Hello,

If I understand correctly, ProbackupTest::backup_node allows node==None when data_dir is defined (see line 1098).

On the other side, this method always calls node.port (line 1110) and this is supposes that node is valid (not None).

def backup_node(
self, backup_dir, instance, node, data_dir=False,
backup_type='full', datname=False, options=[],
asynchronous=False, gdb=False,
old_binary=False, return_id=True, no_remote=False,
env=None
):
if not node and not data_dir:
print('You must provide ether node or data_dir for backup')
exit(1)
if not datname:
datname = 'postgres'
cmd_list = [
'backup',
'-B', backup_dir,
'--instance={0}'.format(instance),
# "-D", pgdata,
'-p', '%i' % node.port,
'-d', datname
]


I used a debugger to set None in node to "<some string>" in data_dir.

Expression if not node and not data_dir: said OK, but a test was finished with the following error:

        cmd_list = [
            'backup',
            '-B', backup_dir,
            '--instance={0}'.format(instance),
            # "-D", pgdata,
>           '-p', '%i' % node.port,
            '-d', datname
        ]
E       AttributeError: 'NoneType' object has no attribute 'port'

tests/helpers/ptrack_helpers.py:1110: AttributeError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions