refactor: remove gotest.tools (#688)

* refactor: remove `gotest.tools`

* remove all references to `gotest.tools` and replace it with
  `github.com/stretchr/testify` which was originally used for tests
* bump `golangci-lint` version
* add `depguard` and `importas` to prevent import of unwanted packages
* add custom schema and information about config since
  schemastore.org has broken schema for `golangci-lint` config

* fix: handle more error cases
This commit is contained in:
Ryan (hackercat)
2021-05-18 06:14:49 +00:00
committed by GitHub
parent 3e22b1b374
commit f571290b25
9 changed files with 71 additions and 43 deletions

View File

@@ -5,7 +5,7 @@ import (
"testing"
log "github.com/sirupsen/logrus"
"gotest.tools/v3/assert"
assert "github.com/stretchr/testify/assert"
)
func init() {
@@ -33,7 +33,7 @@ func TestGetImagePullOptions(t *testing.T) {
ctx := context.Background()
options, err := getImagePullOptions(ctx, NewDockerPullExecutorInput{})
assert.NilError(t, err, "Failed to create ImagePullOptions")
assert.Nil(t, err, "Failed to create ImagePullOptions")
assert.Equal(t, options.RegistryAuth, "", "RegistryAuth should be empty if no username or password is set")
options, err = getImagePullOptions(ctx, NewDockerPullExecutorInput{
@@ -41,6 +41,6 @@ func TestGetImagePullOptions(t *testing.T) {
Username: "username",
Password: "password",
})
assert.NilError(t, err, "Failed to create ImagePullOptions")
assert.Nil(t, err, "Failed to create ImagePullOptions")
assert.Equal(t, options.RegistryAuth, "eyJ1c2VybmFtZSI6InVzZXJuYW1lIiwicGFzc3dvcmQiOiJwYXNzd29yZCJ9", "Username and Password should be provided")
}