-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[antlir2][image_test] fix run_as_user
Summary: This is almost always `root`, so there was a bug where it actually just wasn't respected. Test Plan: ``` ❯ buck test fbcode//antlir/antlir2/testing/tests:test-{cpp,py,rust,sh}{,-booted}{,-nobody} ❯ buck2 test fbcode//antlir/antlir2/testing/tests:test-cpp fbcode//antlir/antlir2/testing/tests:test-cpp-nobody fbcode//antlir/antlir2/testing/tests:test-cpp-booted fbcode//antlir/antlir2/testing/tests:test-cpp-booted-nobody fbcode//antlir/antlir2/testing/tests:test-py fbcode//antlir/antlir2/testing/tests:test-py-nobody fbcode//antlir/antlir2/testing/tests:test-py-booted fbcode//antlir/antlir2/testing/tests:test-py-booted-nobody fbcode//antlir/antlir2/testing/tests:test-rust fbcode//antlir/antlir2/testing/tests:test-rust-nobody fbcode//antlir/antlir2/testing/tests:test-rust-booted fbcode//antlir/antlir2/testing/tests:test-rust-booted-nobody fbcode//antlir/antlir2/testing/tests:test-sh fbcode//antlir/antlir2/testing/tests:test-sh-nobody fbcode//antlir/antlir2/testing/tests:test-sh-booted fbcode//antlir/antlir2/testing/tests:test-sh-booted-nobody Buck UI: https://www.internalfb.com/buck2/61a6eeed-c724-47f3-a9e1-2c5477755d58 Test UI: https://www.internalfb.com/intern/testinfra/testrun/6192449637559960 Network: Up: 168KiB Down: 114KiB (reSessionID-bf4f1f71-3662-4499-93eb-cd6bf1473fac) Jobs completed: 278. Time elapsed: 15.3s. Cache hits: 29%. Commands: 56 (cached: 16, remote: 0, local: 40) Tests finished: Pass 28. Fail 0. Fatal 0. Skip 0. Build failure 0 ``` Reviewed By: sergeyfd Differential Revision: D50156479 fbshipit-source-id: ec176021b72271f65b17b6f311007dd355d0a482
- Loading branch information
1 parent
732d86a
commit 2cdd1aa
Showing
7 changed files
with
90 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
def test_variants( | ||
*, | ||
test_rule, | ||
lang: str, | ||
layer: str = ":base", | ||
**kwargs): | ||
for boot in [True, False, "wait-default"]: | ||
name = "test-" + lang + ("-booted" if boot else "") | ||
name = name + ("-requires-units" if boot == "wait-default" else "") | ||
for user in ["root", "nobody"]: | ||
test_rule( | ||
name = name + ("-" + user if user != "root" else ""), | ||
boot = bool(boot), | ||
boot_requires_units = ["default.target"] if boot == "wait-default" else None, | ||
run_as_user = user, | ||
layer = layer, | ||
env = { | ||
"ANTLIR2_TEST": "1", | ||
"BOOT": str(boot), | ||
"TEST_USER": user, | ||
}, | ||
**kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters