Skip to content

Commit

Permalink
refactor: drop gotest.tools assertion and add linting rule
Browse files Browse the repository at this point in the history
use testify assertions and forbid different assertion libraries
  • Loading branch information
kruskall committed Jan 31, 2025
1 parent 2b8d554 commit fda7a43
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 34 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ linters-settings:
- errors
- fmt
reason: "This package is deprecated, use `fmt.Errorf` with `%w` instead"
- gotest.tools/v3:
recommendations:
- github.com/stretchr/testify
reason: "Use one assertion library consistently across the codebase"
- github.com/google/uuid:
# Recommended modules that should be used instead. (Optional)
recommendations:
Expand Down
46 changes: 23 additions & 23 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28552,29 +28552,6 @@ Contents of probable licence file $GOMODCACHE/gotest.tools/[email protected]/LICE
limitations under the License.


--------------------------------------------------------------------------------
Dependency : gotest.tools/v3
Version: v3.5.1
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/gotest.tools/[email protected]/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 : howett.net/plist
Version: v1.0.1
Expand Down Expand Up @@ -73800,6 +73777,29 @@ See the License for the specific language governing permissions and
limitations under the License.


--------------------------------------------------------------------------------
Dependency : gotest.tools/v3
Version: v3.5.1
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/gotest.tools/[email protected]/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 : k8s.io/klog/v2
Version: v2.130.1
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ require (
golang.org/x/term v0.27.0
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gotest.tools/v3 v3.5.1
)

require (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
"fmt"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/confmap"
"gopkg.in/yaml.v2"
"gotest.tools/v3/assert"

"github.com/elastic/elastic-agent-libs/config"
)
Expand Down Expand Up @@ -72,7 +72,7 @@ timeout: 1m30s
user: elastic
headers:
X-Header-1: foo
X-Bar-Header: bar
X-Bar-Header: bar
batcher:
enabled: true
max_size_items: 1600
Expand Down Expand Up @@ -106,11 +106,11 @@ retry:
enabled: true
initial_interval: 1s
max_interval: 1m0s
max_retries: 3
logs_index: some-index
max_retries: 3
logs_index: some-index
password: changeme
user: elastic
timeout: 1m30s
user: elastic
timeout: 1m30s
`

tests := []struct {
Expand Down Expand Up @@ -147,11 +147,11 @@ retry:
enabled: true
initial_interval: 5s
max_interval: 5m0s
max_retries: 3
logs_index: some-index
max_retries: 3
logs_index: some-index
password: changeme
user: elastic
timeout: 1m30s
user: elastic
timeout: 1m30s
idle_conn_timeout: 1s
num_workers: 1
batcher:
Expand Down

0 comments on commit fda7a43

Please sign in to comment.