grafana/pkg/services/featuremgmt/usage_stats_test.go
Artur Wierzbicki f1a1070d41
UsageStats: track enabled features (#47407)
* #47127: include enabled features in the usage stats reports

* #47127: convert feature names to snake cased metric names

* #47127: remove dead code

* #47127: lint fix

* #47127: convert GetUsageStats to return `map[string]interface{}`

* #47127: fix testssssssss

* #47127: fix testssssssss
2022-04-08 12:42:33 +02:00

35 lines
1.0 KiB
Go

package featuremgmt
import (
"context"
"testing"
"github.com/stretchr/testify/require"
)
func TestFeatureUsageStats(t *testing.T) {
featureManagerWithAllFeatures := WithFeatures(
"trimDefaults",
"httpclientprovider_azure_auth",
"service-accounts",
"database_metrics",
"dashboardPreviews",
"live-config",
"showFeatureFlagsInUI",
"UPPER_SNAKE_CASE",
"feature.with.a.dot",
)
require.Equal(t, map[string]interface{}{
"stats.features.trim_defaults.count": 1,
"stats.features.httpclientprovider_azure_auth.count": 1,
"stats.features.service_accounts.count": 1,
"stats.features.database_metrics.count": 1,
"stats.features.dashboard_previews.count": 1,
"stats.features.live_config.count": 1,
"stats.features.show_feature_flags_in_ui.count": 1,
"stats.features.upper_snake_case.count": 1,
"stats.features.feature_with_a_dot.count": 1,
}, featureManagerWithAllFeatures.GetUsageStats(context.Background()))
}