Commit 8633dc9c authored by Jérome Perrin's avatar Jérome Perrin

software/erp5/test: fix flaky test_full_backup

When the backup script takes more than one second the file name is not
20500101000000.sql.gz
parent b7a7b1d6
...@@ -108,19 +108,24 @@ class MariaDBTestCase(ERP5InstanceTestCase): ...@@ -108,19 +108,24 @@ class MariaDBTestCase(ERP5InstanceTestCase):
class TestCrontabs(MariaDBTestCase, CrontabMixin): class TestCrontabs(MariaDBTestCase, CrontabMixin):
_save_instance_file_pattern_list = \
MariaDBTestCase._save_instance_file_pattern_list + (
'*/srv/backup/*',
)
def test_full_backup(self): def test_full_backup(self):
# type: () -> None # type: () -> None
self._executeCrontabAtDate('mariadb-backup', '2050-01-01') self._executeCrontabAtDate('mariadb-backup', '2050-01-01')
with gzip.open( full_backup_file, = glob.glob(
os.path.join( os.path.join(
self.computer_partition_root_path, self.computer_partition_root_path,
'srv', 'srv',
'backup', 'backup',
'mariadb-full', 'mariadb-full',
'20500101000000.sql.gz', '205001010000??.sql.gz',
), ))
'rt') as dump:
with gzip.open(full_backup_file, 'rt') as dump:
self.assertIn('CREATE TABLE', dump.read()) self.assertIn('CREATE TABLE', dump.read())
def test_logrotate_and_slow_query_digest(self): def test_logrotate_and_slow_query_digest(self):
...@@ -193,6 +198,7 @@ class TestCrontabs(MariaDBTestCase, CrontabMixin): ...@@ -193,6 +198,7 @@ class TestCrontabs(MariaDBTestCase, CrontabMixin):
"Expected slowest query : 0.1 and current is: 3\n", "Expected slowest query : 0.1 and current is: 3\n",
) )
class TestMariaDB(MariaDBTestCase): class TestMariaDB(MariaDBTestCase):
def test_utf8_collation(self): def test_utf8_collation(self):
# type: () -> None # type: () -> None
......
...@@ -96,18 +96,24 @@ class MariaDBTestCase(ERP5InstanceTestCase): ...@@ -96,18 +96,24 @@ class MariaDBTestCase(ERP5InstanceTestCase):
class TestCrontabs(MariaDBTestCase, CrontabMixin): class TestCrontabs(MariaDBTestCase, CrontabMixin):
_save_instance_file_pattern_list = \
MariaDBTestCase._save_instance_file_pattern_list + (
'*/srv/backup/*',
)
def test_full_backup(self): def test_full_backup(self):
# type: () -> None
self._executeCrontabAtDate('mariadb-backup', '2050-01-01') self._executeCrontabAtDate('mariadb-backup', '2050-01-01')
with gzip.open( full_backup_file, = glob.glob(
os.path.join( os.path.join(
self.computer_partition_root_path, self.computer_partition_root_path,
'srv', 'srv',
'backup', 'backup',
'mariadb-full', 'mariadb-full',
'20500101000000.sql.gz', '205001010000??.sql.gz',
), ))
'rt') as dump:
with gzip.open(full_backup_file, 'rt') as dump:
self.assertIn('CREATE TABLE', dump.read()) self.assertIn('CREATE TABLE', dump.read())
def test_logrotate_and_slow_query_digest(self): def test_logrotate_and_slow_query_digest(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment