Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dmitry-lipetsk opened this issue Jul 25, 2024 · 0 comments

Comments

@dmitry-lipetsk
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant