Skip to content

Commit

Permalink
Fix more lints
Browse files Browse the repository at this point in the history
  • Loading branch information
pgporada committed Feb 16, 2024
1 parent 4a79b84 commit 38549bf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ca/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func makeCertificateProfilesMap(origProfile *issuance.Profile, certProfiles []*i
if profilesByName[profile.Name()] == nil {
profilesByName[profile.Name()] = profile
} else {
return nil, errors.New(fmt.Sprintf("duplicate certificate profile name %+v", profile))
return nil, fmt.Errorf("duplicate certificate profile name %+v", profile)
}
}

Expand Down
20 changes: 12 additions & 8 deletions ca/ca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,11 @@ func TestProfiles(t *testing.T) {
// existence of both profile and certProfiles without a duplicate name (the
// happy path).
testCases := []struct {
name string
profile *issuance.Profile
certProfiles []*issuance.Profile
expectErrSubstr string
name string
profile *issuance.Profile
certProfiles []*issuance.Profile
expectErrSubstr string
expectProfileName string
}{
{
name: "both empty",
Expand All @@ -540,9 +541,10 @@ func TestProfiles(t *testing.T) {
expectErrSubstr: "at least one certificate profile",
},
{
name: "no certProfiles",
profile: ctx.profile,
certProfiles: nil,
name: "no certProfiles",
profile: ctx.profile,
certProfiles: nil,
expectProfileName: "defaultCertificateProfileName",
},
{
name: "both exist, but have a duplicate profile name",
Expand All @@ -554,7 +556,7 @@ func TestProfiles(t *testing.T) {

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
_, err := NewCertificateAuthorityImpl(
tCA, err := NewCertificateAuthorityImpl(
sa,
ctx.pa,
ctx.boulderIssuers,
Expand All @@ -578,6 +580,8 @@ func TestProfiles(t *testing.T) {
test.AssertError(t, err, "No profile found during CA construction.")
} else {
test.AssertNotError(t, err, "Profiles should exist, but were not found")
err = tCA.certificateProfileExists(tc.expectProfileName)
test.AssertNotError(t, err, "Profile name not found in map")
}
})
}
Expand Down

0 comments on commit 38549bf

Please sign in to comment.