mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-18 16:07:10 +00:00
Deprecate all flags - Use querier.config.fluxInterval in lieu of passing `--flux-interval` and `--flux-interval-for-trace-detail` - Remove `--gateway-url` - Use telemetrystore.clickhouse.cluster in lieu of passing `--cluster` or `--cluster-name` - Add an `unparam` check in the linter. Updated some functions across the querier codebase to be compatible with this linter. - Remove prometheus config from docker builds.
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package telemetrystoretest
|
|
|
|
import (
|
|
"github.com/ClickHouse/clickhouse-go/v2"
|
|
"github.com/DATA-DOG/go-sqlmock"
|
|
"github.com/SigNoz/signoz/pkg/telemetrystore"
|
|
cmock "github.com/srikanthccv/ClickHouse-go-mock"
|
|
)
|
|
|
|
var _ telemetrystore.TelemetryStore = (*Provider)(nil)
|
|
|
|
// Provider represents a mock telemetry store provider for testing
|
|
type Provider struct {
|
|
clickhouseDB cmock.ClickConnMockCommon
|
|
}
|
|
|
|
// New creates a new mock telemetry store provider
|
|
func New(_ telemetrystore.Config, matcher sqlmock.QueryMatcher) *Provider {
|
|
clickhouseDB, err := cmock.NewClickHouseWithQueryMatcher(&clickhouse.Options{}, matcher)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return &Provider{
|
|
clickhouseDB: clickhouseDB,
|
|
}
|
|
}
|
|
|
|
// ClickhouseDB returns the mock Clickhouse connection
|
|
func (p *Provider) ClickhouseDB() clickhouse.Conn {
|
|
return p.clickhouseDB.(clickhouse.Conn)
|
|
}
|
|
|
|
// Cluster returns the cluster name
|
|
func (p *Provider) Cluster() string {
|
|
return "cluster"
|
|
}
|
|
|
|
// Mock returns the underlying Clickhouse mock instance for setting expectations
|
|
func (p *Provider) Mock() cmock.ClickConnMockCommon {
|
|
return p.clickhouseDB
|
|
}
|