mirror of https://github.com/zulip/zulip.git
tests: Set LOCAL_AVATARS_DIR / LOCAL_FILES_DIR in tests.
7ad06473b6
split out `LOCAL_AVATARS_DIR` and `LOCAL_FILES_DIR` as
derived values from `LOCAL_UPLOADS_DIR`. However, this means that all
places which set `LOCAL_UPLOADS_DIR` need to potentially propagate
that change into the derived values if they come *after*
`computed_settings.py` is applied. It did this successfully in
`zerver/lib/test_runner.py` and the `use_s3_backend` decorator, but
did not adjust the late-set `zproject/test_extra_settings.py`.
This causes tests to share a single common set of avatars and
attachments directories. In puppeteer tests, this leads to assertion
failures checking `assert_is_local_storage_path`; in backend tests,
this leads to races when checking the contents of the local storage
directory when run in parallel mode.
Set `LOCAL_AVATARS_DIR` and `LOCAL_FILES_DIR` based on
`LOCAL_UPLOADS_DIR` when it is pulled from the environment during
testing.
This commit is contained in:
parent
c58e893cb6
commit
dcd8947c1b
|
@ -151,6 +151,9 @@ ENABLE_FILE_LINKS = True
|
|||
# frontend/API tests in test_server.py can control this.
|
||||
if "LOCAL_UPLOADS_DIR" in os.environ:
|
||||
LOCAL_UPLOADS_DIR = os.getenv("LOCAL_UPLOADS_DIR")
|
||||
assert LOCAL_UPLOADS_DIR is not None
|
||||
LOCAL_AVATARS_DIR = os.path.join(LOCAL_UPLOADS_DIR, "avatars")
|
||||
LOCAL_FILES_DIR = os.path.join(LOCAL_UPLOADS_DIR, "files")
|
||||
# Otherwise, we use the default value from dev_settings.py
|
||||
|
||||
S3_KEY = "test-key"
|
||||
|
|
Loading…
Reference in New Issue