Skip to content

Commit

Permalink
Add telemetry manager tests
Browse files Browse the repository at this point in the history
  • Loading branch information
george-dorin committed Sep 17, 2023
1 parent 00cc2b9 commit 232197d
Show file tree
Hide file tree
Showing 5 changed files with 550 additions and 4 deletions.
144 changes: 144 additions & 0 deletions core/config/mocks/telemetry_ingress.go

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

87 changes: 87 additions & 0 deletions core/config/mocks/telemetry_ingress_endpoint.go

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

3 changes: 3 additions & 0 deletions core/config/telemetry_ingress_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"time"
)

//go:generate mockery --quiet --name TelemetryIngress --output ./mocks/ --case=underscore --filename telemetry_ingress.go

type TelemetryIngress interface {
Logging() bool
UniConn() bool
Expand All @@ -16,6 +18,7 @@ type TelemetryIngress interface {
Endpoints() []TelemetryIngressEndpoint
}

//go:generate mockery --quiet --name TelemetryIngressEndpoint --output ./mocks/ --case=underscore --filename telemetry_ingress_endpoint.go
type TelemetryIngressEndpoint interface {
Network() string
ChainID() string
Expand Down
8 changes: 4 additions & 4 deletions core/services/telemetry/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ type telemetryEndpoint struct {
Network string
URL *url.URL
client TelemetryClient
pubKey string
PubKey string
}

func NewManager(cfg config.TelemetryIngress, ks keystore.CSA, lggr logger.Logger) *Manager {
func NewManager(cfg config.TelemetryIngress, csaKeyStore keystore.CSA, lggr logger.Logger) *Manager {
m := &Manager{
bufferSize: cfg.BufferSize(),
endpoints: nil,
ks: ks,
ks: csaKeyStore,
lggr: lggr.Named("TelemetryManager"),
logging: cfg.Logging(),
maxBatchSize: cfg.MaxBatchSize(),
Expand Down Expand Up @@ -152,7 +152,7 @@ func (m *Manager) addEndpoint(e config.TelemetryIngressEndpoint) error {
Network: strings.ToUpper(e.Network()),
ChainID: strings.ToUpper(e.ChainID()),
URL: e.URL(),
pubKey: e.ServerPubKey(),
PubKey: e.ServerPubKey(),
client: tClient,
}

Expand Down
Loading

0 comments on commit 232197d

Please sign in to comment.