Fix TestGreenThreadSafeIterator test

Change-Id: Ic121ae5c99b4e5c5e3d1efc432b55b762d50f3fb
Closes-Bug: 1190244
Only run flake8 on Swift code

In particular, this skips the "build" directory, which is prone to
containing third-party stuff that doesn't comply with all the various
hacking/flake8/pep8 checks.

Change-Id: Ibe2240d8c6ca5947b2cac259cd7d0a1154f8a9cd
Range requests not working with sub_SLOs

Change-Id: I618c06e7f9251bfc7049c9dc6df66e539b90d9a9
Add "If-None-Match: *" support to PUT

A common pattern that we see clients do is send a HEAD request before a
PUT to see if it exists.  This can slow things down quite a bit
especially since 404s on HEAD are currently a bit expensive.

This change will allow a client to include a "If-None-Match: *" header
with a PUT request.  In combination with "Expect: 100-Continue" this
allows the server to return that it already has a copy of the object
before any data is sent.

I attempted to also include etag support with the If-None-Match header,
but that turned up having too many hairy edge cases, so was left as a
future excercise.

DocImpact

Change-Id: I94e3754923dbe5faba065719c7a9afa9969652dd
Merge "Fix TestGreenThreadSafeIterator test"
AssertEquals is deprecated, use assertEqual partI

assertEquals is deprecated in Python 2.7, need drop it.
http://docs.python.org/2/library/unittest.html#deprecated-aliases

Change-Id: Ieec505887f740b99b11ef40878ba3ee7247b78a8
Closes-Bug: #1285040
Merge "Only run flake8 on Swift code"
Relocate DATADIR to backends

It simply makes sense that the definition of DATADIR belongs to
backends. After all, some of them may not even have any.

Coincidentially, a few unnecessary imports are dropped.

By the way, on the object server side, diskfile.py provides DATADIR
in the same way already.

Change-Id: I60bfd522c77c4a0ee13697a2e31141777c7e2398
Only fetch a timestamp when needed

While it seems free to just call time.time() whenever it is
convenient, in many cases code has to decide on a particular timestamp
as a reference point for decisions. In other places, it just seems
like a waste to make two calls that one would assume would return
nearly identical times; however, certain test environments are
notoriously overloaded (which is arguably a good thing, added stress
to the code) where back-to-back calls to time.time() might produce
timestamps seconds or even minutes apart.

These simple changes here pick a point of reference for the operation
to use throughout.

Change-Id: Id2c0ffcc7f4ffafff61ebf59a8baeb079fd0c2b8
Merge "AssertEquals is deprecated, use assertEqual partI"
Merge "Relocate DATADIR to backends"
Merge "Range requests not working with sub_SLOs"
Merge "Add "If-None-Match: *" support to PUT"
Rework use of constraints to ease testing

Prior to this patch both mainline code and testing modules imported
and used constraints directly into their own namespace, or relied on
the namespace of other modules that were not the constraints
module. This meant that if a unit test wanted to change a constraint
for its operation, it had to know how that module was using the
constraint, instead of referencing the constraint module itself.

This patch unifies the use of constraints so that all constraints are
referenced via the constraints module. In turn, this allows a test to
leverage the re-loadable nature of the constraints in the constraints
module.

It addition, a number of functional tests where using the default
values for constraints, instead of the configured value discovered in
a test.conf or in an existing swift.conf. This patch removes those
direct references in favor of the load_constraint() method from the
test/functional/tests.py module.

Change-Id: Ia5313d653c667dd9ca800786de59b59334c34eaa
Only change collation for functional tests

The unconditional module-level change of the locale collation can
affect other tests run under nose. To avoid this, make the change at
the package level, and restore it when finished.

Change-Id: Iacda42aa7155f1cfa7d0dcadbf73b961dfb4b923
Read the configuration once for all func tests

Merge the swift_testing module into the functional test module itself,
so that we can read the configuration once for all unit tests, sharing
the same constraints.

Change-Id: I9fbbfdade9adca329cd79f7d4291ba009327c842
Move module level setup under setup_package method

Perform all the package level test setup under the setup_package
method so that we only read the configuration file on disk when
functional tests are run. This let's us "play nice" with other tests.

Change-Id: I699d664bcef6754aac4ec6877830e745b764342f
In-process swift server for functional tests

Provide a way to run the functional tests using a p/a/c/o server setup
in the same process.

By setting the environment variable, SWIFT_TEST_IN_PROCESS, the
functional test set up will construct a proxy, account, container and
object server running in the same process as is running the functional
tests, ignoring any external swift service.

This patch also changes the behavior of the functional tests such that
when both /etc/swift/swift.conf and /etc/swift/test.conf are _not_
present on the system where the functional tests are executing, an
in-process functioning swift environement will be established, akin to
the one used in test/unit/proxy/test_server.py, and all the functional
tests will be executed against it.

Previously, if no /etc/swift/swift.conf and /etc/swift/test.conf files
were found, the tests would just be marked as skipped.

Using this in-process method allows one to gather code coverage using
the functional tests to exercise code paths, in addition to the unit
tests, or more easily debug existing functional tests or write new
ones.

Change-Id: I5acd65e3068868d6509feae1d1954237d37fad45