Use a template to generate the 'whereto' testing data

As we add more branches and tags we don't want to manually add tests for
them (and we'd need to or the docs build will fail with an 'Untested
Rule'.

Use the redirections data that we use to generate the htaccess file to
also generate the tests.

Also I removed the debug output as it it's assertion is incorrect we can
actually get the .htaccess file from the docs job \o/

Change-Id: Ib5d35169e68cd92b666a35705d8e36942bd28b89
This commit is contained in:
Tony Breeds 2019-03-02 15:31:01 +11:00
parent 752ce5a491
commit 0d59816c64
4 changed files with 18 additions and 17 deletions

View File

@ -472,17 +472,25 @@ def build_finished(app, exception):
if exception is not None:
return
redirections = generate_constraints_redirections(_deliverables)
rendered_output = app.builder.templates.render(
'htaccess',
dict(redirections=generate_constraints_redirections(_deliverables))
dict(redirections=redirections)
)
output_full_name = os.path.join(app.builder.outdir, '.htaccess')
with open(output_full_name, "w") as f:
f.write(rendered_output)
LOG.info('Wrote Redirections to %s' % (output_full_name))
# NOTE(tonyb): We want to output this here because we won't be able to
# get to it via http{,s} so this helps debugging.
LOG.debug(rendered_output)
rendered_output = app.builder.templates.render(
'redirect-tests',
dict(redirections=redirections)
)
output_full_name = os.path.join(app.builder.outdir,
'..',
'redirect-tests.txt')
with open(output_full_name, "w") as f:
f.write(rendered_output)
def setup(app):

View File

@ -0,0 +1,5 @@
/teams/shade.html 301 /teams/openstacksdk.html
/constraints/upper/master 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=master
{%- for redirection in redirections %}
/constraints/upper/{{ redirection.src }} {{ redirection.code }} http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h={{ redirection.dst }}
{%- endfor %}

View File

@ -1,12 +0,0 @@
/teams/shade.html 301 /teams/openstacksdk.html
/constraints/upper/master 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=master
/constraints/upper/stein 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=master
/constraints/upper/rocky 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/rocky
/constraints/upper/queens 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/queens
/constraints/upper/pike 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/pike
/constraints/upper/ocata 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/ocata
/constraints/upper/newton 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/newton
/constraints/upper/mitaka 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=mitaka-eol
/constraints/upper/liberty 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=liberty-eol
/constraints/upper/kilo 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=kilo-eol
/constraints/upper/juno 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=juno-eol

View File

@ -74,7 +74,7 @@ deps =
-r{toxinidir}/doc/requirements.txt
commands =
sphinx-build -v -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
whereto {toxinidir}/doc/build/html/.htaccess {toxinidir}/doc/test/redirect-tests.txt
whereto {toxinidir}/doc/build/html/.htaccess {toxinidir}/doc/build/redirect-tests.txt
[flake8]
# E123, E125 skipped as they are invalid PEP-8.