Skip to content

Commit

Permalink
[antlir2][tests] mark loop-requiring tests as serialize
Browse files Browse the repository at this point in the history
Summary:
There is no atomic API to allocate a loop device in such a way that we can pass
it into a container test. Adding to the inconvenience, loop devices are not
namespaceable so we can't just let the container allocate its own devices.

I've tried to add all kinds of file locks, but the only way I've been able to
work around this is to add the `serialize` label to any tests that use this
feature (there are only two - incremental senstreams and the integration test
for the test runner to prove that this feature works)

Test Plan:
```
❯ buck2 test fbcode//antlir/antlir2/testing/tests:test-loop -- --run-disabled --jobs 18 --stress-runs 10 --record-results
Buck UI: https://www.internalfb.com/buck2/133c66f7-27b4-485c-a3c7-32fe9f38aa04
Test UI: https://www.internalfb.com/intern/testinfra/testrun/15199648754600322
Note:    Using experimental modern dice
Network: Up: 8.0KiB  Down: 0B  (reSessionID-c7b0afae-3752-4d7c-8b98-00238743d41b)
Jobs completed: 30. Time elapsed: 7.9s.
Cache hits: 0%. Commands: 1 (cached: 0, remote: 0, local: 1)
Tests finished: Pass 10. Fail 0. Fatal 0. Skip 0. Build failure 0
```

Reviewed By: sergeyfd

Differential Revision: D51632352

fbshipit-source-id: c58a3e81d086af3877fabb153b7d1f234aff555b
  • Loading branch information
vmagro authored and facebook-github-bot committed Nov 29, 2023
1 parent b43b470 commit 3088d2a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions antlir/antlir2/testing/image_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ def _implicit_image_test(
labels = add_test_framework_label(HIDE_TEST_LABELS, "test-framework=7:antlir_image_test"),
**kwargs
)

# Allocating loop devices is very flaky since there is no atomic api
if allocate_loop_devices:
_add_outer_labels = list(_add_outer_labels) + ["serialize"]
labels = selects.apply(
labels or [],
lambda labels: labels + _add_outer_labels,
Expand Down

0 comments on commit 3088d2a

Please sign in to comment.