Posts

24 Mar 2020 How to do testing with zap a popular logging library for Golang

How you can use logging to build assertions when testing. What the popular Golang logging library provided by Uber gives you around unit tests.

09 Mar 2020 How to test CLI commands made with Go and Cobra

CLI commands are common in Go. Testing them is an effective way to run a big amount of code that is actually very close to the end user. I use Cobra, pflags and Viper and that's what I do when I write unit test for Cobra commands

25 Feb 2020 The awesomeness of the httptest package in Go

One of the reasons why testing in Go is friendly is driven by the fact that the core team already provides useful testing package as part of the stdlib that you can use, as they do to test packages that depend on them. This article explains how to use the httptest package to mock HTTP servers and to test sdks that use the http.Client.

10 Jan 2020 Unit test kubernetes client in Go

A flexible an easy to use testing framework makes all the difference. Kubernetes provides a fake client in Go that works like a charm.