Merge ~chad.smith/curtin:cleanup/1847138-time-drift-unittest-fix into curtin:master

Proposed by Chad Smith
Status: Merged
Approved by: Ryan Harper
Approved revision: d7ca0ed0c3edcc64c303668368f699f4a312dbb1
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~chad.smith/curtin:cleanup/1847138-time-drift-unittest-fix
Merge into: curtin:master
Diff against target: 15 lines (+3/-1)
1 file modified
tests/unittests/test_commands_collect_logs.py (+3/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Ryan Harper (community) Approve
Review via email: mp+373776@code.launchpad.net

Commit message

tests: mock timestamp used in collect-log file creation

The unittest for curtin collect-logs uses a timestamp to
create the filename for the tarball. The selected in the
unittest versus when the call occurs may race if the delay
between the calls is greater than 1 second. Resolve this
unittest issue by providing the same timestamp value.

LP: #1847138

To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) :
review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tests/unittests/test_commands_collect_logs.py b/tests/unittests/test_commands_collect_logs.py
2index 6b958f4..1feba18 100644
3--- a/tests/unittests/test_commands_collect_logs.py
4+++ b/tests/unittests/test_commands_collect_logs.py
5@@ -298,7 +298,9 @@ class TestCreateTar(CiTestCase):
6 'install': {'log_file': log1, 'post_files': [log2, absent_log]}}
7 self.add_patch('shutil.copy', 'm_copy')
8 with mock.patch('sys.stderr') as m_stderr:
9- collect_logs.create_log_tarfile(tarfile, config=config)
10+ with mock.patch('curtin.commands.collect_logs.datetime') as m_dt:
11+ m_dt.utcnow.return_value = self.utcnow
12+ collect_logs.create_log_tarfile(tarfile, config=config)
13 self.assertIn(
14 mock.call(
15 'Skipping logfile %s: file does not exist\n' % absent_log),

Subscribers

People subscribed via source and target branches