osohq / gitclub

Realistic examples of using Oso in an application for authorization. Built for multiple different backends.
54 stars 16 forks source link

Add CI #10

Closed gkaemmer closed 3 years ago

gkaemmer commented 3 years ago

The tests are written in python (much the same as they are currently), and operate by spinning up a server in either the flask-sqlalchemy or rails folders, restoring fixtures by hitting a /_reset endpoint, and then running through test cases using plain old requests HTTP methods.

Temporarily basing this PR on gkaemmer/gitclub-backends. Figure that we can merge this to main afterwards.

gkaemmer commented 3 years ago

Is there a chance that concurrent tests would clash? E.g. what if the database was reset after one of the tests created/deleted something?

@samscott89 the tests run in sequence (not in parallel), so this isn't an issue for now.

If we did eventually want to run the tests in parallel, we might have to get fancier. I think doing that would require us either to re-write the test suite so that each test uses data unrelated data (instead of a shared set of fixtures) OR have each test spin up its own server (spinning up a new server would add a lot of overhead, especially for rails which takes ~2-3 seconds to start up)