Skip to content

Commit 467dc76

Browse files
refactor: drop gotest.tools assertion and add linting rule (#42566) (#42578)
use testify assertions and forbid different assertion libraries (cherry picked from commit 7ed8737) Co-authored-by: kruskall <[email protected]>
1 parent c60042a commit 467dc76

File tree

4 files changed

+37
-34
lines changed

4 files changed

+37
-34
lines changed

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ linters-settings:
125125
- errors
126126
- fmt
127127
reason: "This package is deprecated, use `fmt.Errorf` with `%w` instead"
128+
- gotest.tools/v3:
129+
recommendations:
130+
- github.com/stretchr/testify
131+
reason: "Use one assertion library consistently across the codebase"
128132
- github.com/google/uuid:
129133
# Recommended modules that should be used instead. (Optional)
130134
recommendations:

NOTICE.txt

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28490,29 +28490,6 @@ Contents of probable licence file $GOMODCACHE/gotest.tools/[email protected]/LICE
2849028490
limitations under the License.
2849128491

2849228492

28493-
--------------------------------------------------------------------------------
28494-
Dependency : gotest.tools/v3
28495-
Version: v3.5.1
28496-
Licence type (autodetected): Apache-2.0
28497-
--------------------------------------------------------------------------------
28498-
28499-
Contents of probable licence file $GOMODCACHE/gotest.tools/[email protected]/LICENSE:
28500-
28501-
Copyright 2018 gotest.tools authors
28502-
28503-
Licensed under the Apache License, Version 2.0 (the "License");
28504-
you may not use this file except in compliance with the License.
28505-
You may obtain a copy of the License at
28506-
28507-
http://www.apache.org/licenses/LICENSE-2.0
28508-
28509-
Unless required by applicable law or agreed to in writing, software
28510-
distributed under the License is distributed on an "AS IS" BASIS,
28511-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28512-
See the License for the specific language governing permissions and
28513-
limitations under the License.
28514-
28515-
2851628493
--------------------------------------------------------------------------------
2851728494
Dependency : howett.net/plist
2851828495
Version: v1.0.1
@@ -73769,6 +73746,29 @@ See the License for the specific language governing permissions and
7376973746
limitations under the License.
7377073747

7377173748

73749+
--------------------------------------------------------------------------------
73750+
Dependency : gotest.tools/v3
73751+
Version: v3.5.1
73752+
Licence type (autodetected): Apache-2.0
73753+
--------------------------------------------------------------------------------
73754+
73755+
Contents of probable licence file $GOMODCACHE/gotest.tools/[email protected]/LICENSE:
73756+
73757+
Copyright 2018 gotest.tools authors
73758+
73759+
Licensed under the Apache License, Version 2.0 (the "License");
73760+
you may not use this file except in compliance with the License.
73761+
You may obtain a copy of the License at
73762+
73763+
http://www.apache.org/licenses/LICENSE-2.0
73764+
73765+
Unless required by applicable law or agreed to in writing, software
73766+
distributed under the License is distributed on an "AS IS" BASIS,
73767+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
73768+
See the License for the specific language governing permissions and
73769+
limitations under the License.
73770+
73771+
7377273772
--------------------------------------------------------------------------------
7377373773
Dependency : k8s.io/klog/v2
7377473774
Version: v2.130.1

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ require (
229229
golang.org/x/term v0.27.0
230230
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697
231231
gopkg.in/natefinch/lumberjack.v2 v2.2.1
232-
gotest.tools/v3 v3.5.1
233232
)
234233

235234
require (

libbeat/otelbeat/oteltranslate/outputs/elasticsearch/config_otel_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import (
2222
"fmt"
2323
"testing"
2424

25+
"github.com/stretchr/testify/assert"
2526
"github.com/stretchr/testify/require"
2627
"go.opentelemetry.io/collector/confmap"
2728
"gopkg.in/yaml.v2"
28-
"gotest.tools/v3/assert"
2929

3030
"github.com/elastic/elastic-agent-libs/config"
3131
)
@@ -72,7 +72,7 @@ timeout: 1m30s
7272
user: elastic
7373
headers:
7474
X-Header-1: foo
75-
X-Bar-Header: bar
75+
X-Bar-Header: bar
7676
batcher:
7777
enabled: true
7878
max_size_items: 1600
@@ -106,11 +106,11 @@ retry:
106106
enabled: true
107107
initial_interval: 1s
108108
max_interval: 1m0s
109-
max_retries: 3
110-
logs_index: some-index
109+
max_retries: 3
110+
logs_index: some-index
111111
password: changeme
112-
user: elastic
113-
timeout: 1m30s
112+
user: elastic
113+
timeout: 1m30s
114114
`
115115

116116
tests := []struct {
@@ -147,11 +147,11 @@ retry:
147147
enabled: true
148148
initial_interval: 5s
149149
max_interval: 5m0s
150-
max_retries: 3
151-
logs_index: some-index
150+
max_retries: 3
151+
logs_index: some-index
152152
password: changeme
153-
user: elastic
154-
timeout: 1m30s
153+
user: elastic
154+
timeout: 1m30s
155155
idle_conn_timeout: 1s
156156
num_workers: 1
157157
batcher:

0 commit comments

Comments
 (0)