Skip to content

Commit

Permalink
Enable querying ReportedErrorEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBergmeier6176 committed Aug 30, 2023
1 parent 430891d commit e92ca43
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/gcp/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type server struct {
listener net.Listener
grpcServer *grpc.Server
psServerConn *grpc.ClientConn
fes *fakeErrorreportingServer
}

func MustMakeTestServices(ctx context.Context, project, serviceName string) *server {
Expand All @@ -41,7 +42,8 @@ func MustMakeTestServices(ctx context.Context, project, serviceName string) *ser
}

grpcServer := grpc.NewServer()
errorreportingpb.RegisterReportErrorsServiceServer(grpcServer, &fakeErrorreportingServer{})
fes := &fakeErrorreportingServer{}
errorreportingpb.RegisterReportErrorsServiceServer(grpcServer, fes)
loggingpb.RegisterLoggingServiceV2Server(grpcServer, loggingServer)
fakeServerAddr := l.Addr().String()

Expand Down Expand Up @@ -98,9 +100,14 @@ func MustMakeTestServices(ctx context.Context, project, serviceName string) *ser
PubSubServer: psServer,
listener: l,
grpcServer: grpcServer,
fes: fes,
}
}

func (s *server) ReportedErrorEvents() []*errorreportingpb.ReportedErrorEvent {
return s.fes.ReportedEvents
}

func (s *server) Close() error {
// Ignore close errors because usually
// we are not that particular about testing
Expand Down

0 comments on commit e92ca43

Please sign in to comment.