crmsh unit tests assume UTC timezone

Bug #1958243 reported by Athos Ribeiro
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
crmsh (Ubuntu)
Fix Released
Undecided
Athos Ribeiro

Bug Description

test/unittests/test_report.py::test_ts_to_dt assumes UTC timezone. Therefore, running autopkgtest from a machine with a different timezone set will trigger an error in the dep8 test suite for crmsh.

=================================== FAILURES ===================================
_________________________________ test_get_ts __________________________________

    def test_get_ts():
> assert ts_to_dt(get_ts(line5424_1)).strftime("%Y/%m/%d %H:%M") == "2017/01/26 03:04"
E AssertionError: assert '2017/01/26 00:04' == '2017/01/26 03:04'
E - 2017/01/26 03:04
E ? ^
E + 2017/01/26 00:04
E ? ^

test_report.py:220: AssertionError
----------------------------- Captured stdout call -----------------------------
ERROR: parse_time 2017-01-26T11:04:19.562885+08:00 12sp2-4 kernel:: Unknown string format: 2017-01-26T11:04:19.562885+08:00 12sp2-4 kernel:
INFO: autopkgtest# the log file is in the rfc5424 format
________________________________ test_ts_to_dt _________________________________

    def test_ts_to_dt():
        ts1 = crmsh.utils.parse_to_timestamp("2pm")
        ts2 = crmsh.utils.parse_to_timestamp("2007/9/5 12:30")
        ts3 = crmsh.utils.parse_to_timestamp("1:00")
        ts4 = crmsh.utils.parse_to_timestamp("09-Sep-15 2:00")
        ts5 = crmsh.utils.parse_to_timestamp("2017-06-01T14:27:08.412531+08:00")

        assert ts_to_dt(ts1).strftime("%-I%P") == "2pm"
        assert ts_to_dt(ts2).strftime("%Y/%-m/%-d %H:%M") == "2007/9/5 12:30"
        assert ts_to_dt(ts3).strftime("%-H:%M") == "1:00"
        assert ts_to_dt(ts4).strftime("%d-%b-%y %-H:%M") == "09-Sep-15 2:00"
> assert ts_to_dt(ts5).strftime("%Y/%m/%d %H:%M:%S") == "2017/06/01 06:27:08"
E AssertionError: assert '2017/06/01 03:27:08' == '2017/06/01 06:27:08'
E - 2017/06/01 06:27:08
E ? ^
E + 2017/06/01 03:27:08
E ? ^

test_report.py:326: AssertionError

Related branches

Changed in crmsh (Ubuntu):
assignee: nobody → Athos Ribeiro (athos-ribeiro)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package crmsh - 4.2.1-3ubuntu2

---------------
crmsh (4.2.1-3ubuntu2) jammy; urgency=medium

  * New changes:
    - d/p/0017-Fix-health-scripts-python-38-support.patch: remove deprecated
      function usage (LP: #1947022).
    - d/p/0018-Replace-crmd.patch: replace crmd calls with pacemaker-controld
      (LP: #1958241).
    - d/t/testsuite.sh: set timezone for time conversion tests (LP: #1958243).
    - d/p/0019-Add-hb_report-dpkg-support.patch: add dpkg support to hb_report
      (LP: #1958246).
    - d/p/0020-Use-crmsh-hb_report.patch: use the crmsh shipped hb_report script
      when available (LP: #1958247).

 -- Athos Ribeiro <email address hidden> Fri, 07 Jan 2022 10:14:32 -0300

Changed in crmsh (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.