holic/redirect.name

Integration tests

Opened this issue · 1 comments

holic commented
Integration tests

Here's a thought on how this could be done (this is similar to how I tested my change in #12).

  • Create a simple http crud service and deploy it to heroku for free
  • Set up testing.redirect.name to redirect to https://whatever-random-name.herokuapp.com
  • Start up redirect.name locally and make curl requests with -H "Host: testing.redirect.name" to the endpoints of that service, and verify the results are correct

The testing service could have endpoints like this:

  • GET /tests/:testInvocationId/things
  • GET /tests/:testInvocationId/things/:thingId
  • POST /tests/:testInvocationId/things { "name": "spatula" } ("spatula" could be anything)
  • DELETE /tests/:testInvocationId/things/:thingId
  • DELETE /tests/:testInvocationId

The :testInvocationId parameter would be unique and randomly generated per test suite run, so as to avoid collisions when running multiple in parallel, and this test "thing-service" wouldn't need a database or anything - simple in-memory storage would work just fine. Testing that each http method is forwarded correctly is a simple matter of testing whether or not the correct data is stored in the service.

I'd like to hear your thoughts on this.