def test_default_settings_from_default_env(env, settings): base_settings = {} diagnostics.settings_from_env(base_settings, env) assert base_settings == settings
def test_default_settings_connectivity_url(env): settings = {} env['CHECK_CONNECTIVITY_URL'] = 'TEST_URL.COM' diagnostics.settings_from_env(settings, env) assert settings['check_connectivity_url'] == 'TEST_URL.COM'
def test_default_settings_dns(env): settings = {} env['DNS_TEST_HOSTNAME'] = 'TEST_URL.COM' diagnostics.settings_from_env(settings, env) assert settings['dns_test_hostname'] == 'TEST_URL.COM'
def test_settings_from_env_https(env): settings = {} env['KUBERNETES_SERVICE_PORT'] = '443' diagnostics.settings_from_env(settings, env) assert settings['kubernetes_url'] == 'https://10.107.56.115:443'
def test_settings_from_env_missing_kube_api_key(env): settings = {} del env['KUBE_API_TOKEN_PATH'] diagnostics.settings_from_env(settings, env) assert settings['token'] is None
def test_settings_from_env_custom_port(env): settings = {} env['KUBERNETES_SERVICE_PORT'] = '8080' diagnostics.settings_from_env(settings, env) assert settings['kubernetes_url'] == 'http://10.107.56.115:8080'