Finish migration from int64 durations to durationpb (#7147)
This is a cleanup PR finishing the migration from int64 durations to protobuf `*durationpb.Duration` by removing all usage of the old int64 fields. In the previous PR https://github.com/letsencrypt/boulder/pull/7146 all fields were switched to read from the protobuf durationpb fields. Fixes https://github.com/letsencrypt/boulder/issues/7097
This commit is contained in:
parent
6925fad324
commit
51e9f39259
5
ra/ra.go
5
ra/ra.go
|
@ -1496,9 +1496,8 @@ func (ra *RegistrationAuthorityImpl) checkCertificatesPerFQDNSetLimit(ctx contex
|
|||
}
|
||||
|
||||
prevIssuances, err := ra.SA.FQDNSetTimestampsForWindow(ctx, &sapb.CountFQDNSetsRequest{
|
||||
Domains: names,
|
||||
WindowNS: limit.Window.Duration.Nanoseconds(),
|
||||
Window: durationpb.New(limit.Window.Duration),
|
||||
Domains: names,
|
||||
Window: durationpb.New(limit.Window.Duration),
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("checking duplicate certificate limit for %q: %s", names, err)
|
||||
|
|
1128
sa/proto/sa.pb.go
1128
sa/proto/sa.pb.go
File diff suppressed because it is too large
Load Diff
|
@ -191,7 +191,7 @@ message CountOrdersRequest {
|
|||
|
||||
message CountFQDNSetsRequest {
|
||||
// Next unused field number: 4
|
||||
int64 windowNS = 1;
|
||||
reserved 1; // Previously windowNS
|
||||
repeated string domains = 2;
|
||||
google.protobuf.Duration window = 3;
|
||||
}
|
||||
|
|
|
@ -876,20 +876,17 @@ func TestFQDNSets(t *testing.T) {
|
|||
|
||||
// Invalid Window
|
||||
req := &sapb.CountFQDNSetsRequest{
|
||||
Domains: names,
|
||||
WindowNS: 0,
|
||||
Window: nil,
|
||||
Domains: names,
|
||||
Window: nil,
|
||||
}
|
||||
_, err = sa.CountFQDNSets(ctx, req)
|
||||
test.AssertErrorIs(t, err, errIncompleteRequest)
|
||||
|
||||
threeHours := time.Hour * 3
|
||||
req = &sapb.CountFQDNSetsRequest{
|
||||
Domains: names,
|
||||
WindowNS: threeHours.Nanoseconds(),
|
||||
Window: durationpb.New(threeHours),
|
||||
Domains: names,
|
||||
Window: durationpb.New(threeHours),
|
||||
}
|
||||
test.AssertEquals(t, time.Duration(req.WindowNS), req.Window.AsDuration())
|
||||
// only one valid
|
||||
count, err := sa.CountFQDNSets(ctx, req)
|
||||
test.AssertNotError(t, err, "Failed to count name sets")
|
||||
|
@ -945,20 +942,17 @@ func TestFQDNSetTimestampsForWindow(t *testing.T) {
|
|||
|
||||
// Invalid Window
|
||||
req := &sapb.CountFQDNSetsRequest{
|
||||
Domains: names,
|
||||
WindowNS: 0,
|
||||
Window: nil,
|
||||
Domains: names,
|
||||
Window: nil,
|
||||
}
|
||||
_, err = sa.FQDNSetTimestampsForWindow(ctx, req)
|
||||
test.AssertErrorIs(t, err, errIncompleteRequest)
|
||||
|
||||
window := time.Hour * 3
|
||||
req = &sapb.CountFQDNSetsRequest{
|
||||
Domains: names,
|
||||
WindowNS: window.Nanoseconds(),
|
||||
Window: durationpb.New(window),
|
||||
Domains: names,
|
||||
Window: durationpb.New(window),
|
||||
}
|
||||
test.AssertEquals(t, time.Duration(req.WindowNS), req.Window.AsDuration())
|
||||
|
||||
// Ensure zero issuance has occurred for names.
|
||||
resp, err := sa.FQDNSetTimestampsForWindow(ctx, req)
|
||||
|
|
Loading…
Reference in New Issue