package cluster

import "testing"

func Test_populatePrometheusConfig(t *testing.T) {
	type args struct {
		config    string
		namespace string
		labels    *ExternalLabels
	}
	tests := []struct {
		name    string
		args    args
		wantRes string
	}{
		{
			name: "test",
			args: args{
				config: `prometheus_replica: $(NAMESPACE)_$(POD_NAME)
        cluster: CLUSTER_NAME
        project: PROJECT
        shoot_name: SHOOT_NAME
        name: SHOOT_NAME
        seed_region: SEED_REGION
        seed_provider: SEED_PROVIDER
        shoot_infra: SHOOT_INFRA
        ignoreAlerts: "false"
        tenant: TENANT_ID
        cluster_id: CLUSTER_ID`,
				namespace: "tidb123",
				labels: &ExternalLabels{
					ClusterName:  "cluster-name",
					Project:      "project",
					ShootName:    "shoot-name",
					SeedRegion:   "us-west-2",
					SeedProvider: "aws",
					ShootInfra:   "test",
					TenantID:     "tenant-id",
					ClusterID:    "cluster-id",
				},
			},
			wantRes: `prometheus_replica: $(NAMESPACE)_$(POD_NAME)
        cluster: cluster-name
        project: project
        shoot_name: shoot-name
        name: shoot-name
        seed_region: us-west-2
        seed_provider: aws
        shoot_infra: test
        ignoreAlerts: "false"
        tenant: tenant-id
        cluster_id: cluster-id`,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if gotRes := populatePrometheusConfig(tt.args.config, tt.args.namespace, tt.args.labels); gotRes != tt.wantRes {
				t.Errorf("populatePrometheusConfig() = %v, want %v", gotRes, tt.wantRes)
			}
		})
	}
}
