Skip to content

Commit

Permalink
refactor: replace gotest.tools assertions with testify (#5102)
Browse files Browse the repository at this point in the history
* refactor: replace gotest.tools assertions with testify

drop gotest.tools dependency and consistently use testify assertions

* lint: update nolint comment in error test

* lint: add nolint gomodguard ignore comment
  • Loading branch information
kruskall authored Jul 10, 2024
1 parent 72c1ebd commit ca5a07c
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 35 deletions.
23 changes: 0 additions & 23 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15463,29 +15463,6 @@ See the License for the specific language governing permissions and
limitations under the License.


--------------------------------------------------------------------------------
Dependency : gotest.tools
Version: v2.2.0+incompatible
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/gotest.tools@v2.2.0+incompatible/LICENSE:

Copyright 2018 gotest.tools authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


--------------------------------------------------------------------------------
Dependency : gotest.tools/gotestsum
Version: v1.9.0
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ require (
gopkg.in/ini.v1 v1.67.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools v2.2.0+incompatible
gotest.tools/gotestsum v1.9.0
k8s.io/api v0.29.5
k8s.io/apimachinery v0.29.5
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1416,8 +1416,6 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools/gotestsum v1.9.0 h1:Jbo/0k/sIOXIJu51IZxEAt27n77xspFEfL6SqKUR72A=
gotest.tools/gotestsum v1.9.0/go.mod h1:6JHCiN6TEjA7Kaz23q1bH0e2Dc3YJjDUZ0DmctFZf+w=
gotest.tools/v3 v3.3.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gotest.tools/assert"

"github.com/elastic/elastic-agent/internal/pkg/agent/application/coordinator"
"github.com/elastic/elastic-agent/internal/pkg/agent/application/upgrade/details"
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/agent/cmd/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gotest.tools/assert"

"github.com/elastic/elastic-agent/internal/pkg/cli"
)
Expand Down
7 changes: 4 additions & 3 deletions internal/pkg/agent/errors/error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.
//
// nolint:errorlint // Postpone the change here until we refactor error handling.
//
// Packages errors provides a small api to manager hierarchy or errors.
//
//nolint:errorlint // Postpone the change here until we refactor error handling.
package errors

import (
"fmt"
"io"
"testing"

//nolint:gomodguard // Postpone the change here until we refactor error handling.
"github.com/pkg/errors"
"gotest.tools/assert"
"github.com/stretchr/testify/assert"
)

func TestErrorsIs(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/capabilities/expr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"testing"

"gotest.tools/assert"
"github.com/stretchr/testify/assert"
)

func TestExpr(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/core/monitoring/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ package config
import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gotest.tools/assert"

"github.com/elastic/elastic-agent/internal/pkg/config"
)
Expand Down Expand Up @@ -204,7 +204,7 @@ func TestAPMConfig(t *testing.T) {
require.NoError(t, in.Unpack(cfg))
require.NotNil(t, cfg)

assert.DeepEqual(t, tc.out, cfg.APM)
assert.Equal(t, tc.out, cfg.APM)
})
}
}
2 changes: 1 addition & 1 deletion testing/integration/pkgversion_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"testing"

"gopkg.in/yaml.v2"
"gotest.tools/assert"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

integrationtest "github.com/elastic/elastic-agent/pkg/testing"
Expand Down

0 comments on commit ca5a07c

Please sign in to comment.