Kong / kong-python-pdk

Write Kong plugins in Python (Experimental)
Apache License 2.0
45 stars 14 forks source link

Plugin Testing Patterns #60

Closed wjziv closed 2 years ago

wjziv commented 2 years ago

I've been working with Kong and custom plugins for about a month now; powerful stuff!

As my plugin collection is growing, and complexity is increasing, I was wondering what kind of testing schemes you would recommend for python specifically? I'm not able to find very much in the docs for this particular side of non-lua plugin development.

Currently, we achieve integration tests through Kong deployed in kind with an echo server. Validation there, and recommendations for unit tests and "mock kong"s would be great!

Thanks!

fffonion commented 2 years ago

Hi @wjziv , we haven't implemented "mock kong" test yet, but that's on our roadmap. Please stay tuned for this issue!

wjziv commented 2 years ago

Super glad to hear it's on the roadmap!

Are there suggested testing patterns put forth by Kong generally for plugin development? If integration tests over a cluster which services echo servers alone are the end-all, be-all of tests, that's fine.

Checking to see if there's anything I've missed in this regard.

fffonion commented 2 years ago

@wjziv usually you will need both for good coverage. The "mock kong" suite is more for a semi-e2e test, it will help you catch typos, type mismatches regarding your RPC calls, and also helps you do unit test on your plugin's functionality. And I recommand to also have an additional (real) e2e test setup.

luozhouyang commented 9 months ago

Hi guys, any updates about mock kong?