ctubbsii commented on issue #5724:
URL: https://github.com/apache/accumulo/issues/5724#issuecomment-3189651208

   > I'm trying to figure out how to create an instance of TableMapping so I 
can invoke those methods and test them. I was thinking my approach would be to 
create an AccumuloClient instance to get a TableOperations instance, and then 
call the create method with many threads to verify that one thread would 
succeed. Like in TableOperationsIT.createTable(). Is this an appropriate way to 
handle this?
   
   I think there are two main elements of testing this. The first is verifying 
ZooReaderWriter.mutateExisting, to ensure that two of them cannot happen 
concurrently... that one will always block until the other finishes. (We might 
even have this test coverage already.) The second is testing that the various 
conditions (what to do if the table name or ID exists/doesn't exist) are 
properly handled inside the mutator (that it throws when it should, such as 
when the name already exists in the mapping).
   
   You could try to create a new TableMapping object with a mock version of 
AccumuloClient whose getZooSession method returns a ZooSession object that is 
from ZooKeeperTestingServer. We have a few ZooKeeper tests that use 
ZooKeeperTestingServer that could be used as examples, and lots of tests that 
show examples of creating mock objects, including AccumuloClient instances, 
probably. You can set the data explicitly in ZooKeeperTestingServer for each 
scenario, and then call the TableMapping methods to see if it behaves as 
expected.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to