Closed tai271828 closed 3 years ago
@dannf this pull request is ready to review. I don't have the permission of this repository to request reviewer, so let me mention you directly.
Thanks @tai271828 for creating this - automated testing will definitely be valuable!
Would it be feasible/reasonable to dynamically create a mock 20.04.2 ISO - with just the required files - instead of downloading a full one each time? That would avoid consuming bandwidth, make the test run faster, and avoid failures that would occur when e.g. 20.04.2 gets replaced by 20.04.3.
Certainly yes. Python mock module could mock url request, so we could serve the required files with our pre-prepared data instead. What else is worthy of testing in your mind? Some of them come into my mind:
- pxelinux configuration files
- output number and file names of the generated `/tmpxxx`
- file integrity by comparing the hash or content of binaries (I am not sure if this is a good idea yet)
Furthermore, if we don't want to commit so many binaries (used for testing) into our repository, we may consider to use the feature of git submodule
or git lfs
, which is similar to submodule but used for "large files storage". Only people who want to develop and test the code need/want to fetch the binaries for testing.
Please notice the current test case does not download anything but serving grub.cfg
that I manually extracted from iso. It's a one-off task for each new iso release.
Thanks @tai271828 for creating this - automated testing will definitely be valuable!
Would it be feasible/reasonable to dynamically create a mock 20.04.2 ISO - with just the required files - instead of downloading a full one each time? That would avoid consuming bandwidth, make the test run faster, and avoid failures that would occur when e.g. 20.04.2 gets replaced by 20.04.3.
Certainly yes. Python mock module could mock url request, so we could serve the required files with our pre-prepared data instead. What else is worthy of testing in your mind? Some of them come into my mind:
- pxelinux configuration files
Definitely
- output number and file names of the generated
/tmpxxx
+1
- file integrity by comparing the hash or content of binaries (I am not sure if this is a good idea yet)
Yeah, I'm not sure of that one either.
Furthermore, if we don't want to commit so many binaries (used for testing) into our repository, we may consider to use the feature of `git submodule` or `git lfs`, which is similar to submodule but used for "large files storage". Only people who want to develop and test the code need/want to fetch the binaries for testing. Please notice the current test case does not download anything but serving `grub.cfg` that I manually extracted from iso. It's a one-off task for each new iso release.
Oh, I misunderstood the code. I just ran it and it is very fast. So please ignore the "mock ISO" request! I think I'll go ahead and merge.
Types of changes
Description
Bootstrap the first test case with pytest.
Checklist:
poetry run pytest
locally to ensure all linter checks passSteps to Test This Pull Request
poetry run pytest
if you are not in the python virtual environment built by poetrypytest
if you have been in your python virtual environmentExpected behavior
All test cases pass. Currently there is only 1 test case.