html differs for every build

Bug #1796899 reported by Bernhard M. Wiedemann on 2018-10-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
keystoneauth
Low
Unassigned

Bug Description

While working on reproducible builds for openSUSE, I found that
building the python-keystoneauth1 openSUSE package gives a different result for every build:

/usr/share/doc/packages/python-keystoneauth1-doc/html/api/keystoneauth1.tests.unit.extras.oauth1.html

 <dl class="attribute">
 <dt id="keystoneauth1.tests.unit.extras.oauth1.test_oauth1.OAuth1AuthTests.TEST_TOKEN">
-<code class="descname">TEST_TOKEN</code><em class="property"> = '59f507951a074fcc88c0c28482a5f2dc'</em><a class="headerlink" href="#href_anchor" title="Permalink to this definition">¶</a></dt>
+<code class="descname">TEST_TOKEN</code><em class="property"> = '73093c7cd7a74f87aea4a65774d3fba0'</em><a class="headerlink" href="#href_anchor" title="Permalink to this definition">¶</a></dt>

It is put there by
setup.py build_sphinx

Which gets the randomness from /dev/urandom
via TEST_TOKEN = uuid.uuid4().hex
that is used in several places such as
tests/unit/extras/oauth1/test_oauth1.py
tests/unit/extras/saml2/test_auth_adfs.py
tests/unit/utils.py

This could probably be solved by using a mocked uuid4 method or by replacing all random values with constants. e.g.
TEST_TOKEN = '08aebcf32cc349749459f09722078c73'

Or maybe sphinx could be told to not document stuff under tests/

See https://reproducible-builds.org/ for why this matters.

Morgan Fainberg (mdrnstm) wrote :

Tests are explicitly using random values to ensure there are no hardcoded explicit "did we get a value we expected".

The correct fix is to not generate docs for the tests.

Changed in keystoneauth:
importance: Undecided → Low
status: New → Triaged
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers