-
Notifications
You must be signed in to change notification settings - Fork 66
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
Missing, Outdated OS Tests #347
Comments
Good idea ! Also see #77, #81 and #79. There is also a TODO-list in the sources (to be cleaned). Good luck 🙏 |
Thanks @HorlogeSkynet -- I had no idea the symlinks mattered, that's good to know! When you get a chance, I'd appreciate it if you could clarify the following:
|
Hey @pranavmarla 🙏
Actually, whether current distro implementation is broken or not, you should include in the "rootfs" each file that should be ignored, or must be parsed. For your point I hope I've not missed one of your points. |
Thank you @HorlogeSkynet -- appreciate the speedy response!
Would you mind clarifying this as well? |
Yes sorry, why not, renaming the test folder to |
Perfect, thanks! |
Any news on this @pranavmarla ? 🙂 |
@HorlogeSkynet I'm afraid I haven't had a chance to work on this since my last update -- I'm hoping to get back into it next year, but unfortunately can't give an estimate of when that will be |
Test Contribution GuideFor my own reference, summarizing all the info that's useful to know when adding a test case for a particular OS/distro below. Will keep updating this post as I come across more useful info. What info does
|
# Base file names to be ignored when searching for distro release file |
Line 1201 in c443f12
cmd = ("uname", "-rs") |
What does the test structure look like?
Overview
- First, you need to obtain the relevant system files from the OS and upload them to the
distro
repo, to the tests/resources/distros/ folder - The actual tests are located in test_distro.py
- There are different classes for the different sources of info
distro
uses to identify the OS -- under each class, you will add a test case comparing the expected/desired output with the actual output generated bydistro
processing that particular source of info (i.e. the system file you uploaded)
- There are different classes for the different sources of info
Which files should we upload?
- In theory, you could get away with just uploading the files currently used by
distro
to identify the OS (i.e. the OS release file and the distro release file). To be safe though, as HorlogeSkynet mentioned, you should probably just upload every system file that could possibly be used to identify the OS -- that way, ifdistro
decides to expand its sources of identifying information in the future, your test artifacts will still be sufficient - For similar reasons, if the original system file on the OS is merely a symlink to another file, you should maintain that same symlink structure in the respository as well
Eg. In RHEL 6,/etc/system-release
is just a symlink to/etc/redhat-release
, and so that relationship is maintained in the repository as well
Test details
Specifically, these are the classes in test_distro.py that are relevant:
TestOSRelease
, corresponding to the OS release fileTestLSBRelease
, corresponding to the lsb_release command- You need to create a shell script to serve as the
lsb_release
binary. Note that this is not meant to be a full-fledged replacement forlsb_release
-- instead, all it does is produce the output that we expect to get when running the actuallsb_release -a
command on the OS
- You need to create a shell script to serve as the
TestDistroRelease
, corresponding to the distro release file- Note: If the OS doesn't have a valid distro release file, then you need to call
_test_non_existing_release_file()
Eg. See here
- Note: If the OS doesn't have a valid distro release file, then you need to call
- Note: There doesn't appear to be any class corresponding to the uname command
- Finally, there is a main class called
TestOverall
- Each test within that class tests the "final" output generated by
distro
after searching through all the possible sources of info in order of precedence - In addition, for some reason I didn't quite follow, it looks like each test needs to also check the distro release file output again
- Each test within that class tests the "final" output generated by
Running the tests
Use Linux as local machine
When running the distro
test suite locally, note that the tests will only run on a Linux machine. Thus, if you make changes to the distro
code on a Windows machine and then run the tests to validate your changes, all the tests will be skipped!
Useful Commands
- Run full test suite:
tox
- Run only linters:
tox -e lint
- Run only code tests:
- Eg. Only the Python 3.8, 3.9 and 3.10 tests:
tox -e py38,py39,py310
- Eg. Only the Python 3.8, 3.9 and 3.10 tests:
Hi, I noticed that there don't appear to be any tests for the following OSs:
Ubuntu 18
Ubuntu 20
Ubuntu 22
RHEL 8
Amazon Linux (2018)
Amazon Linux 2
In addition, although there are tests for the following OSs, they appear to be either outdated or wrong:
RHEL 7
I am hoping to fix these myself but, before I do so, I thought I'd open this issue first -- this will be my first time contributing to this repo, so please feel free to let me know if you have any tips, suggestions, etc. 🙂
The text was updated successfully, but these errors were encountered: