package dedicatedregional

import (
	"encoding/json"
	"fmt"
	"testing"

	"github.com/tidbcloud/infra-provider/regional-server/api/v1alpha1"
)

func TestAnnotationMapTPL(t *testing.T) {
	annoMap := map[string]string{
		v1alpha1.AnnotationKeyLegacyAPPBoxSkipAddonAWSEBSCSIDriver: "true",
	}
	bs, err := json.Marshal(annoMap)
	if err != nil {
		t.Fatal(err)
	}
	out := fmt.Sprintf(patchAnnotationMapTPL, string(bs))
	expected := fmt.Sprintf(patchAnnotationMapTPL, `{"cloud.pingcap.com/legacy-appbox-skip-addon-csi":"true"}`)
	if out != expected {
		t.Fatalf("patch content not correct, got %s, expected %s", out, expected)
	}
}
