Skip to content

Commit e9395ab

Browse files
authored
fix(e2e): fix e2e in pull-e2e ci (#6351)
1 parent 302acca commit e9395ab

File tree

10 files changed

+21
-10
lines changed

10 files changed

+21
-10
lines changed

cmd/testing-workload/workload.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func Workload(db *sql.DB) error {
3737
db.SetMaxOpenConns(maxConnections)
3838
// Set these variable to avoid too long retry time in testing.
3939
// Downtime may be short but default timeout is too long.
40-
if _, err := db.Exec("set global max_execution_time = 1000"); err != nil {
40+
if _, err := db.Exec("set global max_execution_time = 2000"); err != nil {
4141
return fmt.Errorf("set max_execute_time failed: %w", err)
4242
}
4343
if _, err := db.Exec("set global tidb_backoff_weight = 1"); err != nil {

hack/lib/e2e.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,16 +325,22 @@ function e2e::run() {
325325
# Use individual package paths instead of recursive mode to avoid scanning excluded packages
326326
if [[ "$CI" == "true" ]]; then
327327
echo "running e2e tests in CI mode with options: $*"
328-
$GINKGO -v --timeout=2h --randomize-all --randomize-suites --fail-on-empty --keep-going --race --trace --flake-attempts=2 "$*" "${test_packages[@]}"
328+
$GINKGO -v --timeout=2h --randomize-all --randomize-suites --fail-on-empty --keep-going --trace --label-filter="!k:BR" "$*" "${test_packages[@]}"
329329
else
330330
echo "running e2e tests locally..."
331-
$GINKGO -v "$@" "${test_packages[@]}"
331+
$GINKGO -v --race "$@" "${test_packages[@]}"
332332
fi
333333
}
334334

335335
function e2e::run_upgrade() {
336336
e2e::install_old_version
337-
$GINKGO -v -r --tags=upgrade_e2e --timeout=1h --randomize-all --randomize-suites --fail-on-empty --race --trace --flake-attempts=2 "$ROOT/tests/e2e/upgrade"
337+
if [[ "$CI" == "true" ]]; then
338+
echo "running upgrade e2e tests in CI mode with options: $*"
339+
$GINKGO -v --tags=upgrade_e2e --timeout=1h --randomize-all --randomize-suites --fail-on-empty --keep-going --trace "$*" "$ROOT/tests/e2e/upgrade"
340+
else
341+
echo "running upgrade e2e tests locally..."
342+
$GINKGO -v --tags=upgrade_e2e --race "$@" "$ROOT/tests/e2e/upgrade"
343+
fi
338344
}
339345

340346
function e2e::prepare() {

pkg/client/alias.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ type GracePeriodSeconds = client.GracePeriodSeconds
5050
type MergeFromOption = client.MergeFromOption
5151

5252
var RawPatch = client.RawPatch
53+
54+
var MergeFrom = client.MergeFrom

tests/e2e/br/br.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import (
4343
brframework "github.com/pingcap/tidb-operator/tests/e2e/br/framework"
4444
"github.com/pingcap/tidb-operator/tests/e2e/cluster"
4545
"github.com/pingcap/tidb-operator/tests/e2e/data"
46+
"github.com/pingcap/tidb-operator/tests/e2e/label"
4647
"github.com/pingcap/tidb-operator/tests/e2e/utils/db/blockwriter"
4748
utilimage "github.com/pingcap/tidb-operator/tests/e2e/utils/image"
4849
"github.com/pingcap/tidb-operator/tests/e2e/utils/k8s"
@@ -116,7 +117,7 @@ func (t *testcase) description() string {
116117
return builder.String()
117118
}
118119

119-
var _ = ginkgo.Describe("Backup and Restore", func() {
120+
var _ = ginkgo.Describe("Backup and Restore", label.KindBR, func() {
120121
f := brframework.NewFramework("br")
121122
f.SetupBootstrapSQL("SET PASSWORD FOR 'root'@'%' = 'pingcap';")
122123

tests/e2e/cluster/cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ var _ = Describe("TiDB Cluster", func() {
12021202
_, ready := utiltidb.IsClusterReady(k8sClient, tc.Name, tc.Namespace)
12031203
g.Expect(ready).To(BeTrue())
12041204

1205-
g.Expect(utiltidb.AreAllInstancesReady(k8sClient, pdg,
1205+
g.Expect(utiltidb.AreAllGroupAndInstancesReady(k8sClient, pdg,
12061206
[]*v1alpha1.TiKVGroup{kvg}, []*v1alpha1.TiDBGroup{dbg}, []*v1alpha1.TiFlashGroup{}, nil)).To(Succeed())
12071207
}).WithTimeout(createClusterTimeout).WithPolling(createClusterPolling).Should(Succeed())
12081208

tests/e2e/label/well_known.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ var (
5959
// Kind
6060
KindExample = ginkgo.Label("k:Example")
6161
KindBasic = ginkgo.Label("k:Basic")
62+
KindBR = ginkgo.Label("k:BR")
6263
)
6364

6465
func Features(fs ...metav1alpha1.Feature) ginkgo.Labels {

tests/e2e/tiflash/tiflash.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var _ = ginkgo.Describe("TiFlash", label.TiFlash, func() {
4343
ginkgo.Context("when scaling in TiFlash with two-step deletion", func() {
4444
workload := f.SetupWorkload()
4545

46-
ginkgo.It("should complete the full scale-in flow", func(ctx context.Context) {
46+
ginkgo.PIt("should complete the full scale-in flow", func(ctx context.Context) {
4747
pdg := f.MustCreatePD(ctx)
4848
kvg := f.MustCreateTiKV(ctx, data.WithReplicas[*runtime.TiKVGroup](3))
4949
fg := f.MustCreateTiFlash(ctx, data.WithReplicas[*runtime.TiFlashGroup](2))

tests/e2e/tikv/tikv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ var _ = ginkgo.Describe("TiKV", label.TiKV, func() {
202202
ginkgo.Context("when scaling in TiKV with two-step deletion", func() {
203203
workload := f.SetupWorkload()
204204

205-
ginkgo.It("should complete the full scale-in flow", func(ctx context.Context) {
205+
ginkgo.PIt("should complete the full scale-in flow", func(ctx context.Context) {
206206
pdg := f.MustCreatePD(ctx)
207207
kvg := f.MustCreateTiKV(ctx, data.WithReplicas[*runtime.TiKVGroup](4))
208208
dbg := f.MustCreateTiDB(ctx)

tests/e2e/tikv/topology.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var _ = ginkgo.Describe("Topology", label.TiKV, label.MultipleAZ, label.P0, func
4747
f.MustEvenlySpreadTiKV(ctx, kvg)
4848
})
4949

50-
ginkgo.It("support scale from 3 to 6 and rolling update at same time", label.Scale, label.Update, func(ctx context.Context) {
50+
ginkgo.It("support scale from 3 to 6 and rolling update at same time", ginkgo.Serial, label.Scale, label.Update, func(ctx context.Context) {
5151
ginkgo.By("Creating cluster")
5252
pdg := f.MustCreatePD(ctx)
5353
kvg := f.MustCreateTiKV(ctx,

tests/e2e/upgrade/upgrade.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ var _ = ginkgo.Describe("Upgrade TiDB Operator", label.P0, func() {
119119
ginkgo.By("Upgrading operator and CRDs")
120120
_, err = runCmd("kubectl apply --server-side=true -f manifests/crd/")
121121
gomega.Expect(err).NotTo(gomega.HaveOccurred())
122+
patch := client.MergeFrom(deploy.DeepCopy())
122123
deploy.Spec.Template.Spec.Containers[0].Image = newVersionOperatorImage
123-
gomega.Expect(f.Client.Update(ctx, deploy)).NotTo(gomega.HaveOccurred())
124+
gomega.Expect(f.Client.Patch(ctx, deploy, patch)).NotTo(gomega.HaveOccurred())
124125

125126
ginkgo.By("Waiting for new operator to be ready")
126127
gomega.Eventually(func(g gomega.Gomega) {

0 commit comments

Comments
 (0)