Skip to content

Commit

Permalink
Use gotest.tools assert package instead of testify 🍵
Browse files Browse the repository at this point in the history
We are using `gotest.tools` for other package, let's also use it for
its `assert` package and remove the use of `testify`.

Signed-off-by: Vincent Demeester <[email protected]>
  • Loading branch information
vdemeester authored and tekton-robot committed Jan 29, 2020
1 parent 7e6a0d5 commit b327468
Show file tree
Hide file tree
Showing 21 changed files with 14 additions and 4,562 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ require (
github.com/pkg/errors v0.8.1
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.4.0
github.com/stretchr/testify v1.4.0 // indirect
github.com/tektoncd/pipeline v0.9.2
github.com/tektoncd/plumbing v0.0.0-20191218171343-56a836c50336
github.com/tektoncd/triggers v0.1.1-0.20191218175743-c5b8b4d9ee00
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/tektoncd/pipeline v0.9.2 h1:eJ9x1KY/XpUGmTjNdowRHF7G9FozKGptHnEGwKO4W/I=
github.com/tektoncd/pipeline v0.9.2/go.mod h1:IZzJdiX9EqEMuUcgdnElozdYYRh0/ZRC+NKMLj1K3Yw=
github.com/tektoncd/pipeline v0.10.0 h1:znCqo/kMts+rvt8eB/8W2dBniN3e51tCzQ7aRo8PFKs=
github.com/tektoncd/plumbing v0.0.0-20191218171343-56a836c50336 h1:gTedwNTH1vMF6wlA6wvQqinpH0ls8G6oQgsaHuuqCGc=
github.com/tektoncd/plumbing v0.0.0-20191218171343-56a836c50336/go.mod h1:QZHgU07PRBTRF6N57w4+ApRu8OgfYLFNqCDlfEZaD9Y=
github.com/tektoncd/plumbing/pipelinerun-logs v0.0.0-20191206114338-712d544c2c21/go.mod h1:S62EUWtqmejjJgUMOGB1CCCHRp6C706laH06BoALkzU=
Expand Down Expand Up @@ -405,7 +404,6 @@ k8s.io/api v0.0.0-20191004102255-dacd7df5a50b h1:38Nx0U83WjBqn1hUWxlgKc7mvH7WhyH
k8s.io/api v0.0.0-20191004102255-dacd7df5a50b/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
k8s.io/apimachinery v0.0.0-20191004074956-01f8b7d1121a h1:lDydUqHrbL/1l5ZQrqD1RIlabhmX8aiZEtxVUb+30iU=
k8s.io/apimachinery v0.0.0-20191004074956-01f8b7d1121a/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
k8s.io/apimachinery v0.17.2 h1:hwDQQFbdRlpnnsR64Asdi55GyCaIP/3WQpMmbNBeWr4=
k8s.io/cli-runtime v0.0.0-20191004110054-fe9b9282443f h1:vJOrMsZe+RD884n+WQ5So2oOp7SajI0Op3oOBg64ZsY=
k8s.io/cli-runtime v0.0.0-20191004110054-fe9b9282443f/go.mod h1:qWnH3/b8sp/l7EvlDh7ulDU3UWA4P4N1NFbEEP791tM=
k8s.io/client-go v0.0.0-20191004102537-eb5b9a8cfde7 h1:WyPHgjjXvF4zVVwKGZKKiJGBUW45AuN44uSOuH8euuE=
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/tektoncd/cli/pkg/test"
"gotest.tools/v3/assert"
)

func TestVersionGood(t *testing.T) {
Expand Down Expand Up @@ -67,15 +67,15 @@ func TestVersionGood(t *testing.T) {
cli := NewClient(time.Duration(0))
cli.httpClient = httpClient
output, err := checkRelease(cli)
assert.Nil(t, err)
assert.NilError(t, err)
assert.Equal(t, s.expected, output)
})
}

clientVersion = "v1.2.3"
version := Command()
got, err := test.ExecuteCommand(version, "version", "")
assert.Nil(t, err)
assert.NilError(t, err)
assert.Equal(t, "Client version: "+clientVersion+"\n", got)

}
Expand Down Expand Up @@ -121,7 +121,7 @@ func TestVersionBad(t *testing.T) {
cli.httpClient = httpClient
output, err := checkRelease(cli)
assert.Error(t, err, s.expectederr)
assert.Empty(t, output)
assert.Assert(t, output == "")
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/flags/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (

"github.com/fatih/color"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"github.com/tektoncd/cli/pkg/cli"
"gotest.tools/v3/assert"
)

func TestFlags_add_shell_completion(t *testing.T) {
Expand Down Expand Up @@ -50,6 +50,6 @@ func TestFlags_colouring(t *testing.T) {
// assert.False(t, color.NoColor)

_ = InitParams(&cli.TektonParams{}, &cobra.Command{})
assert.True(t, color.NoColor)
assert.Assert(t, color.NoColor == true)

}
5 changes: 2 additions & 3 deletions pkg/formatted/color_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ import (
"testing"

"github.com/fatih/color"
"github.com/stretchr/testify/assert"
"github.com/tektoncd/cli/pkg/test"
"gotest.tools/v3/assert"
)

func TestRainbowsColours(t *testing.T) {
rb := newRainbow()
assert.Equal(t, rb.counter.value, uint32(0)) // nothing

c := rb.get("a") // get a label
assert.NotNil(t, c)
_ = rb.get("a") // get a label
assert.Equal(t, rb.counter.value, uint32(1))

_ = rb.get("b") // incremented
Expand Down
8 changes: 3 additions & 5 deletions pkg/formatted/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ package formatted
import (
"testing"

"github.com/stretchr/testify/assert"
"knative.dev/pkg/apis/duck/v1beta1"

"github.com/fatih/color"
"gotest.tools/v3/assert"
corev1 "k8s.io/api/core/v1"
"knative.dev/pkg/apis"

"github.com/fatih/color"
"knative.dev/pkg/apis/duck/v1beta1"
)

func TestColor(t *testing.T) {
Expand Down
6 changes: 2 additions & 4 deletions pkg/helper/file/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import (
"testing"

"github.com/ghodss/yaml"

"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"
"github.com/tektoncd/cli/pkg/test"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"gotest.tools/v3/assert"
)

func TestLoadLocalFile(t *testing.T) {
Expand Down Expand Up @@ -62,6 +61,5 @@ func TestGetError(t *testing.T) {
target := "httpz://foo.com/task.yaml"

_, err := LoadFileContent(p, target, IsYamlFile(), fmt.Errorf("inavlid file format for %s: .yaml or .yml file extension and format required", target))
assert.NotNil(t, err)
test.AssertOutput(t, "Get httpz://foo.com/task.yaml: unsupported protocol scheme \"httpz\"", err.Error())
assert.Error(t, err, `Get httpz://foo.com/task.yaml: unsupported protocol scheme "httpz"`)
}
27 changes: 0 additions & 27 deletions vendor/github.com/pmezard/go-difflib/LICENSE

This file was deleted.

Loading

0 comments on commit b327468

Please sign in to comment.