Skip to content

Commit

Permalink
fix E2E for PDMS and BR
Browse files Browse the repository at this point in the history
  • Loading branch information
csuzhangxc committed Jul 29, 2024
1 parent 1324a82 commit d6bf614
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/br/br.go
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ func getPDServiceResourceName(tcName string) string {
func createTidbCluster(f *e2eframework.Framework, name string, version string, enableTLS bool, skipCA bool) error {
ns := f.Namespace.Name
// TODO: change to use tidbclusterutil like brutil
tc := fixture.GetTidbCluster(ns, name, version)
tc := fixture.GetTidbClusterWithoutPDMS(ns, name, version)
tc.Spec.PD.Replicas = 1
tc.Spec.TiKV.Replicas = 1
tc.Spec.TiDB.Replicas = 1
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/br/framework/br/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ func GetBackup(ns, name, tcName, typ string, s3Config *v1alpha1.S3StorageProvide
Cluster: tcName,
ClusterNamespace: ns,
SendCredToTikv: &sendCredToTikv,
Options: []string{
// ref: https://docs.pingcap.com/tidb/stable/backup-and-restore-overview#version-compatibility
"--with-sys-table=false",
},
},
CleanPolicy: v1alpha1.CleanPolicyTypeDelete,
},
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/tidbcluster/tidbcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -3136,7 +3136,7 @@ var _ = ginkgo.Describe("TiDBCluster", func() {

ginkgo.It("migrate start script from v1 to v2 "+testcase.nameSuffix, func() {
tcName := "migrate-start-script-v2"
tc := fixture.GetTidbCluster(ns, tcName, utilimage.TiDBLatest)
tc := fixture.GetTidbClusterWithoutPDMS(ns, tcName, utilimage.TiDBLatest)
tc = fixture.AddTiFlashForTidbCluster(tc)
tc = fixture.AddTiCDCForTidbCluster(tc)
tc = fixture.AddPumpForTidbCluster(tc)
Expand Down
24 changes: 16 additions & 8 deletions tests/pkg/fixture/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,22 @@ const ComponentCustomKey = "component-test-key"

// GetTidbCluster returns a TidbCluster resource configured for testing
func GetTidbCluster(ns, name, version string) *v1alpha1.TidbCluster {
tc := GetTidbClusterWithoutPDMS(ns, name, version)

random := rand.Intn(2)
if random != 0 && version == utilimage.PDMSImage {
log.Logf("[GetTidbCluster] tidbcluster's pd mode is micro-service in this situation, "+
"version: %s, tc name: %s, namespace: %s", version, name, ns)
// 50% random in pdms mode
tc = AddPDMSForTidbCluster(tc)
}

return tc
}

// GetTidbClusterWithoutPDMS returns a TidbCluster resource configured for testing.
// in some cases, it won't support pdms mode, so we can't use pdms mode in this situation.
func GetTidbClusterWithoutPDMS(ns, name, version string) *v1alpha1.TidbCluster {
// We assume all unparsable versions are greater or equal to v4.0.0-beta,
// e.g. nightly.
tikvConfig := v1alpha1.NewTiKVConfig()
Expand Down Expand Up @@ -193,14 +209,6 @@ func GetTidbCluster(ns, name, version string) *v1alpha1.TidbCluster {
},
}

random := rand.Intn(2)
if random != 0 && version == utilimage.PDMSImage {
log.Logf("[GetTidbCluster] tidbcluster's pd mode is micro-service in this situation, "+
"version: %s, tc name: %s, namespace: %s", version, name, ns)
// 50% random in pdms mode
tc = AddPDMSForTidbCluster(tc)
}

return tc
}

Expand Down

0 comments on commit d6bf614

Please sign in to comment.