package configupdate

import (
	"github.com/pingcap/endless/pkg/util"
	"github.com/pingcap/endless/testcase/oltp/oltppkg"
	"github.com/pingcap/test-infra/sdk/resource"
)

func TestSuite(caseParams *oltppkg.CaseParams) {
	util.TestCase("should keep system normal while modify configuration online", "oltp_config_update_online_fun_001", func() {
		OLTP_CONFIG_UPDATE_CONFIG_FUN_001(caseParams.Ctx, caseParams.Tc.(resource.TiDBCluster), caseParams.WorkloadRunParms.Cmdpr, caseParams.CaseCmdParms)
	})
	util.TestCase("should recover the QPS in 1 minutes and system keep normal when close or open raft engine", "oltp_raft_engine_update_config_fun_001", func() {
		OLTP_RAFT_ENGINE_UPDATE_CONFIG_FUN_001(caseParams.Ctx, caseParams.Tc.(resource.TiDBCluster), caseParams.WorkloadRunParms.Cmdpr, caseParams.CaseCmdParms)
	})
	util.TestCase("should QPS be stable when adjust region config repeatedly", "oltp_dynamic_regions_update_config_repeatedly_stability_001", func() {
		OLTP_DYNAMIC_REGIONS_UPDATE_CONFIG_REPEATEDLY_STABILITY_001(caseParams.Ctx, caseParams.Tc.(resource.TiDBCluster), caseParams.BenchToolset, caseParams.WorkloadRunParms, caseParams.CaseCmdParms)
	})
	util.TestCase("should QPS be stable when adjust region config and inject fault repeatedly", "oltp_dynamic_regions_update_config_repeatedly_stability_rel_001", func() {
		OLTP_DYNAMIC_REGIONS_UPDATE_CONFIG_REPEATEDLY_STABILITY_REL_001(caseParams.Ctx, caseParams.Tc.(resource.TiDBCluster), caseParams.BenchToolset, caseParams.WorkloadRunParms, caseParams.CaseCmdParms, caseParams.SkipAfterEachCheck)
	})
	util.TestCase("should keep system normal while modify encryption configuration repeatedly", "oltp_tikv_data_encryption_method_update_stability_001", func() {
		OLTP_TiKV_DATA_ENCRYPTION_METHOD_UPDATE_REPEATEDLY(caseParams.Ctx, caseParams.Tc.(resource.TiDBCluster), caseParams.WorkloadRunParms.Cmdpr, caseParams.CaseCmdParms)
	})
	util.TestCase("should keep system normal while modify encryption method to sm4", "oltp_tikv_data_encryption_method_update_to_sm4", func() {
		OLTP_TiKV_DATA_ENCRYPTION_METHOD_UPDATE_TO_SM4(caseParams.Ctx, caseParams.Tc.(resource.TiDBCluster), caseParams.WorkloadRunParms.Cmdpr, caseParams.CaseCmdParms)
	})
	util.TestCase("should keep system normal while modify encryption method to aes", "oltp_tikv_data_encryption_method_update_to_aes", func() {
		OLTP_TiKV_DATA_ENCRYPTION_METHOD_UPDATE_TO_AES(caseParams.Ctx, caseParams.Tc.(resource.TiDBCluster), caseParams.WorkloadRunParms.Cmdpr, caseParams.CaseCmdParms)
	})
	util.TestCase("should keep system normal while close encryption method", "oltp_tikv_data_encryption_master_key_update", func() {
		OLTP_TiKV_DATA_ENCRYPTION_MASTER_KEY_UPDATE(caseParams.Ctx, caseParams.Tc.(resource.TiDBCluster), caseParams.WorkloadRunParms.Cmdpr, caseParams.CaseCmdParms)
	})
	util.TestCase("should keep system normal while close encryption method", "oltp_tikv_data_encryption_close", func() {
		OLTP_TiKV_DATA_ENCRYPTION_CLOSE(caseParams.Ctx, caseParams.Tc.(resource.TiDBCluster), caseParams.WorkloadRunParms.Cmdpr, caseParams.CaseCmdParms)
	})
}
