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

[chore]: enable go-require rule from testifylint #6140

Merged
merged 1 commit into from
Sep 24, 2024
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
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,4 @@ linters-settings:
- expected-actual
- float-compare
- formatter
- go-require
- require-error
2 changes: 1 addition & 1 deletion exporters/autoexport/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestRegistryIsConcurrentSafe(t *testing.T) {
wg.Add(1)
go func() {
defer wg.Done()
require.ErrorIs(t, r.store(exporterName, factory("stdout")), errDuplicateRegistration)
assert.ErrorIs(t, r.store(exporterName, factory("stdout")), errDuplicateRegistration)
}()

wg.Add(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1509,12 +1509,12 @@ func TestStatsHandlerConcurrentSafeContextCancellation(t *testing.T) {
}
err := stream.Send(req)
if errors.Is(err, io.EOF) { // possible due to context cancellation
require.ErrorIs(t, ctx.Err(), context.Canceled)
assert.ErrorIs(t, ctx.Err(), context.Canceled)
} else {
require.NoError(t, err)
assert.NoError(t, err)
}
}
require.NoError(t, stream.CloseSend())
assert.NoError(t, stream.CloseSend())
}()

wg.Add(1)
Expand All @@ -1529,7 +1529,7 @@ func TestStatsHandlerConcurrentSafeContextCancellation(t *testing.T) {
if status.Code(err) == codes.Canceled {
return
}
require.NoError(t, err)
assert.NoError(t, err)
}
}()

Expand Down
2 changes: 1 addition & 1 deletion instrumentation/net/http/otelhttp/test/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func TestHandlerRequestWithTraceContext(t *testing.T) {
h := otelhttp.NewHandler(
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, err := w.Write([]byte("hello world"))
require.NoError(t, err)
assert.NoError(t, err)
}), "test_handler")

r, err := http.NewRequest(http.MethodGet, "http://localhost/", nil)
Expand Down
4 changes: 2 additions & 2 deletions instrumentation/net/http/otelhttp/test/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestTransportRequestWithTraceContext(t *testing.T) {

ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, err := w.Write(content)
require.NoError(t, err)
assert.NoError(t, err)
}))
defer ts.Close()

Expand Down Expand Up @@ -190,7 +190,7 @@ func TestWithHTTPTrace(t *testing.T) {

ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, err := w.Write(content)
require.NoError(t, err)
assert.NoError(t, err)
}))
defer ts.Close()

Expand Down
8 changes: 4 additions & 4 deletions instrumentation/net/http/otelhttp/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,12 @@ func TestTransportProtocolSwitch(t *testing.T) {

ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
conn, buf, err := w.(http.Hijacker).Hijack()
require.NoError(t, err)
assert.NoError(t, err)

_, err = buf.Write(response)
require.NoError(t, err)
require.NoError(t, buf.Flush())
require.NoError(t, conn.Close())
assert.NoError(t, err)
assert.NoError(t, buf.Flush())
assert.NoError(t, conn.Close())
}))
defer ts.Close()

Expand Down
2 changes: 1 addition & 1 deletion samplers/aws/xray/internal/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
func createTestClient(t *testing.T, body []byte) *xrayClient {
testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, _ *http.Request) {
_, err := res.Write(body)
require.NoError(t, err)
assert.NoError(t, err)
}))
t.Cleanup(testServer.Close)

Expand Down
4 changes: 2 additions & 2 deletions samplers/aws/xray/internal/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,7 @@ func TestUpdatingRulesAndTargetsWhileMatchingConcurrentSafe(t *testing.T) {
manifest := m.deepCopy()

err := manifest.updateReservoir(createSamplingTargetDocument("r1", 0, 0.05, 10, 13000000))
require.NoError(t, err)
assert.NoError(t, err)
time.Sleep(time.Millisecond)

m.mu.Lock()
Expand Down Expand Up @@ -1827,7 +1827,7 @@ func TestUpdatingSamplingStatisticsWhenSamplingConcurrentSafe(t *testing.T) {
manifest := m.deepCopy()

_, err := manifest.snapshots()
require.NoError(t, err)
assert.NoError(t, err)

m.mu.Lock()
m.Rules = manifest.Rules
Expand Down
2 changes: 1 addition & 1 deletion samplers/aws/xray/internal/rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ func TestUpdatingRulesAndTargetsWhileSamplingConcurrentSafe(t *testing.T) {
manifest := m.deepCopy()

err := manifest.updateReservoir(&st)
require.NoError(t, err)
assert.NoError(t, err)
time.Sleep(time.Millisecond)

m.mu.Lock()
Expand Down
Loading