Skip to content

Commit

Permalink
[antlir2][tests] make booted wait-for-default test more resilient
Browse files Browse the repository at this point in the history
Summary:
Check for `default.target` instead of the entire system so that this test tests
what it claimed to be testing in the first place.
Other units may have been started, leading systemd to tell us that the system
is `activating` even if `default.target` has been reached, but the test api
contract is explicitly that `default.target` has been reached, not that there
are zero still-activating units.

Test Plan:
```
❯ buck2 test fbcode//antlir/antlir2/testing/tests:test-sh-booted-requires-units-nobody -- --run-disabled --stress-runs=100
Buck UI: https://www.internalfb.com/buck2/0d29277c-4f7e-4194-9928-8edf01c3bf21
Test UI: https://www.internalfb.com/intern/testinfra/testrun/13792273897835638
Network: Up:   0B             Down:   0B
Discovered 0. Pass 55. Fail 0. Fatal 0. Skip 0. Timeout 0
Jobs completed: 202. Time elapsed: 16.7s.
Tests finished: Pass 100. Fail 0. Fatal 0. Skip 0. Build failure 0
```

Reviewed By: epilatow

Differential Revision: D59012739

fbshipit-source-id: 6e4cf670da4b0560491d658c1aab0b4139dc83a7
  • Loading branch information
vmagro authored and facebook-github-bot committed Jun 25, 2024
1 parent 92c4316 commit 928f501
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions antlir/antlir2/testing/tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ elif [ "${BOOT}" == "True" ]; then
# Easy way to check that the systemd manager is running as pid1
systemctl is-active "sysinit.target"
elif [ "${BOOT}" == "wait-default" ]; then
# This should report true by now because the test waits on default.target
if ! systemctl is-system-running; then
# systemctl is-system-running may still report 'activating' if other
# services have started but not yet activated, but we really only care
# about waiting on default.target (and everything it brings in directly)
if ! systemctl is-active default.target; then
# Run these commands to dump information that might be useful to debug a
# test failure
systemctl list-jobs
systemctl --failed
journalctl
exit 1
Expand Down

0 comments on commit 928f501

Please sign in to comment.