From 0fdf28c61526a447f00b2fc63f346f4631e1dd68 Mon Sep 17 00:00:00 2001 From: Wilfried OLLIVIER Date: Thu, 2 May 2019 21:18:51 +0200 Subject: [PATCH] More golang testing tips --- src/dev/golang/testing.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/dev/golang/testing.md b/src/dev/golang/testing.md index f033e22..dd63a6f 100644 --- a/src/dev/golang/testing.md +++ b/src/dev/golang/testing.md @@ -77,3 +77,25 @@ t.Fatalf() ## I don't want my tests to be messy (kudos @athoune) [Assert](https://godoc.org/github.com/stretchr/testify/assert) + +## Shit, i want to disable my oauth test on my CI + +```golang +if os.Getenv("DRONE") == "true" { + t.Skip("Skipping test in CI environment") +} +``` + +## Short mode + +This test is too long ? Skip it ! + +```golang + if testing.Short() { + t.Skip("Skipping test in short mode") + } +``` + +```shell +go test github.com/go/pkg/package --short +``` \ No newline at end of file