Tests fail in non-en_US locale

Bug #1427745 reported by Alexis Lee
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Matt Riedemann

Bug Description

When I run `tox -epy27`, generally I get 13 test failures. One of these is a proxy/WSGI interaction I don't care about. The remaining 12 are due to tests which compare translated strings to untranslated message IDs. My locale is:

    $ locale
    LANG=en_GB.UTF-8
    LANGUAGE=en_GB:en
    LC_CTYPE="en_GB.UTF-8"
    LC_NUMERIC="en_GB.UTF-8"
    LC_TIME="en_GB.UTF-8"
    LC_COLLATE="en_GB.UTF-8"
    LC_MONETARY="en_GB.UTF-8"
    LC_MESSAGES="en_GB.UTF-8"
    LC_PAPER="en_GB.UTF-8"
    LC_NAME="en_GB.UTF-8"
    LC_ADDRESS="en_GB.UTF-8"
    LC_TELEPHONE="en_GB.UTF-8"
    LC_MEASUREMENT="en_GB.UTF-8"
    LC_IDENTIFICATION="en_GB.UTF-8"
    LC_ALL=

See this patch for the tests which fail for me: I352cd37d79401866e3116bcf0a62031bfe1d5d93

This patch removes the TranslationFixture which was supposed to prevent translations during tests but didn't: Idcc4409edae5ddfa0a1c2052a746d6412dda24ac

Suggested fix: enforce an en_US locale or prevent translations from occurring during tests.

Tags: i18n testing
Revision history for this message
Alexis Lee (alexisl) wrote :

Example failure:

    Traceback (most recent call last):
      File "nova/tests/unit/compute/test_compute.py", line 6058, in test_cleanup_running_deleted_instances_unrecognized_value
        self.assertIn("Unrecognized value", six.text_type(e))
      File "/home/lealexis/w/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 354, in assertIn
        self.assertThat(haystack, Contains(needle), message)
      File "/home/lealexis/w/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 433, in assertThat
        raise mismatch_error
    MismatchError: 'Unrecognized value' not in u"Unrecognised value 'foo-action' for CONF.running_deleted_instance_action"

'z' vs 's' in 'unrecognised'.

Revision history for this message
Alexis Lee (alexisl) wrote :

setting LANG=en_US in tox.ini didn't work

Changed in nova:
assignee: nobody → Alexis Lee (alexisl)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/160892

Changed in nova:
assignee: Alexis Lee (alexisl) → Matt Riedemann (mriedem)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Alexis Lee (<email address hidden>) on branch: master
Review: https://review.openstack.org/160739

Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/160892
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=3c65f3ae0e120f49e26bcdc402d048f5eede99bb
Submitter: Jenkins
Branch: master

commit 3c65f3ae0e120f49e26bcdc402d048f5eede99bb
Author: Matt Riedemann <email address hidden>
Date: Tue Mar 3 08:58:42 2015 -0800

    Force LANGUAGE=en_US in test runs

    If your native locale is not en_US and you run tests, some will fail due
    to the message translation that happens since the assertion messages are
    in en_US (not translated, just hard-coded in the tests).

    I recreated the bug by setting LANGUAGE=en_GB in my tox.ini and tested
    against nova.tests.unit.api.openstack.test_wsgi.

    Note that setting LANG=en_US had no effect.

    Closes-Bug: #1427745

    Change-Id: Ib1c71d0d4170ba1a7ed2fe3eaf0e2d8071ec01d6

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-3 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.