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] test_corrupt_backup_content was updated [typos, new asserts] #633

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions tests/config_test.py
Original file line number Diff line number Diff line change
@@ -71,15 +71,15 @@ def test_corrupt_backup_content(self):
'postgres',
'create table t1()')

fulle2_id = self.backup_node(backup_dir, 'node', node)
full2_id = self.backup_node(backup_dir, 'node', node)

fulle1_conf_file = os.path.join(
full1_conf_file = os.path.join(
backup_dir, 'backups','node', full1_id, 'backup_content.control')

fulle2_conf_file = os.path.join(
backup_dir, 'backups','node', fulle2_id, 'backup_content.control')
full2_conf_file = os.path.join(
backup_dir, 'backups','node', full2_id, 'backup_content.control')

copyfile(fulle2_conf_file, fulle1_conf_file)
copyfile(full2_conf_file, full1_conf_file)

try:
self.validate_pb(backup_dir, 'node')
@@ -90,7 +90,7 @@ def test_corrupt_backup_content(self):
repr(self.output), self.cmd))
except ProbackupException as e:
self.assertIn(
"WARNING: Invalid CRC of backup control file '{0}':".format(fulle1_conf_file),
"WARNING: Invalid CRC of backup control file '{0}':".format(full1_conf_file),
e.message,
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
repr(e.message), self.cmd))
@@ -107,7 +107,8 @@ def test_corrupt_backup_content(self):
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
repr(e.message), self.cmd))

self.show_pb(backup_dir, 'node', full1_id)['status']
self.assertEqual(self.show_pb(backup_dir, 'node', full1_id)['status'], 'CORRUPT')
self.assertEqual(self.show_pb(backup_dir, 'node', full2_id)['status'], 'OK')

self.assertEqual(self.show_pb(backup_dir, 'node')[0]['status'], 'CORRUPT')
Copy link
Author

@dmitry-lipetsk dmitry-lipetsk Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want, I can replace last two lines with something like this, too:

        info = self.show_pb(backup_dir, 'node')
        self.assertIsNotNone(info)
        self.assertEqual(len(info), 2)
        self.assertIsNotNone(info[0])
        self.assertIsNotNone(info[1])
        self.assertIn('status', info[0].keys())
        self.assertIn('status', info[1].keys())
        self.assertEqual(info[0]['status'], 'CORRUPT')
        self.assertEqual(info[1]['status'], 'OK')

self.assertEqual(self.show_pb(backup_dir, 'node')[1]['status'], 'OK')