diff options
Diffstat (limited to 'debian/patches/0022-Fix-findln-by-timestamp-test.patch')
-rw-r--r-- | debian/patches/0022-Fix-findln-by-timestamp-test.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/debian/patches/0022-Fix-findln-by-timestamp-test.patch b/debian/patches/0022-Fix-findln-by-timestamp-test.patch new file mode 100644 index 0000000..14e996c --- /dev/null +++ b/debian/patches/0022-Fix-findln-by-timestamp-test.patch @@ -0,0 +1,34 @@ +From ee77de8e8b2f9820303d9d049ad39ccf9fcc6ba3 Mon Sep 17 00:00:00 2001 +From: xin liang <xliang@suse.com> +Date: Sun, 7 Apr 2024 09:46:13 +0800 +Subject: [PATCH] Dev: unittest: Adjust unit test + +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1068562 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/crmsh/+bug/2060536 +Forwarded: https://github.com/ClusterLabs/crmsh/pull/1379/commits/ee77de8e8b2f9820303d9d049ad39ccf9fcc6ba3 +Last-Update: 2024-04-10 +--- + test/unittests/test_report_utils.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/test/unittests/test_report_utils.py ++++ b/test/unittests/test_report_utils.py +@@ -816,7 +816,8 @@ + + def test_findln_by_timestamp(self): + target_time = "Apr 03 13:10" +- target_time_stamp = crmutils.parse_to_timestamp(target_time+' 2023') ++ this_year = datetime.datetime.now().year ++ target_time_stamp = crmutils.parse_to_timestamp(target_time+' '+str(this_year)) + with open('pacemaker.log') as f: + data = f.read() + constants.STAMP_TYPE = utils.determin_log_format(data) +@@ -828,7 +829,7 @@ + assert result_pre_line_stamp < target_time_stamp + + target_time = "Apr 03 11:01:19" +- target_time_stamp = crmutils.parse_to_timestamp(target_time+' 2023') ++ target_time_stamp = crmutils.parse_to_timestamp(target_time+' '+str(this_year)) + result_line = utils.findln_by_timestamp(data, target_time_stamp, pacemaker_file_path) + result_time = ' '.join(data.split('\n')[result_line-1].split()[:3]) + self.assertEqual(result_time, target_time) |