Page MenuHomeSoftware Heritage

Use the in-memory storage instead of mocks to test the webapp
Closed, MigratedEdits Locked

Description

Currently, the unit tests of swh-web heavily rely on mocking the methods of the swh.storage.Storage class.
While the approach works, there is a couple of drawbacks with it:

  • tests implementation are hard to read and maintain for a newcomer
  • tests data are hardcoded and can end up not synchronized with the latest swh-storage schema
  • maintaining tests full of mocks is painful and too much time consuming

These tests must be rewritten using the new in-memory storage.

Related Objects

Event Timeline

anlambert triaged this task as Normal priority.Oct 17 2018, 1:47 PM
anlambert created this task.

Now that the backend storage API has been trimmed way down, I think implementing an in-memory implementation of its API is becoming tractable again. This would help avoid using a SQL database for integration testing of other components of the stack.

This is sort of what is being done with the test fixture for the loaders, but pushed one layer lower in the stack.

anlambert renamed this task from Web app: Find a way to run tests without mocking storage to Use the in-mem storage instead of mocks to test the webapp..Nov 21 2018, 11:02 AM
anlambert claimed this task.
anlambert updated the task description. (Show Details)
anlambert renamed this task from Use the in-mem storage instead of mocks to test the webapp. to Use the in-mem storage instead of mocks to test the webapp.Nov 21 2018, 12:01 PM
anlambert changed the task status from Open to Work in Progress.Dec 7 2018, 10:49 AM
anlambert renamed this task from Use the in-mem storage instead of mocks to test the webapp to Use the in-memory storage instead of mocks to test the webapp.Dec 11 2018, 10:46 AM
anlambert updated the task description. (Show Details)