package central_thanos

import "testing"

func TestBuildNextGenRowStorageUsagePromQL(t *testing.T) {
	matcher := `keyspace_id="555755"`
	want := `quantile_over_time(0.5, sum(tikv_store_size_bytes{keyspace_id="555755", type="used"})[5m]) or vector(0)`

	if got := buildNextGenRowStorageUsagePromQL(matcher); got != want {
		t.Fatalf("buildNextGenRowStorageUsagePromQL() = %q, want %q", got, want)
	}
}

func TestBuildNextGenColumnarStorageUsagePromQL(t *testing.T) {
	matcher := `tidb_cluster_id="70001"`
	want := `quantile_over_time(0.5, sum(tikv_store_size_bytes{tidb_cluster_id="70001", type="tiflash_used"})[5m]) or vector(0)`

	if got := buildNextGenColumnarStorageUsagePromQL(matcher); got != want {
		t.Fatalf("buildNextGenColumnarStorageUsagePromQL() = %q, want %q", got, want)
	}
}
