Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mcs: make scheduling server test stable #26

Closed
wants to merge 192 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
dbaeceb
mcs: make scheduling server test stable
lhy1024 Nov 14, 2023
0a544ef
test_1
lhy1024 Nov 14, 2023
2759daa
tests: make TestResetTS stable
lhy1024 Nov 14, 2023
0f63366
test_1
lhy1024 Nov 14, 2023
f99b6db
test_2
lhy1024 Nov 14, 2023
923b9b3
test_3
lhy1024 Nov 14, 2023
54cbed1
test_4
lhy1024 Nov 14, 2023
49f6a7f
test_5
lhy1024 Nov 14, 2023
fba7480
test_6
lhy1024 Nov 14, 2023
c86c51a
test_7
lhy1024 Nov 14, 2023
2604b50
test_8
lhy1024 Nov 14, 2023
1273b6a
test_9
lhy1024 Nov 14, 2023
c76c4de
test_10
lhy1024 Nov 14, 2023
79661b7
remove codecov
lhy1024 Nov 14, 2023
e48580f
test_11
lhy1024 Nov 14, 2023
1f7a0fa
test_12
lhy1024 Nov 14, 2023
927fe13
test_13
lhy1024 Nov 14, 2023
e7a8cb8
test_14
lhy1024 Nov 14, 2023
7972a3c
test_15
lhy1024 Nov 14, 2023
5d12b15
test_16
lhy1024 Nov 14, 2023
350177f
test_17
lhy1024 Nov 14, 2023
43a95ec
test_18
lhy1024 Nov 14, 2023
3d8cd36
test_19
lhy1024 Nov 14, 2023
0ab5d44
test_20
lhy1024 Nov 14, 2023
4f3e332
test_21
lhy1024 Nov 14, 2023
892c243
test_22
lhy1024 Nov 14, 2023
fcf4b8a
test_23
lhy1024 Nov 14, 2023
7f4714d
test_24
lhy1024 Nov 14, 2023
ff5b4a9
test_25
lhy1024 Nov 14, 2023
03c577d
test_26
lhy1024 Nov 14, 2023
b822f3d
test_27
lhy1024 Nov 14, 2023
e022c42
test_28
lhy1024 Nov 14, 2023
a57203d
test_29
lhy1024 Nov 14, 2023
cff2463
test_30
lhy1024 Nov 14, 2023
49b3588
refactor test
lhy1024 Nov 14, 2023
dfd2984
test_31
lhy1024 Nov 14, 2023
e0e8274
test_32
lhy1024 Nov 14, 2023
69406d9
test_33
lhy1024 Nov 14, 2023
d782f0d
test_34
lhy1024 Nov 14, 2023
b5adb62
test_35
lhy1024 Nov 14, 2023
cc0ebc7
test_36
lhy1024 Nov 14, 2023
4553843
test_37
lhy1024 Nov 14, 2023
444b80d
test_38
lhy1024 Nov 14, 2023
d6bf32a
test_39
lhy1024 Nov 14, 2023
3297323
test_40
lhy1024 Nov 14, 2023
4009c65
test_41
lhy1024 Nov 14, 2023
560d535
test_42
lhy1024 Nov 14, 2023
bde565d
test_43
lhy1024 Nov 14, 2023
73dd59f
test_44
lhy1024 Nov 14, 2023
26c4fe0
test_45
lhy1024 Nov 14, 2023
4c5c4b6
test_46
lhy1024 Nov 14, 2023
3cbe200
test_47
lhy1024 Nov 14, 2023
ce37fe2
test_48
lhy1024 Nov 14, 2023
9e7b54b
test_49
lhy1024 Nov 14, 2023
225057b
test_50
lhy1024 Nov 14, 2023
458a721
test_51
lhy1024 Nov 14, 2023
32f600d
test_52
lhy1024 Nov 14, 2023
5ff5aaa
test_53
lhy1024 Nov 14, 2023
7b56954
test_54
lhy1024 Nov 14, 2023
774b9b7
test_55
lhy1024 Nov 14, 2023
6500705
test_56
lhy1024 Nov 14, 2023
80fbb86
test_57
lhy1024 Nov 14, 2023
11019a9
test_58
lhy1024 Nov 14, 2023
2408026
test_59
lhy1024 Nov 15, 2023
3a4380e
test_60
lhy1024 Nov 15, 2023
bee5f4b
test_61
lhy1024 Nov 15, 2023
cbb1058
test_62
lhy1024 Nov 15, 2023
aca738e
test_63
lhy1024 Nov 15, 2023
df972ea
test_64
lhy1024 Nov 15, 2023
2635113
test_65
lhy1024 Nov 15, 2023
f42d2cd
test_66
lhy1024 Nov 15, 2023
6d6b8b9
test_67
lhy1024 Nov 15, 2023
25907c5
test_68
lhy1024 Nov 15, 2023
d7ed3bb
refacator test
lhy1024 Nov 15, 2023
954227f
test_69
lhy1024 Nov 15, 2023
ada7268
test_70
lhy1024 Nov 15, 2023
3fe8b58
test_71
lhy1024 Nov 15, 2023
20aa41f
test_72
lhy1024 Nov 15, 2023
0723a40
test_73
lhy1024 Nov 15, 2023
7a6ba9a
test_74
lhy1024 Nov 15, 2023
d47ccfa
test_75
lhy1024 Nov 15, 2023
3b757b5
test_76
lhy1024 Nov 15, 2023
d2c1387
test_77
lhy1024 Nov 15, 2023
2077fe5
test_78
lhy1024 Nov 15, 2023
ec41c7a
test_79
lhy1024 Nov 15, 2023
43511da
test_80
lhy1024 Nov 15, 2023
70976b5
test_81
lhy1024 Nov 15, 2023
6ca9a4b
test_82
lhy1024 Nov 15, 2023
39621fe
test_83
lhy1024 Nov 15, 2023
86f85ea
test_84
lhy1024 Nov 15, 2023
da02185
test_85
lhy1024 Nov 15, 2023
3012a7b
test_86
lhy1024 Nov 15, 2023
2d9a8e6
test_87
lhy1024 Nov 15, 2023
231df24
test_88
lhy1024 Nov 15, 2023
1d4c1bf
test_89
lhy1024 Nov 15, 2023
6e67735
test_90
lhy1024 Nov 15, 2023
cec3a1e
test_91
lhy1024 Nov 15, 2023
1097457
test_92
lhy1024 Nov 15, 2023
3d11c7b
test_93
lhy1024 Nov 15, 2023
42dc3c6
test_94
lhy1024 Nov 15, 2023
39c4f8c
test_95
lhy1024 Nov 15, 2023
40270a2
test_96
lhy1024 Nov 15, 2023
7a4cbe8
test_97
lhy1024 Nov 15, 2023
b85e8c8
test_98
lhy1024 Nov 15, 2023
460cfe7
test_99
lhy1024 Nov 15, 2023
7303bff
test_100
lhy1024 Nov 15, 2023
d77b9d7
test_101
lhy1024 Nov 15, 2023
1bbbc8f
test_102
lhy1024 Nov 15, 2023
5ec6e15
test_103
lhy1024 Nov 15, 2023
cdbbacc
test_104
lhy1024 Nov 15, 2023
e33c41b
test_105
lhy1024 Nov 15, 2023
a0ca69c
test_106
lhy1024 Nov 15, 2023
9b0202e
test_107
lhy1024 Nov 15, 2023
873f023
test_108
lhy1024 Nov 15, 2023
1180a7c
test_109
lhy1024 Nov 15, 2023
dea700b
test_110
lhy1024 Nov 15, 2023
8af3200
test_111
lhy1024 Nov 15, 2023
97f96c0
test_112
lhy1024 Nov 15, 2023
c7af89b
make TestAPI, TestConfigWatch and TestConfigReplication more stable
lhy1024 Nov 15, 2023
a909548
fix lint
lhy1024 Nov 15, 2023
377472e
test_114
lhy1024 Nov 15, 2023
fedb0a4
test_115
lhy1024 Nov 15, 2023
4135798
test_116
lhy1024 Nov 15, 2023
1a385f3
test_117
lhy1024 Nov 15, 2023
2f7fe0c
test_118
lhy1024 Nov 15, 2023
0e69f50
test_119
lhy1024 Nov 15, 2023
ae9b16e
test_120
lhy1024 Nov 15, 2023
b2a4ca4
test_121
lhy1024 Nov 15, 2023
43c2a6b
test_122
lhy1024 Nov 15, 2023
fc889da
test_123
lhy1024 Nov 15, 2023
8fd065c
test_124
lhy1024 Nov 15, 2023
d8ec4c0
test_125
lhy1024 Nov 15, 2023
527e0e0
test_126
lhy1024 Nov 15, 2023
69d3abb
test_127
lhy1024 Nov 15, 2023
8d8d45a
test_128
lhy1024 Nov 15, 2023
761da78
test_129
lhy1024 Nov 15, 2023
abd30c2
test_130
lhy1024 Nov 15, 2023
a33dd38
test_131
lhy1024 Nov 15, 2023
c966c52
test_132
lhy1024 Nov 15, 2023
b365ac8
test_133
lhy1024 Nov 15, 2023
553c84d
test_134
lhy1024 Nov 15, 2023
dc4b48f
test_135
lhy1024 Nov 15, 2023
ace5bf3
test_136
lhy1024 Nov 15, 2023
73c12c9
test_137
lhy1024 Nov 15, 2023
eb91181
test_138
lhy1024 Nov 15, 2023
31ad159
test_139
lhy1024 Nov 15, 2023
6fdbd21
test_140
lhy1024 Nov 15, 2023
8dc3cfe
test_141
lhy1024 Nov 15, 2023
3453afc
test_142
lhy1024 Nov 15, 2023
6410c4d
test_143
lhy1024 Nov 15, 2023
7313825
test_144
lhy1024 Nov 15, 2023
5f08872
test_145
lhy1024 Nov 15, 2023
c2ec751
test_146
lhy1024 Nov 15, 2023
711caaa
test_147
lhy1024 Nov 15, 2023
4d49f11
test_148
lhy1024 Nov 15, 2023
39b4e33
test_149
lhy1024 Nov 15, 2023
07a8937
test_150
lhy1024 Nov 15, 2023
8b78ba4
test_151
lhy1024 Nov 15, 2023
64adf3e
test_152
lhy1024 Nov 15, 2023
a1eb7b4
test_153
lhy1024 Nov 15, 2023
f9345df
test_154
lhy1024 Nov 16, 2023
058e48d
test_155
lhy1024 Nov 16, 2023
da08788
test_156
lhy1024 Nov 16, 2023
3215d01
test_157
lhy1024 Nov 16, 2023
632fe9d
test_158
lhy1024 Nov 16, 2023
45d0496
test_159
lhy1024 Nov 16, 2023
676fe39
test_160
lhy1024 Nov 16, 2023
e7ff073
test_161
lhy1024 Nov 16, 2023
7e49a20
test_162
lhy1024 Nov 16, 2023
d6a009b
test_163
lhy1024 Nov 16, 2023
c6b7843
test_164
lhy1024 Nov 16, 2023
30e93a8
test_165
lhy1024 Nov 16, 2023
e1f26ff
test_166
lhy1024 Nov 16, 2023
47c48bf
test_167
lhy1024 Nov 16, 2023
8912155
test_168
lhy1024 Nov 16, 2023
12e027e
test_169
lhy1024 Nov 16, 2023
c28a386
test_170
lhy1024 Nov 16, 2023
8ad15a9
test_171
lhy1024 Nov 16, 2023
c683a3e
test_172
lhy1024 Nov 16, 2023
0d8550d
test_173
lhy1024 Nov 16, 2023
06c0dc3
test_174
lhy1024 Nov 16, 2023
7975847
test_175
lhy1024 Nov 16, 2023
bc2f84a
test_176
lhy1024 Nov 16, 2023
14552b8
test_177
lhy1024 Nov 16, 2023
c820755
test_178
lhy1024 Nov 16, 2023
d15f4a5
test_179
lhy1024 Nov 16, 2023
6b57611
test_180
lhy1024 Nov 16, 2023
9e9365b
test_181
lhy1024 Nov 16, 2023
0e1d7f7
test_182
lhy1024 Nov 16, 2023
243f3db
test_183
lhy1024 Nov 16, 2023
b331724
test_184
lhy1024 Nov 16, 2023
7e567cf
test_185
lhy1024 Nov 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions .github/workflows/pd-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,24 @@ jobs:
with:
name: cover-reports
path: covprofile_${{ matrix.worker_id }}
report-coverage:
needs: chunks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download chunk report
uses: actions/download-artifact@v2
with:
name: cover-reports
- name: Merge
env:
TOTAL_JOBS: ${{needs.chunks.outputs.job-total}}
run: for i in $(seq 1 $TOTAL_JOBS); do cat covprofile_$i >> covprofile; done
- name: Send coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV }}
file: ./covprofile
flags: unittests
name: codecov-umbrella
# report-coverage:
# needs: chunks
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Download chunk report
# uses: actions/download-artifact@v2
# with:
# name: cover-reports
# - name: Merge
# env:
# TOTAL_JOBS: ${{needs.chunks.outputs.job-total}}
# run: for i in $(seq 1 $TOTAL_JOBS); do cat covprofile_$i >> covprofile; done
# - name: Send coverage
# uses: codecov/codecov-action@v1
# with:
# token: ${{ secrets.CODECOV }}
# file: ./covprofile
# flags: unittests
# name: codecov-umbrella
15 changes: 15 additions & 0 deletions pkg/utils/testutil/api_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@ func CheckGetJSON(client *http.Client, url string, data []byte, checkOpts ...fun
return checkResp(resp, checkOpts...)
}

