Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
17bd15b
pants: fix running st2common/tests/unit/test_policies.py by adding de…
cognifloyd May 23, 2024
22425f2
pants: update deps so pants can run test_policies_registrar.py tests
cognifloyd May 23, 2024
33c2bd1
pants: adjust deps to fix running test_shell_action_system_model tests
cognifloyd May 23, 2024
f6c0d2c
pants: register dependency on stevedore namespaces in st2actions/test…
cognifloyd May 24, 2024
aff5e3e
pants: record st2actions/tests/unit deps on runners
cognifloyd May 24, 2024
85e5e44
pants: add deps on stevedore_namespaces for st2reactor tests
cognifloyd May 24, 2024
a620972
pants: add deps on stevedore_namespaces for st2stream tests
cognifloyd May 24, 2024
e9f7da8
pants: add deps so pants can run st2auth unit tests
cognifloyd May 24, 2024
19837f7
pants: add BUILD deps to run st2api unit tests
cognifloyd May 24, 2024
89f9352
wip support for running action_chain_runner tests via pants+pytest
cognifloyd Jun 11, 2024
af7cfe9
pants: add note about upcoming pants feature for action runner tests
cognifloyd Jul 30, 2024
780f838
pants: note that a test needs mongo
cognifloyd Aug 1, 2024
3bc545f
pants: record python_tests(entry_point_dependencies=...) for runner t…
cognifloyd Sep 10, 2024
d50bdc6
pants: record test dependency that was not inferred
cognifloyd Sep 11, 2024
b586f68
pants: record test dependencies that could not easily be inferred
cognifloyd Sep 11, 2024
24de9bd
pants: record test dependency on st2common.metrics.driver
cognifloyd Sep 11, 2024
40c5e20
python runner test depends on rbac backend
cognifloyd Sep 11, 2024
16c4d2f
pants: add dependency metadata for orquesta unit tests
cognifloyd Sep 11, 2024
fe68e2c
pants: add BUILD metadata for pack tests
cognifloyd Sep 12, 2024
6929fc1
update changelog entry
cognifloyd Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,36 @@ python_requirements(
"st2auth/st2auth/backends/constants.py",
]
),
# make sure anything that uses st2-rbac-backend gets its deps
"st2-rbac-backend": dict(
dependencies=[
# alphabetical order
"st2common/st2common/config.py",
"st2common/st2common/constants/keyvalue.py",
"st2common/st2common/constants/triggers.py",
"st2common/st2common/content/loader.py",
"st2common/st2common/exceptions/db.py",
"st2common/st2common/exceptions/rbac.py",
"st2common/st2common/log.py",
"st2common/st2common/models/api/rbac.py",
"st2common/st2common/models/db/action.py",
"st2common/st2common/models/db/auth.py",
"st2common/st2common/models/db/pack.py",
"st2common/st2common/models/db/rbac.py",
"st2common/st2common/models/db/webhook.py",
"st2common/st2common/models/system/common.py",
"st2common/st2common/persistence/auth.py",
"st2common/st2common/persistence/execution.py",
"st2common/st2common/persistence/rbac.py",
"st2common/st2common/rbac/backends/__init__.py",
"st2common/st2common/rbac/backends/base.py",
"st2common/st2common/rbac/types.py",
"st2common/st2common/script_setup.py",
"st2common/st2common/util/action_db.py",
"st2common/st2common/util/misc.py",
"st2common/st2common/util/uid.py",
]
),
},
)

Expand All @@ -38,6 +68,13 @@ target(
],
)

target(
name="rbac_backends",
dependencies=[
"//:reqs#st2-rbac-backend",
],
)

