summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml2
-rw-r--r--tests/cloud_tests/platforms/__init__.py4
-rw-r--r--tests/cloud_tests/util.py33
-rw-r--r--tox.ini2
4 files changed, 38 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml
index 32ad4415..c67c10bc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -72,7 +72,7 @@ matrix:
- sudo -E su $USER -c 'mk-sbuild xenial'
- sudo -E su $USER -c 'sbuild --nolog --no-run-lintian --verbose --dist=xenial cloud-init_*.dsc'
# Ubuntu LTS: Integration
- - travis_wait 30 sg lxd -c 'tox -e citest -- run --verbose --preserve-data --data-dir results --os-name xenial --test modules/apt_configure_sources_list.yaml --test modules/ntp_servers --test modules/set_password_list --test modules/user_groups --deb cloud-init_*_all.deb'
+ - sg lxd -c 'tox -e citest -- run --verbose --preserve-data --data-dir results --os-name xenial --test modules/apt_configure_sources_list.yaml --test modules/ntp_servers --test modules/set_password_list --test modules/user_groups --deb cloud-init_*_all.deb'
- python: 3.5
env:
TOXENV=xenial
diff --git a/tests/cloud_tests/platforms/__init__.py b/tests/cloud_tests/platforms/__init__.py
index 6a410b84..e506baa0 100644
--- a/tests/cloud_tests/platforms/__init__.py
+++ b/tests/cloud_tests/platforms/__init__.py
@@ -6,6 +6,7 @@ from .ec2 import platform as ec2
from .lxd import platform as lxd
from .nocloudkvm import platform as nocloudkvm
from .azurecloud import platform as azurecloud
+from ..util import emit_dots_on_travis
PLATFORMS = {
'ec2': ec2.EC2Platform,
@@ -17,7 +18,8 @@ PLATFORMS = {
def get_image(platform, config):
"""Get image from platform object using os_name."""
- return platform.get_image(config)
+ with emit_dots_on_travis():
+ return platform.get_image(config)
def get_instance(snapshot, *args, **kwargs):
diff --git a/tests/cloud_tests/util.py b/tests/cloud_tests/util.py
index 06f7d865..e65771b1 100644
--- a/tests/cloud_tests/util.py
+++ b/tests/cloud_tests/util.py
@@ -5,6 +5,7 @@
import base64
import copy
import glob
+import multiprocessing
import os
import random
import shlex
@@ -12,7 +13,9 @@ import shutil
import string
import subprocess
import tempfile
+import time
import yaml
+from contextlib import contextmanager
from cloudinit import util as c_util
from tests.cloud_tests import LOG
@@ -118,6 +121,36 @@ def current_verbosity():
return max(min(3 - int(LOG.level / 10), 2), 0)
+@contextmanager
+def emit_dots_on_travis():
+ """
+ A context manager that emits a dot every 10 seconds if running on Travis.
+
+ Travis will kill jobs that don't emit output for a certain amount of time.
+ This context manager spins up a background process which will emit a dot to
+ stdout every 10 seconds to avoid being killed.
+
+ It should be wrapped selectively around operations that are known to take a
+ long time.
+ """
+ if os.environ.get('TRAVIS') != "true":
+ # If we aren't on Travis, don't do anything.
+ yield
+ return
+
+ def emit_dots():
+ while True:
+ print(".")
+ time.sleep(10)
+
+ dot_process = multiprocessing.Process(target=emit_dots)
+ dot_process.start()
+ try:
+ yield
+ finally:
+ dot_process.terminate()
+
+
def is_writable_dir(path):
"""Make sure dir is writable.
diff --git a/tox.ini b/tox.ini
index 906519c4..95a8511f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -134,6 +134,6 @@ deps =
[testenv:citest]
basepython = python3
commands = {envpython} -m tests.cloud_tests {posargs}
-passenv = HOME
+passenv = HOME TRAVIS
deps =
-r{toxinidir}/integration-requirements.txt