From 0a7546b1b1159f370f9c731f0615028401e0606e Mon Sep 17 00:00:00 2001 From: Daniel Bradshaw Date: Wed, 29 Jan 2014 18:01:28 +0000 Subject: [PATCH 1/4] Correct import --- tests/integration/modules/file.py | 2 +- tests/integration/modules/mysql.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/modules/file.py b/tests/integration/modules/file.py index e0f8b409fc..bd1bc6fbcf 100644 --- a/tests/integration/modules/file.py +++ b/tests/integration/modules/file.py @@ -8,7 +8,7 @@ import os import shutil import sys -from mock import patch, MagicMock +from salttesting.mock import patch, MagicMock # Import Salt Testing libs from salttesting import skipIf diff --git a/tests/integration/modules/mysql.py b/tests/integration/modules/mysql.py index cceb1eef99..4265a01033 100644 --- a/tests/integration/modules/mysql.py +++ b/tests/integration/modules/mysql.py @@ -3,7 +3,7 @@ # Import python libs import logging -from mock import patch +from salttesting.mock import patch # Import Salt Testing libs from salttesting import skipIf From a5fee18ac8676d4e9dd469118f8f35466c8ce325 Mon Sep 17 00:00:00 2001 From: Daniel Bradshaw Date: Wed, 29 Jan 2014 18:02:36 +0000 Subject: [PATCH 2/4] Handle directories in the config directory when we try to clone config --- tests/integration/__init__.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py index a1179b50c7..6927c4d9de 100644 --- a/tests/integration/__init__.py +++ b/tests/integration/__init__.py @@ -665,10 +665,12 @@ class AdaptedConfigurationTestCaseMixIn(object): # Running as root, the running user does not need to be updated return integration_config_dir - for fname in os.listdir(integration_config_dir): - if fname.startswith(('.', '_')): - continue - self.get_config_file_path(fname) + for triplet in os.walk(integration_config_dir): + partial = triplet[0].replace(integration_config_dir,"")[1:] + for fname in triplet[2]: + if fname.startswith(('.', '_')): + continue + self.get_config_file_path(os.path.join(partial, fname)) return TMP_CONF_DIR def get_config_file_path(self, filename): @@ -679,10 +681,11 @@ class AdaptedConfigurationTestCaseMixIn(object): # Running as root, the running user does not need to be updated return integration_config_file - if not os.path.isdir(TMP_CONF_DIR): - os.makedirs(TMP_CONF_DIR) - updated_config_path = os.path.join(TMP_CONF_DIR, filename) + partial = os.path.dirname(updated_config_path) + if not os.path.isdir(partial): + os.makedirs(partial) + if not os.path.isfile(updated_config_path): self.__update_config(integration_config_file, updated_config_path) return updated_config_path From 4b6694bf0ed39ed94b999a18b126d41fc7929c2a Mon Sep 17 00:00:00 2001 From: Daniel Bradshaw Date: Wed, 29 Jan 2014 18:42:58 +0000 Subject: [PATCH 3/4] Filter the 'user' keyword from the config for cloud. When the tests aren't run as root, it goes around replacing/injecting a user config option for the user the tests are run as. This upsets cloud, so we'll filter it out like default_include and similar get filtered. --- salt/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/config.py b/salt/config.py index 46b6d5cdba..695ab98034 100644 --- a/salt/config.py +++ b/salt/config.py @@ -1135,7 +1135,7 @@ def apply_vm_profiles_config(providers, overrides, defaults=None): vms = {} for key, val in config.items(): - if key in ('conf_file', 'include', 'default_include'): + if key in ('conf_file', 'include', 'default_include', 'user'): continue if not isinstance(val, dict): raise salt.cloud.exceptions.SaltCloudConfigError( @@ -1292,7 +1292,7 @@ def apply_cloud_providers_config(overrides, defaults=None): providers = {} for key, val in config.items(): - if key in ('conf_file', 'include', 'default_include'): + if key in ('conf_file', 'include', 'default_include', 'user'): continue if not isinstance(val, (list, tuple)): From 749e4871db2bb9057d2353b2695854c1ca7df4a4 Mon Sep 17 00:00:00 2001 From: Daniel Bradshaw Date: Wed, 29 Jan 2014 19:48:57 +0000 Subject: [PATCH 4/4] Fixing some missing PEP8ness --- tests/integration/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py index 6927c4d9de..8855b75d78 100644 --- a/tests/integration/__init__.py +++ b/tests/integration/__init__.py @@ -666,7 +666,7 @@ class AdaptedConfigurationTestCaseMixIn(object): return integration_config_dir for triplet in os.walk(integration_config_dir): - partial = triplet[0].replace(integration_config_dir,"")[1:] + partial = triplet[0].replace(integration_config_dir, "")[1:] for fname in triplet[2]: if fname.startswith(('.', '_')): continue