Skip to content

Commit

Permalink
support optional cloud provider options node pools and storages
Browse files Browse the repository at this point in the history
  • Loading branch information
zubenkoivan committed Jul 14, 2022
1 parent 91aa11e commit 12a8455
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions neuro_config_client/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ def create_cloud_provider_options(
) -> CloudProviderOptions:
return CloudProviderOptions(
type=type,
node_pools=[cls.create_node_pool_options(p) for p in payload["node_pools"]],
storages=[cls.create_storage_options(type, p) for p in payload["storages"]],
node_pools=[
cls.create_node_pool_options(p) for p in payload.get("node_pools", ())
],
storages=[
cls.create_storage_options(type, p) for p in payload.get("storages", ())
],
)

@staticmethod
Expand Down
8 changes: 8 additions & 0 deletions tests/test_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,14 @@ def test_aws_cloud_provider_options(
],
)

def test_aws_cloud_provider_options_defaults(self, factory: EntityFactory) -> None:
response = {}
result = factory.create_cloud_provider_options(CloudProviderType.AWS, response)

assert result == CloudProviderOptions(
type=CloudProviderType.AWS, node_pools=[], storages=[]
)

def test_google_cloud_provider_options(
self,
factory: EntityFactory,
Expand Down

0 comments on commit 12a8455

Please sign in to comment.