swift/test
Tim Burke 523bc0ab71 Always set swift processes to use UTC
Previously, we would set the TZ environment variable to the result of

    time.strftime("%z", time.gmtime())

This has a few problems.

 1. The "%z" format does not appear in the table of formatting
    directives for strftime [1]. While it *does* appear in a
    footnote [2] for that section, it is described as "not supported by
    all ANSI C libraries." This may explain the next point.

 2. On the handful of Linux platforms I've tested, the above produces
    "+0000" regardless of the system's timezone. This seems to run
    counter to the intent of the patches that introduced the TZ
    mangling. (See the first two related changes.)

 3. The above does not produce a valid Posix TZ format, which expects
    (at minimum) a name consisting of three or more alphabetic
    characters followed by the offset to be added to the local time to
    get Coordinated Universal Time (UTC).

Further, while we would change os.environ['TZ'], we would *not* call
time.tzset like it says in the docs [3], which seems like a Bad Thing.

Some combination of the above has the net effect of changing some of the
functions in the time module to use UTC. (Maybe all of them? At the very
least, time.localtime and time.mktime.) However, it does *not* change
the offset stored in time.timezone, which causes bad behavior when
dealing with local timestamps [4].

Now, set TZ to "UTC+0" and call tzset. Apparently we don't have a good
way of getting local timezone info, we were (unintentionally?) using UTC
before, and you should probably be running your servers in UTC anyway.

[1] https://docs.python.org/2/library/time.html#time.strftime
[2] https://docs.python.org/2/library/time.html#id2
[3] https://docs.python.org/2/library/time.html#time.tzset
[4] Like in email.utils.mktime_tz, prior to being fixed in
    https://hg.python.org/cpython/rev/a283563c8cc4

Change-Id: I007425301914144e228b9cfece5533443e851b6e
Related-Change: Ifc78236a99ed193a42389e383d062b38f57a5a31
Related-Change: I8ec80202789707f723abfe93ccc9cf1e677e4dc6
Related-Change: Iee7488d03ab404072d3d0c1a262f004bb0f2da26
2016-12-19 16:23:13 -08:00
..
functional Merge "SLO: Make etag and size_bytes fully optional" 2016-12-13 23:02:27 +00:00
probe Merge "Fixups for ghost listing fix" 2016-12-09 03:03:03 +00:00
unit Always set swift processes to use UTC 2016-12-19 16:23:13 -08:00
__init__.py Raise ValueError if a config section does not exist 2016-12-15 19:49:57 +00:00
sample.conf Merge "Add a note for functional tests with Keystone." 2016-03-18 05:08:10 +00:00