-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
tests: simplify initialisation and wiring #10653
tests: simplify initialisation and wiring #10653
Conversation
c6881f1
to
f0f979b
Compare
install_test_init=tests/functional/init.sh | ||
$(foreach test, $(install-tests), \ | ||
$(eval $(call run-test,$(test),$(install_test_init))) \ | ||
$(eval $(call run-test,$(test))) \ | ||
$(eval installcheck: $(test).test)) | ||
$(foreach test-group, $(install-tests-groups), \ | ||
$(eval $(call run-test-group,$(test-group),$(install_test_init))) \ | ||
$(eval $(call run-test-group,$(test-group))) \ | ||
$(eval installcheck: $(test-group).test-group) \ | ||
$(foreach test, $($(test-group)-tests), \ | ||
$(eval $(call run-test,$(test),$(install_test_init))) \ | ||
$(eval $(call run-test,$(test))) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good! this was a layer violation
ab52cba
to
00285da
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-05-06-nix-team-meeting-minutes-143/45021/1 |
3dd505b
to
2cdc07f
Compare
pararameterisation is not actually needed the way things are currently set up, and it confused me when trying to understand what the code does. all but one test sources vars-and-functions.sh, which nominally only defines variables, but in practice is always coupled with the actual initialisation. while the cleaner way of making this more legible would be to source variables and initialisation separately, this would produce a huge diff. the change requires a few small fixes to keep the tests working: - only create test home directory during initialisation that vars-and-functions.sh wrote to the file system seems not write - fix creation of the test directory due to statefulness, the test home directory was implicitly creating the test root, too. decoupling that made it apparent that this was probably not intentional, and certainly confusing. - only source vars-and-functions.sh if init.sh is not needed there is one test case that only needs a helper function but no initialisation side effects - remove some unnecessary cleanups and split parts of re-used test code there were confusing bits in how initialisation code was repurposed, which break if trying to refactor the outer layers naively...
previously the test directory could have been left untouched before executing a test when `init.sh` was not run - and sometimes it isn't supposed to be run - which made the test suite highly stateful and thus behaving surprisingly on multiple runs.
c3ccacc
to
391c7da
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-05-13-nix-team-meeting-minutes-145/45437/1 |
pararameterisation is not actually needed the way things are currently set up, and it confused me when trying to understand what the code does.
all but one test sources vars-and-functions.sh, which nominally only defines variables, but in practice is always coupled with the actual initialisation. while the cleaner way of making this more legible would be to source variables and initialisation separately, this would produce a huge diff.
Slowly working towards #9066
Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.