Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Config] Fix ssh proxy command to be null #2756

Merged
merged 5 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
9 changes: 8 additions & 1 deletion sky/utils/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,14 @@ def get_config_schema():
'type': 'object',
'required': [],
'additionalProperties': {
'type': 'string',
'anyOf': [
{
'type': 'string'
},
{
'type': 'null'
},
]
}
}]
},
Expand Down
23 changes: 23 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,29 @@ def test_empty_config(monkeypatch, tmp_path) -> None:
_check_empty_config()


def test_valid_null_proxy_config(monkeypatch, tmp_path) -> None:
"""Test that the config is not loaded if the config file is empty."""
with open(tmp_path / 'valid.yaml', 'w') as f:
f.write(f"""\
aws:
instance_tags:
mytag: myvalue
ssh_proxy_command:
eu-west-1: null
us-east-1: null
use_internal_ips: true
vpc_name: abc

spot:
controller:
resources:
disk_size: 256
""")
monkeypatch.setattr(skypilot_config, 'CONFIG_PATH', tmp_path / 'valid.yaml')
_reload_config()
_check_empty_config()


def test_invalid_field_config(monkeypatch, tmp_path) -> None:
"""Test that the config is not loaded if the config file contains unknown field."""
config_path = tmp_path / 'invalid.yaml'
Expand Down