Skip to content

Commit

Permalink
pass new depedencies parameter to test utils
Browse files Browse the repository at this point in the history
Summary:
Allow tests using RE to pass a list of dependencies.

It can be used in tests as in D52787760

```
remote_execution = re_test_utils.remote_execution(
   ...,
   dependencies = [
       re_test_utils.re_dependency(
           smc_tier = "asic_workload.re_grid",
           id = "Limit:vcs_batch")
   ])
)
```

Differential Revision: D50883231

fbshipit-source-id: 337012c63211d17204e8534c63cfe495e7de2936
  • Loading branch information
alessandrolipa-meta authored and facebook-github-bot committed Jan 16, 2024
1 parent e537b09 commit 99c1bcf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions decls/re_test_common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def _opts_for_tests_arg() -> Attr:
# "listing_capabilities": Dict<str, str> | None
# "use_case": str | None
# "remote_cache_enabled": bool | None
# "dependencies": list<Dict<str, str>> | []
# }
return attrs.dict(
key = attrs.string(),
Expand All @@ -29,6 +30,7 @@ def _opts_for_tests_arg() -> Attr:
),
attrs.string(),
attrs.bool(),
attrs.list(attrs.dict(key = attrs.string(), value = attrs.string()), default = []),
),
# TODO(cjhopman): I think this default does nothing, it should be deleted
default = None,
Expand Down
2 changes: 2 additions & 0 deletions tests/re_utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def get_re_executors_from_props(ctx: AnalysisContext) -> ([CommandExecutorConfig
use_case = re_props_copy.pop("use_case")
listing_capabilities = re_props_copy.pop("listing_capabilities", None)
remote_cache_enabled = re_props_copy.pop("remote_cache_enabled", None)
re_dependencies = re_props_copy.pop("dependencies", [])
if re_props_copy:
unexpected_props = ", ".join(re_props_copy.keys())
fail("found unexpected re props: " + unexpected_props)
Expand All @@ -60,6 +61,7 @@ def get_re_executors_from_props(ctx: AnalysisContext) -> ([CommandExecutorConfig
remote_execution_use_case = use_case or "tpx-default",
remote_cache_enabled = remote_cache_enabled,
remote_execution_action_key = remote_execution_action_key,
remote_execution_dependencies = re_dependencies,
)
listing_executor = default_executor
if listing_capabilities:
Expand Down

0 comments on commit 99c1bcf

Please sign in to comment.