File 0018-Integration-tests-fixes-for-2015.8.7.patch of Package salt.4202
From 89b8cd0dcbe4f2b16839d5ba3b9d5ace9e2ba108 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Tue, 13 Sep 2016 11:54:24 +0100
Subject: [PATCH 18/38] Integration tests fixes for 2015.8.7
* Update github IP for ssh state integration tests (#34592)
* Fixing integration tests if azure is not present
* Fixing integration tests failures if 'git' command is missing
Skip git state integration tests if 'git' does not exists
Prevent OSError if 'git' command not found during _git_version()
---
tests/integration/cloud/providers/msazure.py | 17 +++++++++--------
tests/integration/modules/git.py | 15 +++++++++------
tests/integration/states/git.py | 2 +-
3 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/tests/integration/cloud/providers/msazure.py b/tests/integration/cloud/providers/msazure.py
index c4934e4..4e53add 100644
--- a/tests/integration/cloud/providers/msazure.py
+++ b/tests/integration/cloud/providers/msazure.py
@@ -53,14 +53,15 @@ def __has_required_azure():
'''
Returns True/False if the required version of the Azure SDK is installed.
'''
- if hasattr(azure, '__version__'):
- version = LooseVersion(azure.__version__)
- else:
- version = LooseVersion(azure.common.__version__)
- if HAS_AZURE is True and REQUIRED_AZURE <= version:
- return True
- else:
- return False
+ if HAS_AZURE:
+ if hasattr(azure, '__version__'):
+ version = LooseVersion(azure.__version__)
+ else:
+ version = LooseVersion(azure.common.__version__)
+
+ if REQUIRED_AZURE <= version:
+ return True
+ return False
@skipIf(HAS_AZURE is False, 'These tests require the Azure Python SDK to be installed.')
diff --git a/tests/integration/modules/git.py b/tests/integration/modules/git.py
index 7c40664..f5c15f3 100644
--- a/tests/integration/modules/git.py
+++ b/tests/integration/modules/git.py
@@ -36,12 +36,15 @@ log = logging.getLogger(__name__)
def _git_version():
- git_version = subprocess.Popen(
- ['git', '--version'],
- shell=False,
- close_fds=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE).communicate()[0]
+ try:
+ git_version = subprocess.Popen(
+ ['git', '--version'],
+ shell=False,
+ close_fds=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).communicate()[0]
+ except OSError:
+ return False
if not git_version:
log.debug('Git not installed')
return False
diff --git a/tests/integration/states/git.py b/tests/integration/states/git.py
index 809e0a2..7945b1c 100644
--- a/tests/integration/states/git.py
+++ b/tests/integration/states/git.py
@@ -20,6 +20,7 @@ import integration
import salt.utils
+@skip_if_binaries_missing('git')
class GitTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
'''
Validate the git state
@@ -310,7 +311,6 @@ class GitTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
finally:
shutil.rmtree(name, ignore_errors=True)
- @skip_if_binaries_missing('git')
def test_config_set_value_with_space_character(self):
'''
git.config
--
2.10.2