예제 #1
0
    def test_worker_configuration_auth_both_ssh_and_user(
            self, mock_config_as_dict, mock_conf_get):
        def get_conf(*args, **kwargs):
            if (args[0] == 'core'):
                return '1'
            if (args[0] == 'kubernetes'):
                if (args[1] == 'git_ssh_known_hosts_configmap_name'):
                    return 'airflow-configmap'
                if (args[1] == 'git_ssh_key_secret_name'):
                    return 'airflow-secrets'
                if (args[1] == 'git_user'):
                    return 'some-user'
                if (args[1] == 'git_password'):
                    return 'some-password'
                if (args[1] == 'git_repo'):
                    return '[email protected]:apache/airflow.git'
                if (args[1] == 'git_branch'):
                    return 'master'
                if (args[1] == 'git_dags_folder_mount_point'):
                    return '/usr/local/airflow/dags'
                if (args[1] == 'delete_worker_pods'):
                    return True
                return '1'
            return None

        mock_conf_get.side_effect = get_conf
        mock_config_as_dict.return_value = {'core': ''}

        with self.assertRaisesRegexp(
                AirflowConfigException,
                'either `git_user` and `git_password`.*'
                'or `git_ssh_key_secret_name`.*'
                'but not both$'):
            KubeConfig()
 def test_worker_configuration_auth_both_ssh_and_user(self):
     with self.assertRaisesRegex(
             AirflowConfigException,
             'either `git_user` and `git_password`.*'
             'or `git_ssh_key_secret_name`.*'
             'but not both$'):
         KubeConfig()