chore: remove gotest.tools/assert (#58899)

We use github.com/stretchr/testify pretty much universally except for some odd edge cases. This makes VSCode turn up inconsistent package recommendations on auto-import.
This commit is contained in:
Robert Lin 2023-12-12 12:01:12 -08:00 committed by GitHub
parent 4be1fbfb15
commit 42417a0bff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 25 additions and 35 deletions

View File

@ -65,7 +65,7 @@ go_test(
"@com_github_crewjam_saml_samlidp//:samlidp",
"@com_github_russellhaering_gosaml2//:gosaml2",
"@com_github_russellhaering_goxmldsig//:goxmldsig",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@tools_gotest//assert",
],
)

View File

@ -11,8 +11,8 @@ import (
saml2 "github.com/russellhaering/gosaml2"
dsig "github.com/russellhaering/goxmldsig"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gotest.tools/assert"
"github.com/sourcegraph/sourcegraph/internal/extsvc"
)
@ -127,7 +127,7 @@ func TestGetPublicExternalAccountData(t *testing.T) {
require.NoError(t, err)
}
assert.DeepEqual(t, tc.expected, publicData)
assert.Equal(t, tc.expected, publicData)
})
}
}

View File

@ -37,7 +37,7 @@ go_test(
"//internal/database/dbtest",
"//internal/types",
"@com_github_sourcegraph_log//logtest",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@tools_gotest//assert",
],
)

View File

@ -6,8 +6,8 @@ import (
"testing"
"github.com/sourcegraph/log/logtest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gotest.tools/assert"
"github.com/sourcegraph/sourcegraph/cmd/gitserver/internal/common"
"github.com/sourcegraph/sourcegraph/internal/api"

View File

@ -64,6 +64,5 @@ go_test(
"@com_github_sourcegraph_log//logtest",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@tools_gotest//assert",
],
)

View File

@ -4,7 +4,7 @@ import (
"os/exec"
"testing"
"gotest.tools/assert"
"github.com/stretchr/testify/assert"
)
func TestSpecifyCommandInErrorMessage(t *testing.T) {

View File

@ -22,7 +22,7 @@ go_test(
":events",
"//internal/pubsub/pubsubtest",
"//internal/telemetrygateway/v1:telemetrygateway",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@tools_gotest//assert",
],
)

View File

@ -8,8 +8,8 @@ import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gotest.tools/assert"
"github.com/sourcegraph/sourcegraph/cmd/telemetry-gateway/internal/events"
"github.com/sourcegraph/sourcegraph/internal/pubsub/pubsubtest"

1
go.mod
View File

@ -605,7 +605,6 @@ require (
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gorm.io/driver/postgres v1.5.4
gotest.tools v2.2.0+incompatible
k8s.io/klog/v2 v2.80.0 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
mvdan.cc/gofumpt v0.4.0 // indirect

View File

@ -37,7 +37,7 @@ go_test(
"//internal/types",
"//schema",
"@com_github_sourcegraph_log//logtest",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@tools_gotest//assert",
],
)

View File

@ -9,8 +9,8 @@ import (
"testing"
"github.com/sourcegraph/log/logtest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gotest.tools/assert"
"github.com/sourcegraph/sourcegraph/internal/conf"
"github.com/sourcegraph/sourcegraph/internal/database"

View File

@ -336,7 +336,6 @@ go_test(
"@org_golang_x_exp//maps",
"@org_golang_x_exp//slices",
"@org_golang_x_sync//errgroup",
"@tools_gotest//assert",
],
)

View File

