Skip to content

Commit

Permalink
fix unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
cblmemo committed Mar 25, 2024
1 parent 25ea7b3 commit 7ab4b7c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions sky/utils/controller_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ def get_controller_resources(
if res.cloud is not None and not clouds.cloud_in_iterable(
res.cloud, requested_clouds):
requested_clouds.add(res.cloud)
if not requested_clouds:
return {controller_resources_to_use}
return {
controller_resources_to_use.copy(cloud=controller_cloud)
for controller_cloud in requested_clouds
Expand Down
8 changes: 6 additions & 2 deletions tests/unit_tests/test_controller_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ def get_custom_controller_resources(keys, default):
monkeypatch.setattr('sky.skypilot_config.get_nested',
get_custom_controller_resources)

controller_resources = controller_utils.get_controller_resources(
controller_type, controller_resources_config)
controller_resources = list(
controller_utils.get_controller_resources(
controller_type=controller_type,
controller_name='dummy',
controller_resources_config=controller_resources_config,
task_resources=[]))[0]
controller_resources_config = controller_resources.to_yaml_config()
for k, v in expected.items():
assert controller_resources_config[k] == v, (
Expand Down

0 comments on commit 7ab4b7c

Please sign in to comment.