Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gotest.tools assert package instead of testify 🍵 #656

Merged
merged 1 commit into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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