@ -6,8 +6,8 @@ import (
"time"
"github.com/sourcegraph/log/logtest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gotest.tools/assert"
"github.com/sourcegraph/sourcegraph/internal/database/dbtest"
"github.com/sourcegraph/sourcegraph/internal/types"
@ -114,7 +114,7 @@ func TestQueryIndividualCountsAggregation(t *testing.T) {
{CodeownersReference: "ownerA", CodeownedFileCount: 1},
{CodeownersReference: "ownerB", CodeownedFileCount: 1},
}
assert.DeepEqual(t, want, got)
assert.Equal(t, want, got)
})
t.Run("query single repo", func(t *testing.T) {
opts := TreeLocationOpts{
@ -127,7 +127,7 @@ func TestQueryIndividualCountsAggregation(t *testing.T) {
{CodeownersReference: "ownerA", CodeownedFileCount: 2},
{CodeownersReference: "ownerB", CodeownedFileCount: 1},
}
assert.DeepEqual(t, want, got)
assert.Equal(t, want, got)
})
t.Run("query whole instance", func(t *testing.T) {
opts := TreeLocationOpts{}
@ -139,7 +139,7 @@ func TestQueryIndividualCountsAggregation(t *testing.T) {
{CodeownersReference: "ownerC", CodeownedFileCount: 10}, // only repo2
{CodeownersReference: "ownerB", CodeownedFileCount: 1}, // only repo1
}
assert.DeepEqual(t, want, got)
assert.Equal(t, want, got)
})
}
@ -218,7 +218,7 @@ func TestQueryAggregateCounts(t *testing.T) {
got, err := db.OwnershipStats().QueryAggregateCounts(ctx, opts)
require.NoError(t, err)
want := PathAggregateCounts{CodeownedFileCount: 0}
assert.DeepEqual(t, want, got)
assert.Equal(t, want, got)
})
t.Run("no data - query all", func(t *testing.T) {
@ -226,7 +226,7 @@ func TestQueryAggregateCounts(t *testing.T) {
got, err := db.OwnershipStats().QueryAggregateCounts(ctx, opts)
require.NoError(t, err)
want := PathAggregateCounts{CodeownedFileCount: 0}
assert.DeepEqual(t, want, got)
assert.Equal(t, want, got)
})
// 2. Insert aggregate counts:
@ -275,7 +275,7 @@ func TestQueryAggregateCounts(t *testing.T) {
TotalOwnedFileCount: 1,
UpdatedAt: timestamp,
}
assert.DeepEqual(t, want, got)
assert.Equal(t, want, got)
})
t.Run("query single dir", func(t *testing.T) {
@ -291,7 +291,7 @@ func TestQueryAggregateCounts(t *testing.T) {
TotalOwnedFileCount: 2,
UpdatedAt: timestamp,
}
assert.DeepEqual(t, want, got)
assert.Equal(t, want, got)
})
t.Run("query repo root", func(t *testing.T) {
@ -306,7 +306,7 @@ func TestQueryAggregateCounts(t *testing.T) {
TotalOwnedFileCount: 2,
UpdatedAt: timestamp,
}
assert.DeepEqual(t, want, got)
assert.Equal(t, want, got)
})
t.Run("query whole instance", func(t *testing.T) {
@ -319,7 +319,7 @@ func TestQueryAggregateCounts(t *testing.T) {
TotalOwnedFileCount: 12,
UpdatedAt: timestamp,
}
assert.DeepEqual(t, want, got)
assert.Equal(t, want, got)
})
t.Run("query whole instance with excluded repo in signal config", func(t *testing.T) {
@ -334,6 +334,6 @@ func TestQueryAggregateCounts(t *testing.T) {
TotalOwnedFileCount: 2,
UpdatedAt: timestamp,
}
assert.DeepEqual(t, want, got)
assert.Equal(t, want, got)
})
}

View File

@ -57,6 +57,5 @@ go_test(
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@org_golang_x_time//rate",
"@tools_gotest//assert",
],
)

View File

@ -13,9 +13,9 @@ import (
"time"
"github.com/dnaeon/go-vcr/cassette"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/time/rate"
"gotest.tools/assert"
"github.com/sourcegraph/sourcegraph/internal/extsvc/auth"
"github.com/sourcegraph/sourcegraph/internal/httpcli"

View File

@ -74,6 +74,5 @@ go_test(
"@com_github_elimity_com_scim//errors",
"@com_github_scim2_filter_parser_v2//:filter-parser",
"@com_github_stretchr_testify//assert",
"@tools_gotest//assert",
],
)

View File

@ -8,7 +8,7 @@ import (
"testing"
"time"
"gotest.tools/assert"
"github.com/stretchr/testify/assert"
"github.com/sourcegraph/sourcegraph/internal/conf"
"github.com/sourcegraph/sourcegraph/internal/database"

View File

@ -37,7 +37,6 @@ require (
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools v2.2.0+incompatible
)
require (

View File

@ -542,8 +542,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
gopkg.in/yaml.v3 v3.0.0/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/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0=
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=

View File

@ -449,6 +449,5 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
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=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

View File

@ -13,7 +13,7 @@ go_test(
srcs = ["ptr_test.go"],
embed = [":pointers"],
deps = [
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@tools_gotest//assert",
],
)

View File

@ -3,8 +3,8 @@ package pointers
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gotest.tools/assert"
)
func TestPtr(t *testing.T) {

View File

@ -642,7 +642,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=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=