Introducing Handler Inspector
While working on the test suite for the vmware-rest-proxy I needed a mock server to mock away the vSphere API calls the proxy uses. Suprisingly, gotest already includes just that. While this is a nice thing compared to other languages, which need big and complicated packages to achieve the same result, configuring the required handler was a bit of a hassle and especially testing the calls to it with local counters and variables just didn’t feel right.
As I’m in love with the Builder pattern, especially for writing tests, I created golang-handlerinspector. This module includes a tool to create http.Handler values using the builder pattern. Additionally, the handler records the calls to it and can be analyzed using an included „inspector“.
It’s currently tailored to DoDevOps‘ needs for the vmware-rest-proxy, but can easily be extended to support more things. (Which translates to: I’m open to receive Pull Requests for it 🙂)
(Photo by Emiliano Vittoriosi auf Unsplash)
Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre, wie deine Kommentardaten verarbeitet werden.
Schreibe einen Kommentar