mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +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 os
|
||||||
import shutil
|
import shutil
|
||||||
|
import socket
|
||||||
import integration
|
import integration
|
||||||
|
|
||||||
|
|
||||||
@ -11,6 +12,18 @@ class GitTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
|||||||
Validate the git state
|
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):
|
def test_latest(self):
|
||||||
'''
|
'''
|
||||||
git.latest
|
git.latest
|
||||||
@ -19,7 +32,7 @@ class GitTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
|||||||
try:
|
try:
|
||||||
ret = self.run_state(
|
ret = self.run_state(
|
||||||
'git.latest',
|
'git.latest',
|
||||||
name='https://github.com/saltstack/salt.git',
|
name='https://{0}/saltstack/salt.git'.format(self.__domain),
|
||||||
rev='develop',
|
rev='develop',
|
||||||
target=name,
|
target=name,
|
||||||
submodules=True
|
submodules=True
|
||||||
@ -57,7 +70,7 @@ class GitTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
|||||||
try:
|
try:
|
||||||
ret = self.run_state(
|
ret = self.run_state(
|
||||||
'git.latest',
|
'git.latest',
|
||||||
name='https://github.com/saltstack/salt.git',
|
name='https://{0}/saltstack/salt.git'.format(self.__domain),
|
||||||
rev='develop',
|
rev='develop',
|
||||||
target=name,
|
target=name,
|
||||||
submodules=True
|
submodules=True
|
||||||
@ -75,7 +88,7 @@ class GitTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
|||||||
try:
|
try:
|
||||||
ret = self.run_state(
|
ret = self.run_state(
|
||||||
'git.latest',
|
'git.latest',
|
||||||
name='https://github.com/mozilla/zamboni.git',
|
name='https://{0}/mozilla/zamboni.git'.format(self.__domain),
|
||||||
target=name,
|
target=name,
|
||||||
submodules=True
|
submodules=True
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user