DistributedTaskScheduling / JobAdder

Source code of the JobAdder project
GNU General Public License v3.0
2 stars 1 forks source link

Imlementing SQLDatabase. #101

Closed nikolatzotchev closed 4 years ago

nikolatzotchev commented 4 years ago

Moved the methods to SQLDatabase, added the callbacks, probably not right but ilia can check. I don't now what kind of test I should write about this. The methods are already tested in the mock_database so no point in testing them, but maybe the callbacks?

ammen99 commented 4 years ago

I think tests for the callbacks need to be implemented. As well as checking that they are called when the database is updated, and that no infinite recursion happens.

nikolatzotchev commented 4 years ago

I think tests for the callbacks need to be implemented. As well as checking that they are called when the database is updated, and that no infinite recursion happens.

I'm not really sure how to test if there is no recursion happening.

ammen99 commented 4 years ago

I'm not really sure how to test if there is no recursion happening.

You can do the following:

  1. Set a callback which increments a counter each time it is called
  2. Update the database to callback is triggered
  3. In the callback, increment your counter and update the database again
  4. If the callback is called and the counter is higher than 0, this means you're in a recursion
nikolatzotchev commented 4 years ago

@ammen99 I fixed the bug here, it is not a problem right?

ammen99 commented 4 years ago

It's fine I think.