Fix tests to work with current release

This change dynamically picks the release directory
based on the fact that they are in alphabetical order.
This should avoid having to modify the current_release
variable at the beginning of each cycle.

Fixes errors in trove-image-build.rst since the
tests weren't being run in the right directory.

Change-Id: If8f84d25fbdde14103db56304eba92abc93dc4ee
This commit is contained in:
Peter Stachowski 2016-03-29 21:37:19 +00:00
parent 92d115b912
commit 8a567434fb
2 changed files with 22 additions and 12 deletions

View File

@ -38,8 +38,8 @@ https://blueprints.launchpad.net/trove-image-builder/+spec/trove-image-build-rep
Problem Description
===================
Trove users (new and experienced) typically run into problems in the last leg of
a datastore setup, that is the generation and loading of a compatible image
Trove users (new and experienced) typically run into problems in the last leg
of a datastore setup, that is the generation and loading of a compatible image
including the database and the Trove guestagent. There are significant
variations among the GNU/Linux distros, their native database packages, vendor
packages and assumptions built into the current Trove codebase. These
@ -109,15 +109,15 @@ Redis Yes TBD
Vertica Yes TBD
========== ====== ========
NB: Datastores marked TBD for CentOS 7 currently lack public community yum repos
for install.
NB: Datastores marked TBD for CentOS 7 currently lack public community yum
repos for install.
The image build process should be independent of any specific OpenStack python
or other dependencies save for the DIB tool. Ideally, this new repo would not
be branched with OpenStack releases, just the same as trove-integration is not
branched today. However, trove-integration does rely on per-release requirements
files for pip. These are essentially trimmed down requirements to service a pip
install of the guestagent code. Some possible solutions:
branched today. However, trove-integration does rely on per-release
requirements files for pip. These are essentially trimmed down requirements to
service a pip install of the guestagent code. Some possible solutions:
- fetch the existing trove-integration requirement files when doing a pip
install in the new builder
@ -222,7 +222,8 @@ Newton-1
Work Items
----------
- Have PTL create new project repository for image creation tool and supporting data files.
- Have PTL create new project repository for image creation tool and supporting
data files.
- Develop and install artifacts into repository.
- Update existing docs to guide users to new image creation tool.

View File

@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import glob
import os
import re
import docutils.core
@ -20,8 +20,6 @@ import testtools
class TestTitles(testtools.TestCase):
current_release = 'mitaka'
def _get_title(self, section_tree):
section = {
'subtitles': [],
@ -107,8 +105,19 @@ class TestTitles(testtools.TestCase):
spec = docutils.core.publish_doctree(template)
template_titles = self._get_titles(spec)
files = glob.glob("specs/%s/*" % self.current_release)
# Get the current release directory - since we're moving up
# alphabetically, grab the highest name in the spec directory
generator = os.walk('specs')
dirname, subdirs, files = generator.next()
current_release = max(subdirs)
found = False
for dirname, subdirs, files in generator:
if dirname.endswith("/" + current_release):
found = True
break
self.assertTrue(found, "No specs found.")
for filename in files:
filename = "%s/%s" % (dirname, filename)
self.assertTrue(filename.endswith(".rst"),
"spec's file must uses 'rst' extension.")
with open(filename) as f: