I am currently writing a number of plugins (bundles) in Python. Is there any recommended work flows to speed up development and testing.
My current flow is:
- Write some code blind (middlewares)
- Bundle up the middlewares
- Add bundle to bundle server
- Hot reload the gateway
- Test the middleware
- Oh, typo
- Fix typo
- Back to step 2.
All of the above doing within a local docker compose set up.
Because of the external dependencies such as
gateway it seems like it is impossible to write the middlewares in isolation.
The best way that I can think of to handle this is to mock the Tyk dependencies and arguments passed in by the decorator i.e. request, session, metadata, spec etc and build my plugins using TDD.
TDD actually feels like best way to build in isolation but I don't really like mocking code that I do not own.
Has anyone come up with a good workflow to build and test plugins?
I took a look at the available Tyk plugins such as Bot Detection and Loggly Logging as I was hoping they may have some tests.
I think being able to test middlewares is incredibly important as a simple mistake could take down an API.
Hopefully I am just missing something and all this is documented somewhere or my workflow is just completely wrong.