From 7cdcb7ac63ede192af4639675bf21e80c2a3a752 Mon Sep 17 00:00:00 2001 From: Tom Barron Date: Mon, 16 Mar 2015 03:43:18 -0400 Subject: [PATCH] Reduce configured file size for nfs backup unit tests Unit tests that were ported from the Swift backup service for NFS backup trigger memory errors when run in tox on a 1GB VM. This commit configures NFS backup 'backup_file_size' to match the default Swift 'chunk_size' so that the NFS backup unit test memory consumption is dialed down to match the Swift unit tests. Closes-Bug: 1432687 Change-Id: I4b71d47190179b97baefe9bc390276f720670919 --- cinder/tests/backup/drivers/test_backup_nfs.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cinder/tests/backup/drivers/test_backup_nfs.py b/cinder/tests/backup/drivers/test_backup_nfs.py index 973a4ba13..7ac948506 100644 --- a/cinder/tests/backup/drivers/test_backup_nfs.py +++ b/cinder/tests/backup/drivers/test_backup_nfs.py @@ -281,6 +281,7 @@ class BackupNFSSwiftBasedTestCase(test.TestCase): self.override_config('backup_share', FAKE_BACKUP_SHARE) self.override_config('backup_mount_point_base', '/tmp') + self.override_config('backup_file_size', 52428800) mock_remotefsclient = mock.Mock() mock_remotefsclient.get_mount_point = mock.Mock( return_value=self.temp_dir) @@ -342,7 +343,7 @@ class BackupNFSSwiftBasedTestCase(test.TestCase): service.backup(backup, self.volume_file) self.assertTrue(_send_progress.called) self.assertTrue(_send_progress_end.called) - return + # If the backup_object_number_per_notification is increased to # another value, the _send_progress method will not be called. _send_progress.reset_mock() @@ -480,9 +481,9 @@ class BackupNFSSwiftBasedTestCase(test.TestCase): self.assertEqual(backup['container'], container_name) # Create incremental backup with no change to contents - self.volume_file.seek(2 * 8 * 1024) + self.volume_file.seek(16 * 1024) self.volume_file.write(os.urandom(1024)) - self.volume_file.seek(4 * 8 * 1024) + self.volume_file.seek(20 * 1024) self.volume_file.write(os.urandom(1024)) self._create_backup_db_entry(container=container_name, backup_id=124, @@ -497,9 +498,9 @@ class BackupNFSSwiftBasedTestCase(test.TestCase): content1 = service._read_sha256file(backup) content2 = service._read_sha256file(deltabackup) - # Verify that two shas are changed at index 16 and 32 + # Verify that two shas are changed at index 16 and 20 self.assertNotEqual(content1['sha256s'][16], content2['sha256s'][16]) - self.assertNotEqual(content1['sha256s'][32], content2['sha256s'][32]) + self.assertNotEqual(content1['sha256s'][20], content2['sha256s'][20]) def test_backup_delta_two_blocks_in_object_change(self): -- 2.45.2