Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: 153 tests starts failing from v1.25.3 ++ on Linux (Ubuntu) #629

Open
pettai opened this issue Jan 4, 2025 · 6 comments
Open

bug: 153 tests starts failing from v1.25.3 ++ on Linux (Ubuntu) #629

pettai opened this issue Jan 4, 2025 · 6 comments

Comments

@pettai
Copy link
Contributor

pettai commented Jan 4, 2025

It seems some update(s) from v1.25.2 -> v1.25.3 makes lot of tests fails then running on at least various Ubuntu versions.
v1.25.2 (and older jc-releases) test-suite works flawlessly on the latest Ubuntu 24.04 LTS (and older versions of Ubuntu)

It appears lots of them are around the git_log, mdadm and rsync tests, but there's all kind of various commands that fails, many referring to various (irrelevant) OSes (like CentOS 7.7, OSX 10.14.6 and Ubuntu 18.4)

I've attached the full output here so all the FAILing tests are referenced. Here's some example output from Ubuntu 24.04 Noble:

ubuntu@noble-test:~/JC/jc-1.25.3$ uname -a
Linux noble-test 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec  5 13:09:44 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

ubuntu@noble-test:~/JC/jc-1.25.3$ ./runtests.sh
[...]
======================================================================
FAIL: test_who_ubuntu_18_4 (tests.test_who.MyTests.test_who_ubuntu_18_4)
Test 'who' on Ubuntu 18.4
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ubuntu/JC/jc-1.25.3/tests/test_who.py", line 72, in test_who_ubuntu_18_4
    self.assertEqual(jc.parsers.who.parse(self.ubuntu_18_4_who, quiet=True), self.ubuntu_18_4_who_json)
AssertionError: Lists differ: [{'us[69 chars]1583117520}, {'user': 'kbrazil', 'tty': 'pts/0[71 chars]640}] != [{'us[69 chars]1583146320}, {'user': 'kbrazil', 'tty': 'pts/0[71 chars]440}]

First differing element 0:
{'use[16 chars]tty': 'ttyS0', 'time': '2020-03-02 02:52', 'epoch': 1583117520}
{'use[16 chars]tty': 'ttyS0', 'time': '2020-03-02 02:52', 'epoch': 1583146320}

- [{'epoch': 1583117520,
?                 ^^^

+ [{'epoch': 1583146320,
?                 ^^^

    'time': '2020-03-02 02:52',
    'tty': 'ttyS0',
    'user': 'kbrazil'},
-  {'epoch': 1583117640,
?                 ^^

+  {'epoch': 1583146440,
?                 ^ +

    'from': '192.168.71.1',
    'time': '2020-03-02 02:54',
    'tty': 'pts/0',
    'user': 'kbrazil'}]

----------------------------------------------------------------------
Ran 1440 tests in 67.137s

FAILED (failures=153, skipped=1)
@pettai
Copy link
Contributor Author

pettai commented Jan 4, 2025

Ok, after doing:

$ export TZ=America/Los_Angeles

All test tests completes fine. The only thing I found in the change log that hints about timezone in release v1.25.3 was:

  • Optimize some tests by removing timezone settings and using quiet=True

runtests-missing-libs.sh has a comment about setting the correct timezone, previous to v1.25.3.
However, all the tests worked fine without the timezone setting before.

@pettai pettai closed this as completed Jan 4, 2025
@pettai pettai changed the title 153 tests starts failing from v1.25.3 ++ bug: 153 tests starts failing from v1.25.3 ++ on Linux (Ubuntu) Jan 4, 2025
@pettai pettai reopened this Jan 4, 2025
@pettai
Copy link
Contributor Author

pettai commented Jan 4, 2025

Given I can update tests/__init__.py with:

import os
os.environ['TZ'] = 'America/Los_Angeles'

(probably not a "clean" or "great" pythonic fix/workaround)

But it makes the tests work again (simply using ./runtests.sh), without any effort on the user-side.
&&
it worked well before v1.25.3 without any timezone configuration.
so this can probably be fixed in a better way within jc, hence reopening this issue as a bug.

@pettai
Copy link
Contributor Author

pettai commented Jan 6, 2025

For this to work in build-farms:

TZ=America/Los_Angeles python3 -m unittest -v

pytz is required (not always present in a minimal chrooted *pbuilder environment, it turns out...)

@kellyjonbrazil
Copy link
Owner

pytz is required (not always present in a minimal chrooted *pbuilder environment, it turns out...)

Why would pytz be required? This is just setting the TZ environment variable in the shell before running the normal unittest command.

Maybe adding the TZ to __init__.py makes sense. I just didn't like maintaining the timezone within the specific parser tests as it was repetitive.

@pettai
Copy link
Contributor Author

pettai commented Jan 14, 2025

pytz is required (not always present in a minimal chrooted *pbuilder environment, it turns out...)

Why would pytz be required? This is just setting the TZ environment variable in the shell before running the normal unittest command.

I'm guessing the minimal build environments doesn't know about timezones like America/Los_Angeles (and other simpler-to-grip TZs). Setting timezone to a older standard type, like TZ=PST8PDT (equal to Pacific, America/Los_Angeles, etc.) removed the need of pytz then packaging jc under Ubuntu/pbuilder-dist

Maybe adding the TZ to init.py makes sense. I just didn't like maintaining the timezone within the specific parser tests as it was repetitive.

Or just change runtests.sh's TZ=America/Los_Angeles to TZ=PST8PDT ?
This worked fine for us and it's a minimal change too...

@pettai
Copy link
Contributor Author

pettai commented Jan 14, 2025

I added that here #635

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants