From 5e284fa40df648116b44e8b8b6250440d332b777 Mon Sep 17 00:00:00 2001 From: Christopher McKee Date: Thu, 30 Jun 2016 21:04:52 +0100 Subject: [PATCH] Added test to check if homu.conf is valid TOML --- .travis/dispatch.sh | 2 +- homu/init.sls | 4 +++- requirements.txt | 1 + tests/sls/homu/__init__.py | 0 tests/sls/homu/toml.py | 11 +++++++++++ 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 tests/sls/homu/__init__.py create mode 100644 tests/sls/homu/toml.py diff --git a/.travis/dispatch.sh b/.travis/dispatch.sh index 815c2c64..1b28d0a5 100755 --- a/.travis/dispatch.sh +++ b/.travis/dispatch.sh @@ -52,6 +52,6 @@ else # Only run tests against the new configuration # TODO: don't hard-code this if [ "${SALT_NODE_ID}" = "servo-master1" ]; then - ./test.py sls.buildbot.master sls.nginx + ./test.py sls.buildbot.master sls.homu sls.nginx fi fi diff --git a/homu/init.sls b/homu/init.sls index 052a0a71..b901589b 100644 --- a/homu/init.sls +++ b/homu/init.sls @@ -15,7 +15,9 @@ homu: - pkg: python3 - pip: virtualenv pip.installed: - - name: git+https://github.com/servo/homu@{{ homu.rev }} + - pkgs: + - git+https://github.com/servo/homu@{{ homu.rev }} + - toml == 0.9.1 # Please ensure this is in sync with requirements.txt - bin_env: /home/servo/homu/_venv - require: - virtualenv: homu diff --git a/requirements.txt b/requirements.txt index 275d0fd3..2fddb657 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ # Python modules needed for testing # (Travis-CI will auto-install them from this file) flake8 == 2.5.4 +toml == 0.9.1 # Please ensure this is in sync with homu/init.sls diff --git a/tests/sls/homu/__init__.py b/tests/sls/homu/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/sls/homu/toml.py b/tests/sls/homu/toml.py new file mode 100644 index 00000000..d0ee248d --- /dev/null +++ b/tests/sls/homu/toml.py @@ -0,0 +1,11 @@ +import toml + +from tests.util import Failure, Success + + +def run(): + try: + toml.load('/home/servo/homu/cfg.toml') + except Exception as e: + return Failure('Homu config file is not valid TOML:', str(e)) + return Success('Homu config file is valid TOML')