mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
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.
This commit is contained in:
parent
5b60edcfb6
commit
8b74360493
@ -3,6 +3,7 @@ Tests for the Git state
|
||||
'''
|
||||
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 @@ class GitTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
||||
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 @@ class GitTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
||||
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 @@ class GitTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
||||
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
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user