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

certdb/sql: remove uses of github.com/stretchr/testify/require #1256

Merged
merged 1 commit into from
Aug 1, 2023
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
28 changes: 20 additions & 8 deletions certdb/sql/sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package sql

import (
"math"
"reflect"
"testing"
"time"

"github.com/cloudflare/cfssl/certdb"
"github.com/cloudflare/cfssl/certdb/testdb"

"github.com/jmoiron/sqlx"
"github.com/stretchr/testify/require"
)

const (
Expand Down Expand Up @@ -95,8 +95,13 @@ func testInsertCertificateAndGetCertificate(ta TestAccessor, t *testing.T) {
t.Errorf("want Certificate %+v, got %+v", want, got)
}
gotMeta, err := got.GetMetadata()
require.NoError(t, err)
require.Equal(t, map[string]interface{}{"k": "v"}, gotMeta)
if err != nil {
t.Fatal(err)
}
expected := map[string]interface{}{"k": "v"}
if !reflect.DeepEqual(gotMeta, expected) {
t.Fatalf("expected: %+v, got: %+v", expected, gotMeta)
}

unexpired, err := ta.Accessor.GetUnexpiredCertificates()

Expand Down Expand Up @@ -156,12 +161,19 @@ func testInsertCertificateAndGetUnexpiredCertificate(ta TestAccessor, t *testing
}

unexpiredFiltered, err := ta.Accessor.GetUnexpiredCertificatesByLabel([]string{"foo"})
require.NoError(t, err)
require.Len(t, unexpiredFiltered, 1)
if err != nil {
t.Fatal(err)
}
if l := len(unexpiredFiltered); l != 1 {
t.Error("Should have 1 unexpiredFiltered certificate record:", l)
}
unexpiredFiltered, err = ta.Accessor.GetUnexpiredCertificatesByLabel([]string{"bar"})
require.NoError(t, err)
require.Len(t, unexpiredFiltered, 0)

if err != nil {
t.Fatal(err)
}
if l := len(unexpiredFiltered); l != 0 {
t.Error("Should have 0 unexpiredFiltered certificate record:", l)
}
}
func testInsertCertificateAndGetUnexpiredCertificateNullCommonName(ta TestAccessor, t *testing.T) {
ta.Truncate()
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
github.com/lib/pq v1.10.9
github.com/mattn/go-sqlite3 v1.14.17
github.com/prometheus/client_golang v1.16.0
github.com/stretchr/testify v1.8.4
github.com/zmap/zcrypto v0.0.0-20230310154051-c8b263fd8300
github.com/zmap/zlint/v3 v3.5.0
golang.org/x/crypto v0.10.0
Expand All @@ -23,24 +22,22 @@ require (
require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/getsentry/sentry-go v0.11.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/kylelemons/go-gypsy v1.0.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/weppos/publicsuffix-go v0.30.0 // indirect
github.com/ziutek/mymysql v1.5.4 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/text v0.10.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
)
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,6 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
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=
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=
Expand Down
10 changes: 6 additions & 4 deletions signer/local/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ import (
"github.com/cloudflare/cfssl/helpers"
"github.com/cloudflare/cfssl/log"
"github.com/cloudflare/cfssl/signer"
"github.com/stretchr/testify/require"

ct "github.com/google/certificate-transparency-go"
"github.com/zmap/zlint/v3/lint"
)
Expand Down Expand Up @@ -1622,13 +1620,17 @@ func TestLint(t *testing.T) {
} else if err != nil && tc.expectedErr != nil {
actual := err.Error()
expected := tc.expectedErr.Error()
require.Equal(t, expected, actual)
if expected != actual {
t.Fatalf("expected: %v, got: %v", expected, actual)
}
if len(tc.expectedErrResults) > 0 {
le, ok := err.(*LintError)
if !ok {
t.Fatalf("expected LintError type err, got %v", err)
}
require.EqualValues(t, tc.expectedErrResults, le.ErrorResults)
if !reflect.DeepEqual(tc.expectedErrResults, le.ErrorResults) {
t.Fatalf("expected: %v, got: %v", tc.expectedErrResults, le.ErrorResults)
}
}
}
})
Expand Down
15 changes: 0 additions & 15 deletions vendor/github.com/davecgh/go-spew/LICENSE

This file was deleted.

145 changes: 0 additions & 145 deletions vendor/github.com/davecgh/go-spew/spew/bypass.go

This file was deleted.

38 changes: 0 additions & 38 deletions vendor/github.com/davecgh/go-spew/spew/bypasssafe.go

This file was deleted.

Loading
Loading