Comment 75 for bug 1449212

Revision history for this message
Samuel Merritt (torgomatic) wrote :

Here's Clay's patch from #57 but with the unit tests passing.

There were a few things I had to do to make that work: first, make_pre_authed_env() had to start setting swift_owner = True in the environment it created. Otherwise, the container controller would unhelpfully filter out the ACLs from a GET or HEAD response, and in the case where the environment's identity was not preserved, get_container_info() wouldn't have the ACLs in it.

Second, I had to hack around account GET and HEAD requests when (a) account autocreate is on, and (b) the account does not actually exist. In this case, the proxy caches a 404 result down in GETorHEAD_base. However, it then returns a 200 or 204 with an empty listing. Thus, if environment identity is not preserved, get_info() sees a 2xx response and caches it, which breaks a bunch of tests. I hacked around it with some made-up header; better suggestions welcome.

Third and ugliest, I commented out one unit test (last line of test.unit.proxy.server.TestContainerController.test_HEAD_GET). That test was asserting stuff about the environment caching behavior when the account doesn't exist and account autocreate is on. I wasn't sure how to keep that working *and* keep the other account-autocreate tests working too, and it really doesn't seem too important what we cache in this particular case. Again, suggestions welcome.