package vpc

import (
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/tidbcloud/infra-provider/pkg/consts"
	"github.com/tidbcloud/infra-provider/regional-server/api/v1alpha1"
	"github.com/tidbcloud/infra-provider/regional-server/pkg/controllers/vpc/task"
)

func TestGetEKSVPCTasks(t *testing.T) {
	c := &task.Context{}
	tasks := GetEKSVPCTasks(nil, c)
	assert.Equal(t, 7, len(tasks))
}

func TestGetGKEVPCTasks(t *testing.T) {
	c := &task.Context{}
	tasks := GetGKEVPCTasks(nil, c)
	assert.Equal(t, 4, len(tasks))
}

func TestGetVPCTasks(t *testing.T) {
	t.Run("eks", func(t *testing.T) {
		c := &task.Context{
			VPC: &v1alpha1.VPC{
				Spec: v1alpha1.VPCSpec{
					Provider: consts.ProviderTypeEKS,
				},
			},
		}
		tasks := GetVPCTasks(nil, c)
		assert.Equal(t, 7, len(tasks))
	})
	t.Run("gke", func(t *testing.T) {
		c := &task.Context{
			VPC: &v1alpha1.VPC{
				Spec: v1alpha1.VPCSpec{
					Provider: consts.ProviderTypeGKE,
				},
			},
		}
		tasks := GetVPCTasks(nil, c)
		assert.Equal(t, 4, len(tasks))
	})
}
