Documentation ¶
Index ¶
- func GetPortNumber(base int) int
- type MockBuildloggerServer
- func (ms *MockBuildloggerServer) Address() string
- func (ms *MockBuildloggerServer) AppendLogLines(_ context.Context, in *gopb.LogLines) (*gopb.BuildloggerResponse, error)
- func (ms *MockBuildloggerServer) CloseLog(_ context.Context, in *gopb.LogEndInfo) (*gopb.BuildloggerResponse, error)
- func (ms *MockBuildloggerServer) CreateLog(_ context.Context, in *gopb.LogData) (*gopb.BuildloggerResponse, error)
- func (ms *MockBuildloggerServer) StreamLogLines(in gopb.Buildlogger_StreamLogLinesServer) error
- type MockCedarServer
- type MockHealthServer
- type MockTestResultsServer
- func (m *MockTestResultsServer) AddTestResults(_ context.Context, in *gopb.TestResults) (*gopb.TestResultsResponse, error)
- func (ms *MockTestResultsServer) Address() string
- func (m *MockTestResultsServer) CloseTestResultsRecord(_ context.Context, in *gopb.TestResultsEndInfo) (*gopb.TestResultsResponse, error)
- func (m *MockTestResultsServer) CreateTestResultsRecord(_ context.Context, in *gopb.TestResultsInfo) (*gopb.TestResultsResponse, error)
- func (ms *MockTestResultsServer) StreamTestResults(gopb.CedarTestResults_StreamTestResultsServer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPortNumber ¶
GetPortNumber returns a new port number that has not been used in the current runtime.
Types ¶
type MockBuildloggerServer ¶
type MockBuildloggerServer struct { Mu sync.Mutex CreateErr bool AppendErr bool CloseErr bool Create *gopb.LogData Data map[string][]*gopb.LogLines Close *gopb.LogEndInfo DialOpts timber.DialCedarOptions // UnimplementedBuildloggerServer must be embedded for forward // compatibility. See gopb.buildlogger_grpc.pb.go for more information. gopb.UnimplementedBuildloggerServer }
MockBuildloggerServer sets up a mock Cedar server for testing buildlogger logs using gRPC.
func NewMockBuildloggerServer ¶
func NewMockBuildloggerServer(ctx context.Context, basePort int) (*MockBuildloggerServer, error)
NewMockBuildloggerServer returns a new MockBuildloggerServer listening on a port near the provided port.
func NewMockBuildloggerServerWithDialOpts ¶
func NewMockBuildloggerServerWithDialOpts(ctx context.Context, opts timber.DialCedarOptions) (*MockBuildloggerServer, error)
NewMockBuildloggerServerWithDialOpts returns a new MockBuildloggerServer listening on the port and URL from the specified dial options.
func (*MockBuildloggerServer) Address ¶
func (ms *MockBuildloggerServer) Address() string
Address returns the address the server is listening on.
func (*MockBuildloggerServer) AppendLogLines ¶
func (ms *MockBuildloggerServer) AppendLogLines(_ context.Context, in *gopb.LogLines) (*gopb.BuildloggerResponse, error)
AppendLogLines returns an error if AppendErr is true, otherwise it adds the input to Data.
func (*MockBuildloggerServer) CloseLog ¶
func (ms *MockBuildloggerServer) CloseLog(_ context.Context, in *gopb.LogEndInfo) (*gopb.BuildloggerResponse, error)
CloseLog returns an error if CloseErr is true, otherwise it sets Close to the input.
func (*MockBuildloggerServer) CreateLog ¶
func (ms *MockBuildloggerServer) CreateLog(_ context.Context, in *gopb.LogData) (*gopb.BuildloggerResponse, error)
CreateLog returns an error if CreateErr is true, otherwise it sets Create to the input.
func (*MockBuildloggerServer) StreamLogLines ¶
func (ms *MockBuildloggerServer) StreamLogLines(in gopb.Buildlogger_StreamLogLinesServer) error
StreamLogLines returns a not implemented error.
type MockCedarServer ¶
type MockCedarServer struct { TestResults *MockTestResultsServer Buildlogger *MockBuildloggerServer Health *MockHealthServer DialOpts timber.DialCedarOptions }
MockCedarServer sets up a mock Cedar server for sending metrics, test results, and logs using gRPC.
func NewMockCedarServer ¶
func NewMockCedarServer(ctx context.Context, basePort int) (*MockCedarServer, error)
NewMockCedarServer will return a new MockCedarServer listening on a port near the provided port.
func NewMockCedarServerWithDialOpts ¶
func NewMockCedarServerWithDialOpts(ctx context.Context, opts timber.DialCedarOptions) (*MockCedarServer, error)
NewMockCedarServerWithDialOpts will return a new MockCedarServer listening on the port and URL from the specified dial options.
func (*MockCedarServer) Address ¶
func (ms *MockCedarServer) Address() string
Address returns the address the server is listening on.
type MockHealthServer ¶
type MockHealthServer struct { Mu sync.Mutex Status *gopb.HealthCheckResponse_ServingStatus Err bool DialOpts timber.DialCedarOptions // UnimplementedHealthServer must be embedded for forward // compatibility. See gopb.health_grpc.pb.go for more information. gopb.UnimplementedHealthServer }
MockHealthServer sets up a mock Cedar server for testing the health check gRPC route.
func NewMockHealthServer ¶
func NewMockHealthServer(ctx context.Context, basePort int) (*MockHealthServer, error)
NewMockHealthServer returns a new MockHealthServer listening on a port near near the provided port.
func NewMockHealthServerWithDialOpts ¶
func NewMockHealthServerWithDialOpts(ctx context.Context, opts timber.DialCedarOptions) (*MockHealthServer, error)
NewMockHealthServerWithDialOpts returns a new MockHealthServer listening on the port and URL from the specified dial options.
func (*MockHealthServer) Address ¶
func (ms *MockHealthServer) Address() string
Address returns the address the server is listening on.
func (*MockHealthServer) Check ¶
func (ms *MockHealthServer) Check(_ context.Context, in *gopb.HealthCheckRequest) (*gopb.HealthCheckResponse, error)
Check returns (in the following order of precedence) an error if Err is true, Status if it is not empty, and "SERVING" otherwise.
type MockTestResultsServer ¶
type MockTestResultsServer struct { CreateErr bool AddErr bool StreamErr bool CloseErr bool Create *gopb.TestResultsInfo Results map[string][]*gopb.TestResults StreamResults map[string][]*gopb.TestResults Close *gopb.TestResultsEndInfo DialOpts timber.DialCedarOptions // UnimplementedCedarTestResultsServer must be embedded for forward // compatibility. See gopb.test_results_grpc.pb.go for more // information. gopb.UnimplementedCedarTestResultsServer }
MockTestResultsServer sets up a mock Cedar server for sending test results using gRPC.
func NewMockTestResultsServer ¶
func NewMockTestResultsServer(ctx context.Context, basePort int) (*MockTestResultsServer, error)
NewMockTestResultsServer returns a new MockTestResultsServer listening on a port near the provided port.
func NewMockTestResultsServerWithDialOpts ¶
func NewMockTestResultsServerWithDialOpts(ctx context.Context, opts timber.DialCedarOptions) (*MockTestResultsServer, error)
NewMockTestResultsServerWithDialOpts returns a new MockTestResultsServer listening on the port and URL from the specified dial options.
func (*MockTestResultsServer) AddTestResults ¶
func (m *MockTestResultsServer) AddTestResults(_ context.Context, in *gopb.TestResults) (*gopb.TestResultsResponse, error)
AddTestResults returns an error if AddErr is true, otherwise it adds the input to Results.
func (*MockTestResultsServer) Address ¶
func (ms *MockTestResultsServer) Address() string
Address returns the address the server is listening on.
func (*MockTestResultsServer) CloseTestResultsRecord ¶
func (m *MockTestResultsServer) CloseTestResultsRecord(_ context.Context, in *gopb.TestResultsEndInfo) (*gopb.TestResultsResponse, error)
CloseTestResults returns an error if CloseErr is true, otherwise it sets Close to the input.
func (*MockTestResultsServer) CreateTestResultsRecord ¶
func (m *MockTestResultsServer) CreateTestResultsRecord(_ context.Context, in *gopb.TestResultsInfo) (*gopb.TestResultsResponse, error)
CreateTestResultsRecord returns an error if CreateErr is true, otherwise it sets Create to the input.
func (*MockTestResultsServer) StreamTestResults ¶
func (ms *MockTestResultsServer) StreamTestResults(gopb.CedarTestResults_StreamTestResultsServer) error
StreamTestResults returns a not implemented error.