Skip to content

Commit

Permalink
e2e: bump TiDB and MySQL version (#5697) (#5746)
Browse files Browse the repository at this point in the history
Co-authored-by: csuzhangxc <csuzhangxc@gmail.com>
  • Loading branch information
ti-chi-bot and csuzhangxc authored Sep 24, 2024
1 parent 78fc561 commit a17b5d1
Show file tree
Hide file tree
Showing 17 changed files with 97 additions and 70 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ TEST_COVER_PACKAGES := go list ./cmd/... ./pkg/... $(foreach mod, $(GO_SUBMODULE

# NOTE: coverage report generated for E2E tests (with `-c`) may not stable, see
# https://github.com/golang/go/issues/23883#issuecomment-381766556
GO_TEST := $(GO) test -cover -covermode=atomic -coverpkg=$$($(TEST_COVER_PACKAGES))
GO_TEST := CGO_ENABLED=0 $(GO) test -cover -covermode=atomic -coverpkg=$$($(TEST_COVER_PACKAGES))

default: build

Expand Down Expand Up @@ -160,7 +160,7 @@ endif
cp -r charts/tidb-operator tests/images/e2e
cp -r charts/tidb-drainer tests/images/e2e
cp -r manifests tests/images/e2e
docker build -t "${DOCKER_REPO}/tidb-operator-e2e:${IMAGE_TAG}" tests/images/e2e
docker build -t "${DOCKER_REPO}/tidb-operator-e2e:${IMAGE_TAG}" --build-arg=TARGETARCH=$(GOARCH) tests/images/e2e

e2e-build: ## Build binaries for test
$(GO_BUILD) -ldflags '$(LDFLAGS)' -o tests/images/e2e/bin/ginkgo github.com/onsi/ginkgo/ginkgo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
pingcap.com/aws-local-ssd: "true"
serviceAccountName: local-storage-admin
containers:
- image: "quay.io/external_storage/local-volume-provisioner:v2.3.2"
- image: "registry.k8s.io/sig-storage/local-volume-provisioner:v2.6.0"
name: provisioner
securityContext:
privileged: true
Expand All @@ -58,7 +58,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: JOB_CONTAINER_IMAGE
value: "quay.io/external_storage/local-volume-provisioner:v2.3.2"
value: "registry.k8s.io/sig-storage/local-volume-provisioner:v2.6.0"
resources:
requests:
cpu: 100m
Expand Down
4 changes: 2 additions & 2 deletions examples/local-pv/local-volume-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
spec:
serviceAccountName: local-storage-admin
containers:
- image: "quay.io/external_storage/local-volume-provisioner:v2.3.4"
- image: "registry.k8s.io/sig-storage/local-volume-provisioner:v2.6.0"
name: provisioner
securityContext:
privileged: true
Expand All @@ -81,7 +81,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: JOB_CONTAINER_IMAGE
value: "quay.io/external_storage/local-volume-provisioner:v2.3.4"
value: "registry.k8s.io/sig-storage/local-volume-provisioner:v2.6.0"
resources:
requests:
cpu: 100m
Expand Down
4 changes: 2 additions & 2 deletions manifests/eks/local-volume-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ spec:
name: disks
mountPropagation: Bidirectional
containers:
- image: "quay.io/external_storage/local-volume-provisioner:v2.3.4"
- image: "registry.k8s.io/sig-storage/local-volume-provisioner:v2.6.0"
name: provisioner
securityContext:
privileged: true
Expand All @@ -106,7 +106,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: JOB_CONTAINER_IMAGE
value: "quay.io/external_storage/local-volume-provisioner:v2.3.4"
value: "registry.k8s.io/sig-storage/local-volume-provisioner:v2.6.0"
resources:
requests:
cpu: 100m
Expand Down
4 changes: 2 additions & 2 deletions manifests/gke/local-ssd-provision/local-ssd-provision.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ spec:
mount -U "$uuid" -t ext4 --target "$mnt_dir" --options "$mnt_opts"
chmod a+w "$mnt_dir"
containers:
- image: "quay.io/external_storage/local-volume-provisioner:v2.3.2"
- image: "registry.k8s.io/sig-storage/local-volume-provisioner:v2.6.0"
name: provisioner
securityContext:
privileged: true
Expand All @@ -205,7 +205,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: JOB_CONTAINER_IMAGE
value: "quay.io/external_storage/local-volume-provisioner:v2.3.2"
value: "registry.k8s.io/sig-storage/local-volume-provisioner:v2.6.0"
volumeMounts:
- mountPath: /etc/provisioner/config
name: provisioner-config
Expand Down
4 changes: 2 additions & 2 deletions manifests/local-dind/local-volume-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
spec:
serviceAccountName: local-storage-admin
containers:
- image: "quay.io/external_storage/local-volume-provisioner:v2.3.4"
- image: "registry.k8s.io/sig-storage/local-volume-provisioner:v2.6.0"
name: provisioner
securityContext:
privileged: true
Expand All @@ -53,7 +53,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: JOB_CONTAINER_IMAGE
value: "quay.io/external_storage/local-volume-provisioner:v2.3.4"
value: "registry.k8s.io/sig-storage/local-volume-provisioner:v2.6.0"
resources:
requests:
cpu: 100m
Expand Down
2 changes: 1 addition & 1 deletion tests/dm.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const (
// DMMySQLSvcStsName is the upstream MySQL svc/sts name for DM E2E tests.
DMMySQLSvcStsName = "dm-mysql"
// DMMySQLImage is the upstream MySQL container image for DM E2E tests.
DMMySQLImage = "mysql:5.7"
DMMySQLImage = "mysql:8.0"
// DMMySQLReplicas is the upstream MySQL instance number for DM E2E tests.
// We use replicas as different MySQL instances.
DMMySQLReplicas int32 = 2
Expand Down
16 changes: 13 additions & 3 deletions tests/e2e/br/br.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ var _ = ginkgo.Describe("Backup and Restore", func() {

utilginkgo.ContextWhenFocus("Specific Version", func() {
cases := []*testcase{
newTestCase(utilimage.TiDBV5x0x0, utilimage.TiDBLatest, typeBR),
newTestCase(utilimage.TiDBV5x0x2, utilimage.TiDBLatest, typeBR),
newTestCase(utilimage.TiDBV7x5x0, utilimage.TiDBLatest, typeBR),
newTestCase(utilimage.TiDBV7x5x3, utilimage.TiDBLatest, typeBR),
}
for i := range cases {
tcase := cases[i]
Expand Down Expand Up @@ -504,8 +504,12 @@ var _ = ginkgo.Describe("Backup and Restore", func() {
// })
})

// the following cases may encounter errors after restarting the backup pod:
// "there may be some backup files in the path already, please specify a correct backup directory"
ginkgo.Context("Restart Backup by k8s Test", func() {
ginkgo.It("delete backup pod and restart by k8s test", func() {
ginkgo.Skip("unstable case, after restart: there may be some backup files in the path already, please specify a correct backup directory")

backupClusterName := "delete-backup-pod-test"
backupVersion := utilimage.TiDBLatest
enableTLS := false
Expand Down Expand Up @@ -566,6 +570,8 @@ var _ = ginkgo.Describe("Backup and Restore", func() {

ginkgo.Context("Restart Backup by backoff retry policy Test", func() {
ginkgo.It("kill backup pod and restart by backoff retry policy", func() {
ginkgo.Skip("unstable case, after restart: there may be some backup files in the path already, please specify a correct backup directory")

backupClusterName := "kill-backup-pod-test"
backupVersion := utilimage.TiDBLatest
enableTLS := false
Expand Down Expand Up @@ -629,6 +635,8 @@ var _ = ginkgo.Describe("Backup and Restore", func() {
})

ginkgo.It("kill backup pod and exceed maxRetryTimes", func() {
ginkgo.Skip("unstable case, after restart: there may be some backup files in the path already, please specify a correct backup directory")

backupClusterName := "kill-backup-pod-exceed-times-test"
backupVersion := utilimage.TiDBLatest
enableTLS := false
Expand Down Expand Up @@ -708,6 +716,8 @@ var _ = ginkgo.Describe("Backup and Restore", func() {
})

ginkgo.It("kill backup pod and exceed retryTimeout", func() {
ginkgo.Skip("unstable case, after restart: there may be some backup files in the path already, please specify a correct backup directory")

backupClusterName := "kill-backup-pod-exceed-timeout-test"
backupVersion := utilimage.TiDBLatest
enableTLS := false
Expand Down Expand Up @@ -901,7 +911,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 @@ -165,6 +165,10 @@ func GetRestore(ns, name, tcName, typ string, s3Config *v1alpha1.S3StorageProvid
ClusterNamespace: ns,
SendCredToTikv: &sendCredToTikv,
CheckRequirements: pointer.BoolPtr(false), // workaround for https://docs.pingcap.com/tidb/stable/backup-and-restore-faq#why-does-br-report-new_collations_enabled_on_first_bootstrap-mismatch
Options: []string{
// ref: https://docs.pingcap.com/tidb/stable/backup-and-restore-overview#version-compatibility
"--with-sys-table=false",
},
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/br/utils/s3/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (

const (
minioName = "minio"
minioImage = "minio/minio:RELEASE.2020-05-08T02-40-49Z"
minioImage = "minio/minio:RELEASE.2024-09-13T20-26-02Z"

minioBucket = "local" // the bucket for e2e test
minioSecret = "minio-secret"
Expand Down
13 changes: 11 additions & 2 deletions tests/e2e/tidbcluster/across-kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,18 @@ var _ = ginkgo.Describe("[Across Kubernetes]", func() {
ginkgo.By("Update pd's peerURL of cluster-1")
pdAddr := fmt.Sprintf("%s:%d", localHost, localPort)
var resp *pdutil.GetMembersResponse
err = retry.OnError(retry.DefaultRetry, func(e error) bool { return e != nil }, func() error {
err = wait.PollImmediate(5*time.Second, 5*time.Minute, func() (bool, error) {
// it seems the above `WaitForTidbClusterReady` may return before the pd server is ready
// so we need to retry here
resp, err = pdutil.GetMembersV2(pdAddr)
return err
if err != nil {
log.Logf("failed to get pd members of cluster-1 %s/%s, %v", tc1.Namespace, tc1.Name, err)
return false, nil
}
if len(resp.Members) == 0 {
return false, nil
}
return true, nil
})
framework.ExpectNoError(err, " failed to get pd members of cluster-1 %s/%s", tc1.Namespace, tc1.Name)
for _, member := range resp.Members {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/tidbcluster/serial.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ import (
)

const (
OperatorLatestVersion string = "v1.5.0-beta.1"
OperatorPrevMajorVersion string = "v1.4.6"
OperatorLatestVersion string = "v1.6.0"
OperatorPrevMajorVersion string = "v1.5.4"
)

// Serial specs describe tests which cannot run in parallel.
Expand Down
46 changes: 20 additions & 26 deletions tests/e2e/tidbcluster/tidbcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2021,6 +2021,16 @@ var _ = ginkgo.Describe("TiDBCluster", func() {
utiltc.MustWaitForComponentPhase(cli, tc, v1alpha1.PDMemberType, v1alpha1.UpgradePhase, 3*time.Minute, time.Second*10)
log.Logf("PD is in UpgradePhase")

ginkgo.By("Wait for TiKV to be in UpgradePhase")
utiltc.MustWaitForComponentPhase(cli, tc, v1alpha1.TiKVMemberType, v1alpha1.UpgradePhase, 3*time.Minute, time.Second*10)
log.Logf("TiKV is in UpgradePhase")

ginkgo.By("Wait for TiDB to be in UpgradePhase")
utiltc.MustWaitForComponentPhase(cli, tc, v1alpha1.TiDBMemberType, v1alpha1.UpgradePhase, 3*time.Minute, time.Second*10)
log.Logf("TiDB is in UpgradePhase")

// the tc ready condition between components upgrade phase may not be observed
// and it may only observed the last ready after all components upgraded
ginkgo.By("Wait for tc ready")
err = oa.WaitForTidbClusterReady(tc, 10*time.Minute, 10*time.Second)
framework.ExpectNoError(err, "failed to wait for TidbCluster %s/%s components ready", ns, tc.Name)
Expand All @@ -2037,14 +2047,6 @@ var _ = ginkgo.Describe("TiDBCluster", func() {
log.Logf("PD config:\n%s", pdCm.Data["config-file"])
gomega.Expect(pdCm.Data["config-file"]).To(gomega.ContainSubstring("lease = 3"))

ginkgo.By("Wait for TiKV to be in UpgradePhase")
utiltc.MustWaitForComponentPhase(cli, tc, v1alpha1.TiKVMemberType, v1alpha1.UpgradePhase, 3*time.Minute, time.Second*10)
log.Logf("TiKV is in UpgradePhase")

ginkgo.By("Wait for tc ready")
err = oa.WaitForTidbClusterReady(tc, 10*time.Minute, 10*time.Second)
framework.ExpectNoError(err, "failed to wait for TidbCluster %s/%s components ready", ns, tc.Name)

ginkgo.By("Check TiKV configuration")
tikvMemberName := controller.TiKVMemberName(tc.Name)
tikvSts, err := stsGetter.StatefulSets(ns).Get(context.TODO(), tikvMemberName, metav1.GetOptions{})
Expand All @@ -2057,14 +2059,6 @@ var _ = ginkgo.Describe("TiDBCluster", func() {
log.Logf("TiKV config:\n%s", tikvCm.Data["config-file"])
gomega.Expect(tikvCm.Data["config-file"]).To(gomega.ContainSubstring("status-thread-pool-size = 1"))

ginkgo.By("Wait for TiDB to be in UpgradePhase")
utiltc.MustWaitForComponentPhase(cli, tc, v1alpha1.TiDBMemberType, v1alpha1.UpgradePhase, 3*time.Minute, time.Second*10)
log.Logf("TiDB is in UpgradePhase")

ginkgo.By("Wait for tc ready")
err = oa.WaitForTidbClusterReady(tc, 10*time.Minute, 10*time.Second)
framework.ExpectNoError(err, "failed to wait for TidbCluster %s/%s components ready", ns, tc.Name)

ginkgo.By("Check TiDB configuration")
tidbMemberName := controller.TiDBMemberName(tc.Name)
tidbSts, err := stsGetter.StatefulSets(ns).Get(context.TODO(), tidbMemberName, metav1.GetOptions{})
Expand Down Expand Up @@ -2160,7 +2154,7 @@ var _ = ginkgo.Describe("TiDBCluster", func() {

// upgrdae testing for specific versions
utilginkgo.ContextWhenFocus("Specific Version", func() {
configureV5x0x0 := func(tc *v1alpha1.TidbCluster) {
configureV7x5x0 := func(tc *v1alpha1.TidbCluster) {
pdCfg := v1alpha1.NewPDConfig()
tikvCfg := v1alpha1.NewTiKVConfig()
tidbCfg := v1alpha1.NewTiDBConfig()
Expand Down Expand Up @@ -2190,7 +2184,7 @@ var _ = ginkgo.Describe("TiDBCluster", func() {
tc.Spec.TiDB.Config = tidbCfg
tc.Spec.TiFlash.Config = tiflashCfg
}
configureV5x0x2 := func(tc *v1alpha1.TidbCluster) {
configureV7x5x2 := func(tc *v1alpha1.TidbCluster) {
pdCfg := v1alpha1.NewPDConfig()
tikvCfg := v1alpha1.NewTiKVConfig()
tidbCfg := v1alpha1.NewTiDBConfig()
Expand Down Expand Up @@ -2220,7 +2214,7 @@ var _ = ginkgo.Describe("TiDBCluster", func() {
tc.Spec.TiDB.Config = tidbCfg
tc.Spec.TiFlash.Config = tiflashCfg
}
configureV5x1x0 := func(tc *v1alpha1.TidbCluster) {
configureV8x1x0 := func(tc *v1alpha1.TidbCluster) {
pdCfg := v1alpha1.NewPDConfig()
tikvCfg := v1alpha1.NewTiKVConfig()
tidbCfg := v1alpha1.NewTiDBConfig()
Expand Down Expand Up @@ -2264,16 +2258,16 @@ var _ = ginkgo.Describe("TiDBCluster", func() {

cases := []upgradeCase{
{
oldVersion: utilimage.TiDBV5x0x0,
oldVersion: utilimage.TiDBV7x5x0,
newVersion: utilimage.TiDBLatest,
configureOldTiDBCluster: configureV5x0x0,
configureNewTiDBCluster: configureV5x1x0,
configureOldTiDBCluster: configureV7x5x0,
configureNewTiDBCluster: configureV8x1x0,
},
{
oldVersion: utilimage.TiDBV5x0x2,
oldVersion: utilimage.TiDBV7x5x3,
newVersion: utilimage.TiDBLatest,
configureOldTiDBCluster: configureV5x0x2,
configureNewTiDBCluster: configureV5x1x0,
configureOldTiDBCluster: configureV7x5x2,
configureNewTiDBCluster: configureV8x1x0,
},
}
for i := range cases {
Expand Down Expand Up @@ -3136,7 +3130,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
15 changes: 7 additions & 8 deletions tests/e2e/util/image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,17 @@ import (
)

var (
TiDBPreviousVersions []string = []string{"v5.0.6", "v5.1.4", "v5.2.4", "v5.3.2", "v5.4.2"}
TiDBPreviousVersions []string = []string{"v6.5.10", "v7.1.5", "v7.5.2", "v8.1.0"}
)

const (
// TiDB Version
TiDBLatestPrev = "v6.0.0"
TiDBLatest = "v6.1.0"
TiDBLatestPrev = "v7.5.3"
TiDBLatest = "v8.1.0" // different version with PDMSImage
TiDBNightlyVersion = "nightly"
// specific version
TiDBV5x0x0 = "v5.0.0"
TiDBV5x0x2 = "v5.0.2"
TiDBV5x3 = "v5.3.0"
TiDBV7x5x0 = "v7.5.0"
TiDBV7x5x3 = "v7.5.3"

PrometheusImage = "prom/prometheus"
PrometheusVersion = "v2.27.1"
Expand All @@ -48,14 +47,14 @@ const (
TiDBMonitorInitializerImage = "pingcap/tidb-monitor-initializer"
TiDBMonitorInitializerVersion = TiDBLatest
GrafanaImage = "grafana/grafana"
GrafanaVersion = "6.1.6"
GrafanaVersion = "7.5.11"
ThanosImage = "thanosio/thanos"
ThanosVersion = "v0.17.2"
DMV2Prev = TiDBLatestPrev
DMV2 = TiDBLatest
TiDBNGMonitoringLatest = TiDBLatest
HelperImage = "alpine:3.16.0"
PDMSImage = "v8.1.0"
PDMSImage = "v8.1.1"
)

func ListImages() []string {
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/util/portforward/portforward.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func (f *portForwarder) forwardPorts(podKey, method string, url *url.URL, addres
readyChan := make(chan struct{})
fw, err := portforward.NewOnAddresses(dialer, addresses, ports, ctx.Done(), readyChan, w, w)
if err != nil {
cancel()
return nil, nil, err
}

Expand Down
Loading

0 comments on commit a17b5d1

Please sign in to comment.