tsm: cache: add a tests to demonstrate thread safety vulnerabilities
tsm: cache: add a tests to demonstrate thread safety vulnerabilities

There are two tests that show two different one vulnerability.

One test shows that Cache.Deduplicate modifies entries in a snapshot's
store without a lock while cache readers are deduplicating those same
entries while correctly locked.

A second test shows that two threads trying to execute the methods
that Engine.WriteSnapshot calls will cause concurrent, unsynchronized
mutating access to the snapshot's store and entries.

The tests fail at this commit and are fixed by subsequent commits.

Signed-off-by: Jon Seymour <44f878afe53efc66b76772bd845eb65944ed8232@wildducktheories.com>

archsaber/influxdb,chenziliang/influxdb,influxdb/influxdb,influxdata/influxdb,arussellsaw/influxdb,influxdb/influxdb,daachi/influxdb,apigee/influxdb,influxdb/influxdb,apigee/influxdb,runner-mei/influxdb,mark-rushakoff/influxdb,jipperinbham/influxdb,mnuessler/influxdb,archsaber/influxdb,daachi/influxdb,runner-mei/influxdb,mark-rushakoff/influxdb,joaopedrotaveira/influxdb,joaopedrotaveira/influxdb,nooproblem/influxdb,jipperinbham/influxdb,arussellsaw/influxdb,archsaber/influxdb,arussellsaw/influxdb,linearb/influxdb,mvadu/influxdb,mark-rushakoff/influxdb,linearb/influxdb,arussellsaw/influxdb,chenziliang/influxdb,apigee/influxdb,otoolep/influxdb,jipperinbham/influxdb,jgeiger/influxdb,nooproblem/influxdb,nooproblem/influxdb,pkittenis/influxdb,pkittenis/influxdb,jonseymour/influxdb,li-ang/influxdb,pkittenis/influxdb,pkittenis/influxdb,joaopedrotaveira/influxdb,archsaber/influxdb,daachi/influxdb,mvadu/influxdb,mnuessler/influxdb,daachi/influxdb,mnuessler/influxdb,jgeiger/influxdb,mvadu/influxdb,chenziliang/influxdb,vladlopes/influxdb,jonseymour/influxdb,nooproblem/influxdb,pkittenis/influxdb,otoolep/influxdb,otoolep/influxdb,jipperinbham/influxdb,jonseymour/influxdb,mnuessler/influxdb,daachi/influxdb,vladlopes/influxdb,runner-mei/influxdb,benbjohnson/influxdb,jgeiger/influxdb,joaopedrotaveira/influxdb,runner-mei/influxdb,benbjohnson/influxdb,jgeiger/influxdb,mnuessler/influxdb,linearb/influxdb,jonseymour/influxdb,mnuessler/influxdb,otoolep/influxdb,jonseymour/influxdb,influxdb/influxdb,mark-rushakoff/influxdb,nooproblem/influxdb,mark-rushakoff/influxdb,jgeiger/influxdb,jonseymour/influxdb,jipperinbham/influxdb,mvadu/influxdb,arussellsaw/influxdb,mvadu/influxdb,li-ang/influxdb,chenziliang/influxdb,linearb/influxdb,jipperinbham/influxdb,mvadu/influxdb,daachi/influxdb,influxdata/influxdb,apigee/influxdb,jgeiger/influxdb,benbjohnson/influxdb,joaopedrotaveira/influxdb,influxdb/influxdb,otoolep/influxdb,apigee/influxdb,apigee/influxdb,linearb/influxdb,benbjohnson/influxdb,otoolep/influxdb,influxdb/influxdb,vladlopes/influxdb,mark-rushakoff/influxdb,vladlopes/influxdb,pkittenis/influxdb,arussellsaw/influxdb