Currently dfs_test.tmp workspace location on local filesystem is hardcoded to /tmp/drilltest. If a test creates a view or new table, it is created under this location. Problem is when two or more test forks are running in parallel, sharing the dfs_test.tmp workspace location causes synchronization issues.
For example: TestViewSupport#view1 creates a view testView1 in workspace dfs_test.tmp. This causes a new view file under /tmp/drilltest directory. At this point parallel running test TestInfoSchema#showTables makes a call to list tables in dfs_test.tmp workspace. Show tables returns testView1 as one of the tables in dfs_test.tmp workspace which it is not expecting causing the TestInfoSchema#showTables to fail.
Proposed solution is:
When setting up Drill test cluster in BaseTestQuery (root class for most tests), modify workspace dfs_test.tmp location to point to a temp directory created using Files.createTempDir. If two or more processes call Files.createTempDir at the same time each one guarateed to get a exclusive directory as long as there are no more than 1000 calls per millisecond.
For JDBC, we rely on property drillJDBCUnitTests in connection properties to setup exclusive directory for dfs_test.tmp workspace.