// CheckGetUntilStatusCode is used to do get request and do check options.
func CheckGetUntilStatusCode(re *require.Assertions, client *http.Client, url string, code int) error {
var err error
Eventually(re, func() bool {
resp, err2 := apiutil.GetJSON(client, url, nil)
if err2 != nil {
err = err2
return true
}
defer resp.Body.Close()
return resp.StatusCode == code
})
return err
}

// CheckPatchJSON is used to do patch request and do check options.
func CheckPatchJSON(client *http.Client, url string, data []byte, checkOpts ...func([]byte, int, http.Header)) error {
resp, err := apiutil.PatchJSON(client, url, data)
Expand Down
23 changes: 20 additions & 3 deletions server/api/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"testing"
"time"
Expand All @@ -27,6 +28,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/tikv/pd/pkg/core"
"github.com/tikv/pd/pkg/replication"
"github.com/tikv/pd/pkg/utils/apiutil"
tu "github.com/tikv/pd/pkg/utils/testutil"
"github.com/tikv/pd/server"
)
Expand Down Expand Up @@ -188,9 +190,24 @@ func (suite *adminTestSuite) TestResetTS() {
values, err := json.Marshal(args)
suite.NoError(err)
re := suite.Require()
err = tu.CheckPostJSON(testDialClient, url, values,
tu.StatusOK(re),
tu.StringEqual(re, "\"Reset ts successfully.\"\n"))
tu.Eventually(re, func() bool {
resp, err := apiutil.PostJSON(testDialClient, url, values)
re.NoError(err)
defer resp.Body.Close()
b, err := io.ReadAll(resp.Body)
re.NoError(err)
switch resp.StatusCode {
case http.StatusOK:
re.Contains(string(b), "Reset ts successfully.")
return true
case http.StatusForbidden:
re.Contains(string(b), "[PD:etcd:ErrEtcdTxnConflict]etcd transaction failed, conflicted and rolled back")
return false
default:
re.FailNow("unexpected status code %d", resp.StatusCode)
return false
}
})
suite.NoError(err)
t2 := makeTS(32 * time.Hour)
args["tso"] = fmt.Sprintf("%d", t2)
Expand Down
3 changes: 3 additions & 0 deletions server/api/diagnostic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package api
import (
"encoding/json"
"fmt"
"net/http"
"testing"
"time"

Expand Down Expand Up @@ -63,6 +64,8 @@ func (suite *diagnosticTestSuite) TearDownSuite() {

func (suite *diagnosticTestSuite) checkStatus(status string, url string) {
re := suite.Require()
err := tu.CheckGetUntilStatusCode(re, testDialClient, url, http.StatusOK)
suite.NoError(err)
suite.Eventually(func() bool {
result := &schedulers.DiagnosticResult{}
err := tu.ReadGetJSON(re, testDialClient, url, result)
Expand Down
3 changes: 3 additions & 0 deletions tests/integrations/mcs/scheduling/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ func (suite *configTestSuite) TestConfigWatch() {
re.Equal(sc.DefaultSplitMergeInterval, watcher.GetScheduleConfig().SplitMergeInterval.Duration)
re.Equal("0.0.0", watcher.GetClusterVersion().String())
// Update the config and check if the scheduling config watcher can get the latest value.
testutil.Eventually(re, func() bool {
return watcher.GetReplicationConfig().MaxReplicas == 3
})
persistOpts := suite.pdLeaderServer.GetPersistOptions()
persistOpts.SetMaxReplicas(5)
persistConfig(re, suite.pdLeaderServer)
Expand Down
Loading
Loading