package convert

import (
	"testing"

	"github.com/onsi/gomega"
)

func TestMigrateBasicData(t *testing.T) {
	g := gomega.NewWithT(t)
	providersInCoreSvc := getProvidersInCoreSvc()

	infraStoragesInCoresvc := getInfraStoragesInCoreSvc()
	infraComputesInCoresvc := getComputesInCoreSvc()
	tiersInCoresvc := getTiersInCoreSvc()
	tierUnitsInCoresvc := getTierUnitsInCoreSvc()

	containerTables, err := ToTierTableContainers(
		tiersInCoresvc,
		tierUnitsInCoresvc,
		infraComputesInCoresvc,
		infraStoragesInCoresvc,
		providersInCoreSvc,
	)
	g.Expect(err).To(gomega.Succeed())

	ctx := t.Context()
	err = ValidateSpu(ctx, tiersInCoresvc, containerTables.Tiers, containerTables.Tier2TierUnitMapping)
	g.Expect(err).To(gomega.Succeed())

	err = ValidateSku(
		ctx,
		tiersInCoresvc,
		tierUnitsInCoresvc,
		containerTables.TierUnits,
		containerTables.Conditions,
		containerTables.Tier2TierUnitMapping,
	)
	g.Expect(err).To(gomega.Succeed())

	clusterInCoresvc := getClustersInCoreSvc()
	err = ValidateTierUnitUsedCheck(ctx, clusterInCoresvc, containerTables.Tiers, containerTables.TierUnits)
	g.Expect(err).To(gomega.Succeed())
}
