Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Skip the git state tests if a dns lookup to github.com fails

This is the quickest clever thing I could think of while running the
unit tests offline in the car during a long road trip.
  • Loading branch information...
commit 8b74360493b9402fb1c7221fc6a3c8e18cadd0f6 1 parent 5b60edc
Jeff Schroeder SEJeff authored
Showing with 16 additions and 3 deletions.
  1. +16 −3 tests/integration/states/git.py
19 tests/integration/states/git.py
View
@@ -3,6 +3,7 @@
'''
import os
import shutil
+import socket
import integration
@@ -11,6 +12,18 @@ class GitTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
Validate the git state
'''
+ def setUp(self):
+ super(GitTest, self).setUp()
+ self.__domain = 'github.com'
+ try:
+ if hasattr(socket, 'setdefaulttimeout'):
+ # 10 second dns timeout
+ socket.setdefaulttimeout(10)
+ socket.gethostbyname(self.__domain)
+ except socket.error:
+ msg = 'error resolving {0}, possible network issue?'
+ self.skipTest(msg.format(self.__domain))
+
def test_latest(self):
'''
git.latest
@@ -19,7 +32,7 @@ def test_latest(self):
try:
ret = self.run_state(
'git.latest',
- name='https://github.com/saltstack/salt.git',
+ name='https://{0}/saltstack/salt.git'.format(self.__domain),
rev='develop',
target=name,
submodules=True
@@ -57,7 +70,7 @@ def test_latest_empty_dir(self):
try:
ret = self.run_state(
'git.latest',
- name='https://github.com/saltstack/salt.git',
+ name='https://{0}/saltstack/salt.git'.format(self.__domain),
rev='develop',
target=name,
submodules=True
@@ -75,7 +88,7 @@ def test_latest_recursive(self):
try:
ret = self.run_state(
'git.latest',
- name='https://github.com/mozilla/zamboni.git',
+ name='https://{0}/mozilla/zamboni.git'.format(self.__domain),
target=name,
submodules=True
)
Please sign in to comment.
Something went wrong with that request. Please try again.