File 0074-Integration-tests-fixes-for-2015.8.7.patch of Package salt.3314
From 27f67556af70263502be8f02cf082b953de9b06f 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 74/74] 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 +-
tests/integration/states/ssh.py | 2 +-
4 files changed, 20 insertions(+), 16 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 8296d96..32e4f27 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
@@ -207,7 +208,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
diff --git a/tests/integration/states/ssh.py b/tests/integration/states/ssh.py
index 17b0c39..eed6a14 100644
--- a/tests/integration/states/ssh.py
+++ b/tests/integration/states/ssh.py
@@ -24,7 +24,7 @@ import salt.utils
KNOWN_HOSTS = os.path.join(integration.TMP, 'known_hosts')
GITHUB_FINGERPRINT = '16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48'
-GITHUB_IP = '192.30.252.129'
+GITHUB_IP = '192.30.253.113'
@skip_if_binaries_missing(['ssh', 'ssh-keygen'], check_all=True)
--
2.8.2