python_test_utils(
name="test_utils",
skip_pylint=True,
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Added
* Continue introducing `pants <https://www.pantsbuild.org/docs>`_ to improve DX (Developer Experience)
working on StackStorm, improve our security posture, and improve CI reliability thanks in part
to pants' use of PEX lockfiles. This is not a user-facing addition.
#6118 #6141 #6133 #6120 #6181 #6183 #6200 #6237 #6229 #6240 #6241 #6244 #6251 #6253
#6118 #6141 #6133 #6120 #6181 #6183 #6200 #6237 #6229 #6240 #6241 #6244 #6251 #6253 #6254
Contributed by @cognifloyd
* Build of ST2 EL9 packages #6153
Contributed by @amanda11
Expand Down
8 changes: 7 additions & 1 deletion contrib/chatops/actions/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
python_sources()
python_sources(
overrides={
"format_execution_result.py": dict(
dependencies=["./templates"],
),
},
)
3 changes: 3 additions & 0 deletions contrib/chatops/actions/templates/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources(
sources=["*.j2"],
)
5 changes: 4 additions & 1 deletion contrib/chatops/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ files(

python_tests(
name="tests",
dependencies=[":fixtures"],
dependencies=[
":fixtures",
"contrib/chatops:metadata",
],
skip_pylint=True,
)
1 change: 1 addition & 0 deletions contrib/core/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ python_tests(
# Use contrib/core as the canonical copy.
"contrib/core:reqs#mail-parser",
],
uses=["mongo"],
),
},
)
18 changes: 18 additions & 0 deletions contrib/packs/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,22 @@ __defaults__(

python_tests(
skip_pylint=True,
overrides={
"test_action_aliases.py": dict(
dependencies=[
# test needs the pack and aliases metadata
"contrib/packs:metadata",
],
),
"test_action_unload.py": dict(
stevedore_namespaces=[
"st2common.metrics.driver",
],
entry_point_dependencies={
"contrib/runners/http_runner": ["st2common.runners.runner"],
"contrib/runners/local_runner": ["st2common.runners.runner"],
"contrib/runners/python_runner": ["st2common.runners.runner"],
},
),
},
)
3 changes: 3 additions & 0 deletions contrib/runners/action_chain_runner/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
__defaults__(
all=dict(
skip_pylint=True,
entry_point_dependencies={
"contrib/runners/action_chain_runner": ["st2common.runners.runner"],
},
)
)

Expand Down
7 changes: 7 additions & 0 deletions contrib/runners/action_chain_runner/tests/unit/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ __defaults__(

python_tests(
name="tests",
stevedore_namespaces=[
"st2common.rbac.backend",
"st2common.metrics.driver",
# the core pack uses all runners.
"st2common.runners.runner",
],
uses=["mongo"],
)
3 changes: 3 additions & 0 deletions contrib/runners/announcement_runner/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
__defaults__(
all=dict(
skip_pylint=True,
entry_point_dependencies={
"contrib/runners/announcement_runner": ["st2common.runners.runner"],
},
)
)

Expand Down
3 changes: 3 additions & 0 deletions contrib/runners/http_runner/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
__defaults__(
all=dict(
skip_pylint=True,
entry_point_dependencies={
"contrib/runners/http_runner": ["st2common.runners.runner"],
},
)
)

Expand Down
3 changes: 3 additions & 0 deletions contrib/runners/inquirer_runner/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
__defaults__(
all=dict(
skip_pylint=True,
entry_point_dependencies={
"contrib/runners/inquirer_runner": ["st2common.runners.runner"],
},
)
)

Expand Down
3 changes: 3 additions & 0 deletions contrib/runners/local_runner/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
__defaults__(
all=dict(
skip_pylint=True,
entry_point_dependencies={
"contrib/runners/local_runner": ["st2common.runners.runner"],
},
)
)

Expand Down
3 changes: 3 additions & 0 deletions contrib/runners/noop_runner/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
__defaults__(
all=dict(
skip_pylint=True,
entry_point_dependencies={
"contrib/runners/noop_runner": ["st2common.runners.runner"],
},
)
)

Expand Down
6 changes: 6 additions & 0 deletions contrib/runners/orquesta_runner/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
__defaults__(
all=dict(
skip_pylint=True,
entry_point_dependencies={
"contrib/runners/orquesta_runner": [
"st2common.runners.runner",
"orquesta.expressions.functions",
],
},
)
)

Expand Down
10 changes: 10 additions & 0 deletions contrib/runners/orquesta_runner/tests/unit/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ __defaults__(

python_tests(
name="tests",
stevedore_namespaces=[
"st2common.metrics.driver",
"st2common.rbac.backend",
# the core pack uses all runners.
"st2common.runners.runner",
"orquesta.expressions.functions",
],
overrides={
(
"test_basic.py",
Expand All @@ -16,6 +23,9 @@ python_tests(
): dict(
uses=["system_user"],
),
"test_policies.py": dict(
dependencies=["st2actions/st2actions/policies/retry.py"]
),
},
)

Expand Down
3 changes: 3 additions & 0 deletions contrib/runners/python_runner/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
__defaults__(
all=dict(
skip_pylint=True,
entry_point_dependencies={
"contrib/runners/python_runner": ["st2common.runners.runner"],
},
)
)

Expand Down
5 changes: 5 additions & 0 deletions contrib/runners/python_runner/tests/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ __defaults__(

python_tests(
name="tests",
overrides={
"test_python_action_process_wrapper.py": dict(
dependencies=["contrib/examples/actions/noop.py"]
)
},
)
16 changes: 16 additions & 0 deletions contrib/runners/python_runner/tests/unit/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,20 @@ __defaults__(

python_tests(
name="tests",
overrides={
"test_output_schema.py": dict(
dependencies=[
"st2tests/st2tests/resources/packs/pythonactions/actions/pascal_row.py",
],
),
"test_pythonrunner.py": dict(
dependencies=[
"st2tests/st2tests/resources/packs/pythonactions/actions",
],
stevedore_namespaces=[
"st2common.metrics.driver",
"st2common.rbac.backend",
],
),
},
)
3 changes: 3 additions & 0 deletions contrib/runners/remote_runner/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
__defaults__(
all=dict(
skip_pylint=True,
entry_point_dependencies={
"contrib/runners/remote_runner": ["st2common.runners.runner"],
},
)
)

Expand Down
3 changes: 3 additions & 0 deletions contrib/runners/winrm_runner/tests/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
__defaults__(
all=dict(
skip_pylint=True,
entry_point_dependencies={
"contrib/runners/winrm_runner": ["st2common.runners.runner"],
},
)
)

Expand Down
19 changes: 18 additions & 1 deletion st2actions/tests/unit/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,30 @@ __defaults__(

python_tests(
name="tests",
uses=["mongo"],
overrides={
(
"test_execution_cancellation.py",
"test_runner_container.py",
"test_worker.py",
): dict(
uses=["system_user"],
uses=["mongo", "system_user"],
),
(
"test_execution*.py",
"test_notifier.py",
"test_output_schema.py",
"test_policies.py",
"test_queue_consumers.py",
"test_runner_container.py",
"test_scheduler*.py",
"test_worker.py",
"test_workflow_engine.py",
): dict(
stevedore_namespaces=[
"st2common.runners.runner",
"st2common.metrics.driver",
],
),
},
)
5 changes: 5 additions & 0 deletions st2actions/tests/unit/policies/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
python_tests(
name="tests",
stevedore_namespaces=[
"st2common.runners.runner",
"st2common.metrics.driver",
],
uses=["mongo"],
)
5 changes: 5 additions & 0 deletions st2api/tests/unit/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ __defaults__(

python_tests(
name="tests",
dependencies=["//:rbac_backends"],
stevedore_namespaces=[
"st2common.rbac.backend",
],
uses=["mongo"],
)
4 changes: 4 additions & 0 deletions st2api/tests/unit/controllers/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
python_tests(
name="tests",
stevedore_namespaces=[
"st2common.metrics.driver",
],
uses=["mongo"],
)
13 changes: 12 additions & 1 deletion st2api/tests/unit/controllers/v1/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
python_tests(
name="tests",
stevedore_namespaces=[
"st2common.runners.runner",
"st2common.rbac.backend",
"st2common.metrics.driver",
],
uses=["mongo"],
overrides={
(
"test_alias_execution.py",
Expand All @@ -8,7 +14,12 @@ python_tests(
"test_executions.py",
"test_inquiries.py",
): dict(
uses=["system_user"],
uses=["mongo", "system_user"],
),
"test_webhooks.py": dict(
dependencies=[
"st2common/st2common/models/api/webhook.py",
],
),
},
)
2 changes: 2 additions & 0 deletions st2auth/tests/unit/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ __defaults__(

python_tests(
name="tests",
dependencies=["//:auth_backends"],
uses=["mongo"],
)
5 changes: 5 additions & 0 deletions st2auth/tests/unit/controllers/v1/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
python_tests(
name="tests",
stevedore_namespaces=[
"st2auth.sso.backends",
"st2common.metrics.driver",
],
uses=["mongo"],
)
9 changes: 8 additions & 1 deletion st2common/tests/fixtures/local_runner/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
python_sources()
resources(
name="command_strings",
sources=["escaping_test_command_*.txt"],
)

python_sources(
dependencies=[":command_strings"],
)
Loading