package e2e

import (
	"flag"
	"os"
	"testing"

	"github.com/spf13/pflag"

	"github.com/tidbcloud/eks-provider/tests/e2e/suite"
)

func handleFlags() {
	suite.RegisterFlags(pflag.CommandLine)
	suite.CopyGoFlags(pflag.CommandLine, flag.CommandLine)

	// mark default flag parsed
	if err := flag.CommandLine.Parse(nil); err != nil {
		panic(err)
	}
	pflag.Parse()

	suite.PrintFlags(pflag.CommandLine)

}

func TestMain(m *testing.M) {
	handleFlags()
	code := m.Run()
	suite.PrintSummary()

	os.Exit(code)
}

func TestE2E(t *testing.T) {
	RunE2E(t)
}
