package prometheus

import (
	"testing"

	"github.com/tidbcloud/metrics-integration/pipeline/central/config"
)

func TestRegistryClusterMetrics_DedicatedIncludesCPURate(t *testing.T) {
	cluster := &config.TargetCluster{ServicePlan: "Dedicated"}

	got := registryClusterMetrics(cluster)

	const want = 27
	if len(got) != want {
		t.Fatalf("registryClusterMetrics(Dedicated) len = %d, want %d", len(got), want)
	}
}

func TestRegistryClusterMetrics_NextGenKeepsExpectedCount(t *testing.T) {
	cluster := &config.TargetCluster{ServicePlan: "Premium"}

	got := registryClusterMetrics(cluster)

	const want = 15
	if len(got) != want {
		t.Fatalf("registryClusterMetrics(Premium) len = %d, want %d", len(got), want)
	}
}

func TestRegistryClusterMetrics_EssentialV2MatchesPremium(t *testing.T) {
	cluster := &config.TargetCluster{ServicePlan: "Essential_V2"}

	got := registryClusterMetrics(cluster)

	const want = 15
	if len(got) != want {
		t.Fatalf("registryClusterMetrics(Essential_V2) len = %d, want %d", len(got), want)
	}
}

func TestRegistryClusterMetrics_EssentialSkipsCDCMetrics(t *testing.T) {
	cluster := &config.TargetCluster{ServicePlan: "Essential"}

	got := registryClusterMetrics(cluster)

	const want = 13
	if len(got) != want {
		t.Fatalf("registryClusterMetrics(Essential) len = %d, want %d", len(got), want)
	}
}

func TestRegistryClusterMetrics_StarterSkipsCDCMetrics(t *testing.T) {
	cluster := &config.TargetCluster{ServicePlan: "Starter"}

	got := registryClusterMetrics(cluster)

	const want = 13
	if len(got) != want {
		t.Fatalf("registryClusterMetrics(Starter) len = %d, want %d", len(got), want)
	}
}
