Skip to content

Commit

Permalink
Merge 75a9639 into 6b3a6d1
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongable committed Mar 10, 2021
2 parents 6b3a6d1 + 75a9639 commit b9915c8
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 129 deletions.
3 changes: 1 addition & 2 deletions cmd/boulder-publisher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ func main() {
serverMetrics := bgrpc.NewServerMetrics(scope)
grpcSrv, l, err := bgrpc.NewServer(c.Publisher.GRPC, tlsConfig, serverMetrics, clk)
cmd.FailOnError(err, "Unable to setup Publisher gRPC server")
gw := bgrpc.NewPublisherServerWrapper(pubi)
pubpb.RegisterPublisherServer(grpcSrv, gw)
pubpb.RegisterPublisherServer(grpcSrv, pubi)
hs := health.NewServer()
healthpb.RegisterHealthServer(grpcSrv, hs)

Expand Down
2 changes: 1 addition & 1 deletion cmd/boulder-ra/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func main() {
var ctp *ctpolicy.CTPolicy
conn, err := bgrpc.ClientSetup(c.RA.PublisherService, tlsConfig, clientMetrics, clk)
cmd.FailOnError(err, "Failed to load credentials and create gRPC connection to Publisher")
pubc := bgrpc.NewPublisherClientWrapper(pubpb.NewPublisherClient(conn))
pubc := pubpb.NewPublisherClient(conn)

apConn, err := bgrpc.ClientSetup(c.RA.AkamaiPurgerService, tlsConfig, clientMetrics, clk)
cmd.FailOnError(err, "Unable to create a Akamai Purger client")
Expand Down
6 changes: 0 additions & 6 deletions core/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
capb "github.com/letsencrypt/boulder/ca/proto"
corepb "github.com/letsencrypt/boulder/core/proto"
"github.com/letsencrypt/boulder/identifier"
pubpb "github.com/letsencrypt/boulder/publisher/proto"
rapb "github.com/letsencrypt/boulder/ra/proto"
"github.com/letsencrypt/boulder/revocation"
sapb "github.com/letsencrypt/boulder/sa/proto"
Expand Down Expand Up @@ -169,8 +168,3 @@ type StorageAuthority interface {
StorageGetter
StorageAdder
}

// Publisher defines the public interface for the Boulder Publisher
type Publisher interface {
SubmitToSingleCTWithResult(ctx context.Context, req *pubpb.Request) (*pubpb.Result, error)
}
4 changes: 2 additions & 2 deletions ctpolicy/ctpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
// CTPolicy is used to hold information about SCTs required from various
// groupings
type CTPolicy struct {
pub core.Publisher
pub pubpb.PublisherClient
groups []ctconfig.CTGroup
informational []ctconfig.LogDescription
finalLogs []ctconfig.LogDescription
Expand All @@ -28,7 +28,7 @@ type CTPolicy struct {
}

// New creates a new CTPolicy struct
func New(pub core.Publisher,
func New(pub pubpb.PublisherClient,
groups []ctconfig.CTGroup,
informational []ctconfig.LogDescription,
log blog.Logger,
Expand Down
13 changes: 7 additions & 6 deletions ctpolicy/ctpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@ import (
pubpb "github.com/letsencrypt/boulder/publisher/proto"
"github.com/letsencrypt/boulder/test"
"github.com/prometheus/client_golang/prometheus"
"google.golang.org/grpc"
)

type mockPub struct {
}

func (mp *mockPub) SubmitToSingleCTWithResult(_ context.Context, _ *pubpb.Request) (*pubpb.Result, error) {
func (mp *mockPub) SubmitToSingleCTWithResult(_ context.Context, _ *pubpb.Request, _ ...grpc.CallOption) (*pubpb.Result, error) {
return &pubpb.Result{Sct: []byte{0}}, nil
}

type alwaysFail struct {
mockPub
}

func (mp *alwaysFail) SubmitToSingleCTWithResult(_ context.Context, _ *pubpb.Request) (*pubpb.Result, error) {
func (mp *alwaysFail) SubmitToSingleCTWithResult(_ context.Context, _ *pubpb.Request, _ ...grpc.CallOption) (*pubpb.Result, error) {
return nil, errors.New("BAD")
}

Expand All @@ -39,7 +40,7 @@ func TestGetSCTs(t *testing.T) {
missingSCTErr := berrors.MissingSCTs
testCases := []struct {
name string
mock core.Publisher
mock pubpb.PublisherClient
groups []ctconfig.CTGroup
ctx context.Context
result core.SCTDERs
Expand Down Expand Up @@ -139,7 +140,7 @@ type failOne struct {
badURL string
}

func (mp *failOne) SubmitToSingleCTWithResult(_ context.Context, req *pubpb.Request) (*pubpb.Result, error) {
func (mp *failOne) SubmitToSingleCTWithResult(_ context.Context, req *pubpb.Request, _ ...grpc.CallOption) (*pubpb.Result, error) {
if req.LogURL == mp.badURL {
return nil, errors.New("BAD")
}
Expand All @@ -150,7 +151,7 @@ type slowPublisher struct {
mockPub
}

func (sp *slowPublisher) SubmitToSingleCTWithResult(_ context.Context, req *pubpb.Request) (*pubpb.Result, error) {
func (sp *slowPublisher) SubmitToSingleCTWithResult(_ context.Context, req *pubpb.Request, _ ...grpc.CallOption) (*pubpb.Result, error) {
time.Sleep(time.Second)
return &pubpb.Result{Sct: []byte{0}}, nil
}
Expand Down Expand Up @@ -219,7 +220,7 @@ type countEm struct {
count int
}

func (ce *countEm) SubmitToSingleCTWithResult(_ context.Context, _ *pubpb.Request) (*pubpb.Result, error) {
func (ce *countEm) SubmitToSingleCTWithResult(_ context.Context, _ *pubpb.Request, _ ...grpc.CallOption) (*pubpb.Result, error) {
ce.count++
return &pubpb.Result{Sct: []byte{0}}, nil
}
Expand Down
52 changes: 0 additions & 52 deletions grpc/publisher-wrappers.go

This file was deleted.

5 changes: 3 additions & 2 deletions mocks/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"

"github.com/jmhodges/clock"
"google.golang.org/grpc"
jose "gopkg.in/square/go-jose.v2"

"github.com/letsencrypt/boulder/core"
Expand Down Expand Up @@ -690,12 +691,12 @@ func (sa *StorageAuthority) KeyBlocked(ctx context.Context, req *sapb.KeyBlocked
}

// Publisher is a mock
type Publisher struct {
type PublisherClient struct {
// empty
}

// SubmitToSingleCTWithResult is a mock
func (*Publisher) SubmitToSingleCTWithResult(_ context.Context, _ *pubpb.Request) (*pubpb.Result, error) {
func (*PublisherClient) SubmitToSingleCTWithResult(_ context.Context, _ *pubpb.Request, _ ...grpc.CallOption) (*pubpb.Result, error) {
return nil, nil
}

Expand Down
3 changes: 0 additions & 3 deletions publisher/mock_publisher/gen.go

This file was deleted.

50 changes: 0 additions & 50 deletions publisher/mock_publisher/mock_publisher.go

This file was deleted.

5 changes: 3 additions & 2 deletions ra/ra.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/letsencrypt/boulder/metrics"
"github.com/letsencrypt/boulder/policy"
"github.com/letsencrypt/boulder/probs"
pubpb "github.com/letsencrypt/boulder/publisher/proto"
rapb "github.com/letsencrypt/boulder/ra/proto"
"github.com/letsencrypt/boulder/ratelimit"
"github.com/letsencrypt/boulder/reloader"
Expand Down Expand Up @@ -62,7 +63,7 @@ type RegistrationAuthorityImpl struct {
VA vapb.VAClient
SA core.StorageAuthority
PA core.PolicyAuthority
publisher core.Publisher
publisher pubpb.PublisherClient
caa caaChecker

clk clock.Clock
Expand Down Expand Up @@ -103,7 +104,7 @@ func NewRegistrationAuthorityImpl(
reuseValidAuthz bool,
authorizationLifetime time.Duration,
pendingAuthorizationLifetime time.Duration,
pubc core.Publisher,
pubc pubpb.PublisherClient,
caaClient caaChecker,
orderLifetime time.Duration,
ctp *ctpolicy.CTPolicy,
Expand Down
4 changes: 2 additions & 2 deletions ra/ra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func initAuthorities(t *testing.T) (*DummyValidationAuthority, *sa.SQLStorageAut
Status: core.StatusValid,
})

ctp := ctpolicy.New(&mocks.Publisher{}, nil, nil, log, metrics.NoopRegisterer)
ctp := ctpolicy.New(&mocks.PublisherClient{}, nil, nil, log, metrics.NoopRegisterer)

ra := NewRegistrationAuthorityImpl(fc,
log,
Expand Down Expand Up @@ -3447,7 +3447,7 @@ func TestPerformValidationBadChallengeType(t *testing.T) {
type timeoutPub struct {
}

func (mp *timeoutPub) SubmitToSingleCTWithResult(_ context.Context, _ *pubpb.Request) (*pubpb.Result, error) {
func (mp *timeoutPub) SubmitToSingleCTWithResult(_ context.Context, _ *pubpb.Request, _ ...grpc.CallOption) (*pubpb.Result, error) {
return nil, context.DeadlineExceeded
}

Expand Down
2 changes: 1 addition & 1 deletion wfe/wfe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ func TestIssueCertificate(t *testing.T) {
// authorized, etc.
stats := metrics.NoopRegisterer

ctp := ctpolicy.New(&mocks.Publisher{}, nil, nil, wfe.log, metrics.NoopRegisterer)
ctp := ctpolicy.New(&mocks.PublisherClient{}, nil, nil, wfe.log, metrics.NoopRegisterer)
ra := ra.NewRegistrationAuthorityImpl(
fc,
wfe.log,
Expand Down

0 comments on commit b9915c8

Please sign in to comment.