Skip to content

Commit

Permalink
Increase code cov
Browse files Browse the repository at this point in the history
Signed-off-by: FlamingSaint <[email protected]>
  • Loading branch information
FlamingSaint committed Jul 24, 2024
1 parent 96649c9 commit 032a860
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cmd/jaeger/internal/extension/jaegerquery/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ func (s *server) createMetricStorage(host component.Host) (metricsstore.Reader,
}

metricsReader, err := mf.CreateMetricsReader()
if err != nil {
return nil, fmt.Errorf("cannot create metrics reader %w", err)
}
return metricsReader, err
}

Expand Down
19 changes: 18 additions & 1 deletion cmd/jaeger/internal/extension/jaegerquery/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (fmf fakeMetricsFactory) Initialize(*zap.Logger) error {
}

func (fmf fakeMetricsFactory) CreateMetricsReader() (metricsstore.Reader, error) {
if fmf.name == "need-span-writer-error" {
if fmf.name == "need-metrics-reader-error" {
return nil, fmt.Errorf("test-error")
}
return &metricsstoremocks.Reader{}, nil
Expand Down Expand Up @@ -133,6 +133,7 @@ func TestServerStart(t *testing.T) {
config: &Config{
TraceStorageArchive: "jaeger_storage",
TraceStoragePrimary: "jaeger_storage",
MetricStorage: "jaeger_metrics_storage",
},
},
{
Expand Down Expand Up @@ -164,6 +165,22 @@ func TestServerStart(t *testing.T) {
},
expectedErr: "cannot find archive storage factory",
},
{
name: "metrics storage error",
config: &Config{
MetricStorage: "need-factory-error",
TraceStoragePrimary: "jaeger_storage",
},
expectedErr: "cannot find metrics storage factory",
},
{
name: " metrics reader error",
config: &Config{
MetricStorage: "need-metrics-reader-error",
TraceStoragePrimary: "jaeger_storage",
},
expectedErr: "cannot create metrics reader",
},
}

for _, tt := range tests {
Expand Down

0 comments on commit 032a860

Please sign in to comment.