[Tests] Eliminate system globals in test suites
It should be possible to run jenkins/run-tests.sh on two source trees concurrently on the same machine (using either the same or different login accounts).Known problems to fix:
- Default test config uses /tmp/crunch_refresh_trigger which causes races and permission problems, depending on whether concurrent tests are run with different logins.
- Test suite removes the whole
$HOME/.cache/arvados/discovery/dir, but the config code assumes nobody would ever do this: it calls
mkdirand then tells httplib2 to use it as a cache dir, which crashes if the dir doesn't exist. It should just remove its own discovery docs, not the entire dir. (Removing all cached docs and leaving the directory alive wouldn't be as elegant, but should work fine: the cache user should already be immune to races over individual files.)
- websocket_runner still uses a hard coded port 3002. It should do something like
find_available_port()in source:sdk/python/tests/run_test_server.py#L97 instead.
- run-test-servers.py uses random port numbers (from #3021). This seems to be working well.
- Each run-tests process needs a dedicated database: you just need to put a different database name (and optionally a different db user) in config/database.yml.
- Running more than one test suite at a time in the same working tree (this will cause all kinds of problems with packaging tools and pidfiles that surely aren't worth taking on).
- Avoiding leaking global state from $HOME/.config into tests.