Add sample config check to tox pep8 job

This commit takes the check_uptodate.sh script from nova and adds it
to the pep8 tox job. This will enforce that the sample config file is
up to date for each proposed commit. This also ensures that config
options are setup properly and that the style in the sample config is
consistent because it's auto-generated.

Partially Implements: blueprint config-cleanup

Change-Id: I9efaa9fc1cf09e95d7111b000895c7b49705713b
This commit is contained in:
Matthew Treinish 2013-10-24 21:49:14 +00:00
parent 7089f14fb5
commit 3d46811826
4 changed files with 703 additions and 384 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 IBM Corp.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
import sys
from tempest import config
from tempest.openstack.common.config import generator
config.TempestConfig()
generator.generate(sys.argv[1:])

10
tools/config/check_uptodate.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
TEMPDIR=`mktemp -d`
CFGFILE=tempest.conf.sample
tools/config/generate_sample.sh -b ./ -p tempest -o $TEMPDIR
if ! diff $TEMPDIR/$CFGFILE etc/$CFGFILE
then
echo "E: tempest.conf.sample is not up to date, please run:"
echo "MODULEPATH=tempest.common.generate_sample_tempest tools/config/generate_sample.sh"
exit 42
fi

View File

@ -106,7 +106,11 @@ deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:pep8]
commands = flake8
setenv = MODULEPATH=tempest.common.generate_sample_tempest
commands =
flake8 {posargs}
{toxinidir}/tools/config/check_uptodate.sh
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt