Skip to content

Commit 061496c

Browse files
Yury Samkevichfacebook-github-bot
Yury Samkevich
authored andcommitted
test to repro 'failed to start transient scope unit'
Reviewed By: IanChilds Differential Revision: D71484711 fbshipit-source-id: f4f4fa982ec84776ebe3783a60d03d23efc52fe2
1 parent fe88ab0 commit 061496c

File tree

5 files changed

+62
-0
lines changed

5 files changed

+62
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
#
3+
# This source code is licensed under both the MIT license found in the
4+
# LICENSE-MIT file in the root directory of this source tree and the Apache
5+
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
6+
# of this source tree.
7+
8+
# pyre-strict
9+
10+
from __future__ import annotations
11+
12+
from buck2.tests.e2e_util.api.buck import Buck
13+
from buck2.tests.e2e_util.asserts import expect_failure
14+
from buck2.tests.e2e_util.buck_workspace import buck_test
15+
16+
17+
# To not fail listing on Mac or Windows
18+
def test_dummy() -> None:
19+
pass
20+
21+
22+
@buck_test(skip_for_os=["darwin", "windows"])
23+
async def test_failed_to_start_transient_unit(buck: Buck) -> None:
24+
await buck.build("//:my_rule", "--no-remote-cache", "--local-only")
25+
await buck.kill()
26+
result = await expect_failure(
27+
buck.build("//:my_rule", "--no-remote-cache", "--local-only")
28+
)
29+
# TODO(yurysamkevich): this is a bug, we can't create a scope unit
30+
# if there is live process in an action cgroup after the action finished execution
31+
assert "Failed to start transient scope unit" in result.stderr
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[buildfile]
2+
name = TARGETS.fixture
3+
4+
[repositories]
5+
root = .
6+
prelude = .
7+
8+
[buck2_resource_control]
9+
status = required

tests/core/executor/test_resource_control_cgroup_creation_data/.buckroot

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
load(":prelude.bzl", "my_rule")
2+
3+
my_rule(
4+
name = "my_rule",
5+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
#
3+
# This source code is licensed under both the MIT license found in the
4+
# LICENSE-MIT file in the root directory of this source tree and the Apache
5+
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
6+
# of this source tree.
7+
8+
def _impl(ctx):
9+
out = ctx.actions.declare_output("out")
10+
11+
# run a process in a background that exits in 1000 secs
12+
# this way a cgoup will exist till the process finishes
13+
# although action finishes immediately
14+
ctx.actions.run(cmd_args(["sh", "-c", 'touch "$1"; sleep 1000 &', "--", out.as_output()]), category = "run")
15+
return [DefaultInfo(default_output = out)]
16+
17+
my_rule = rule(impl = _impl, attrs = {})

0 commit comments

Comments
 (0)