Skip to content
Open
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
8 changes: 0 additions & 8 deletions mocks/sa.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,6 @@ func (sa *StorageAuthorityReadOnly) GetOrderForNames(_ context.Context, _ *sapb.
return nil, nil
}

func (sa *StorageAuthorityReadOnly) CountPendingAuthorizations2(ctx context.Context, req *sapb.RegistrationID, _ ...grpc.CallOption) (*sapb.Count, error) {
return &sapb.Count{}, nil
}

func (sa *StorageAuthorityReadOnly) GetValidOrderAuthorizations2(ctx context.Context, req *sapb.GetOrderAuthorizationsRequest, _ ...grpc.CallOption) (*sapb.Authorizations, error) {
return nil, nil
}
Expand All @@ -323,10 +319,6 @@ func (sa *StorageAuthorityReadOnly) GetOrderAuthorizations(ctx context.Context,
return nil, nil
}

func (sa *StorageAuthorityReadOnly) CountInvalidAuthorizations2(ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest, _ ...grpc.CallOption) (*sapb.Count, error) {
return &sapb.Count{}, nil
}

func (sa *StorageAuthorityReadOnly) GetValidAuthorizations2(ctx context.Context, req *sapb.GetValidAuthorizationsRequest, _ ...grpc.CallOption) (*sapb.Authorizations, error) {
if req.RegistrationID != 1 && req.RegistrationID != 5 && req.RegistrationID != 4 {
return &sapb.Authorizations{}, nil
Expand Down
933 changes: 453 additions & 480 deletions sa/proto/sa.pb.go

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions sa/proto/sa.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import "google/protobuf/duration.proto";

// StorageAuthorityReadOnly exposes only those SA methods which are read-only.
service StorageAuthorityReadOnly {
rpc CountInvalidAuthorizations2(CountInvalidAuthorizationsRequest) returns (Count) {}
rpc CountPendingAuthorizations2(RegistrationID) returns (Count) {}
rpc FQDNSetExists(FQDNSetExistsRequest) returns (Exists) {}
rpc FQDNSetTimestampsForWindow(CountFQDNSetsRequest) returns (Timestamps) {}
rpc GetAuthorization2(AuthorizationID2) returns (core.Authorization) {}
Expand Down Expand Up @@ -43,8 +41,6 @@ service StorageAuthorityReadOnly {
// StorageAuthority provides full read/write access to the database.
service StorageAuthority {
// Getters: this list must be identical to the StorageAuthorityReadOnly rpcs.
rpc CountInvalidAuthorizations2(CountInvalidAuthorizationsRequest) returns (Count) {}
rpc CountPendingAuthorizations2(RegistrationID) returns (Count) {}
rpc FQDNSetExists(FQDNSetExistsRequest) returns (Exists) {}
rpc FQDNSetTimestampsForWindow(CountFQDNSetsRequest) returns (Timestamps) {}
rpc GetAuthorization2(AuthorizationID2) returns (core.Authorization) {}
Expand Down
152 changes: 0 additions & 152 deletions sa/proto/sa_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 0 additions & 66 deletions sa/sa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2364,40 +2364,6 @@ func TestRehydrateHostPort(t *testing.T) {
test.AssertError(t, err, "URL field cannot be empty")
}

func TestCountPendingAuthorizations2(t *testing.T) {
sa, fc := initSA(t)

reg := createWorkingRegistration(t, sa)
expiresA := fc.Now().Add(time.Hour).UTC()
expiresB := fc.Now().Add(time.Hour * 3).UTC()
_ = createPendingAuthorization(t, sa, reg.Id, identifier.NewDNS("example.com"), expiresA)
_ = createPendingAuthorization(t, sa, reg.Id, identifier.NewDNS("example.com"), expiresB)

// Registration has two new style pending authorizations
regID := reg.Id
count, err := sa.CountPendingAuthorizations2(context.Background(), &sapb.RegistrationID{
Id: regID,
})
test.AssertNotError(t, err, "sa.CountPendingAuthorizations2 failed")
test.AssertEquals(t, count.Count, int64(2))

// Registration has two new style pending authorizations, one of which has expired
fc.Add(time.Hour * 2)
count, err = sa.CountPendingAuthorizations2(context.Background(), &sapb.RegistrationID{
Id: regID,
})
test.AssertNotError(t, err, "sa.CountPendingAuthorizations2 failed")
test.AssertEquals(t, count.Count, int64(1))

// Registration with no authorizations should be 0
noReg := reg.Id + 100
count, err = sa.CountPendingAuthorizations2(context.Background(), &sapb.RegistrationID{
Id: noReg,
})
test.AssertNotError(t, err, "sa.CountPendingAuthorizations2 failed")
test.AssertEquals(t, count.Count, int64(0))
}

func TestAuthzModelMapToPB(t *testing.T) {
baseExpires := time.Now()
input := map[identifier.ACMEIdentifier]authzModel{
Expand Down Expand Up @@ -2554,38 +2520,6 @@ func TestGetOrderAuthorizations(t *testing.T) {
}
}

func TestCountInvalidAuthorizations2(t *testing.T) {
sa, fc := initSA(t)

fc.Add(time.Hour)
reg := createWorkingRegistration(t, sa)
idents := identifier.ACMEIdentifiers{
identifier.NewDNS("aaa"),
identifier.NewIP(netip.MustParseAddr("10.10.10.10")),
}
for _, ident := range idents {
// Create two authorizations, one pending, one invalid
expiresA := fc.Now().Add(time.Hour).UTC()
expiresB := fc.Now().Add(time.Hour * 3).UTC()
attemptedAt := fc.Now()
_ = createFinalizedAuthorization(t, sa, reg.Id, ident, expiresA, "invalid", attemptedAt)
_ = createPendingAuthorization(t, sa, reg.Id, ident, expiresB)

earliest := fc.Now().Add(-time.Hour).UTC()
latest := fc.Now().Add(time.Hour * 5).UTC()
count, err := sa.CountInvalidAuthorizations2(context.Background(), &sapb.CountInvalidAuthorizationsRequest{
RegistrationID: reg.Id,
Identifier: ident.ToProto(),
Range: &sapb.Range{
Earliest: timestamppb.New(earliest),
Latest: timestamppb.New(latest),
},
})
test.AssertNotError(t, err, "sa.CountInvalidAuthorizations2 failed")
test.AssertEquals(t, count.Count, int64(1))
}
}

func TestGetValidAuthorizations2(t *testing.T) {
sa, fc := initSA(t)

Expand Down
Loading
Loading