Skip to content

Commit

Permalink
Optimize & Reduce time cost about ci test (#1849) (#1894)
Browse files Browse the repository at this point in the history
* reduce time cost about ci test by parallel
* add `-DNO_WERROR=ON` to cmake config for release-darwin build
* Fix tidb_ghpr_tics_test fail (#1895)

Signed-off-by: Zhigao Tong <[email protected]>
  • Loading branch information
solotzg authored May 12, 2021
1 parent 735293d commit 376f806
Show file tree
Hide file tree
Showing 57 changed files with 360 additions and 107 deletions.
62 changes: 62 additions & 0 deletions .ci/integration_test.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
catchError {
def util = load('util.groovy')

def tidbBranch = ({
def m = params.ghprbCommentBody =~ /tidb\s*=\s*([^\s\\]+)(\s|\\|$)/
if (m) {
return "${m.group(1)}"
}
return params.ghprbTargetBranch ?: 'master'
}).call()

echo "ticsTag=${params.ghprbActualCommit} tidbBranch=${tidbBranch}"

stage("Wait for images") {
util.runClosure("wait-for-images") {
timeout(time: 60, unit: 'MINUTES') {
container("docker") {
sh """
while ! docker pull hub.pingcap.net/tiflash/tics:${params.ghprbActualCommit}; do sleep 60; done
"""
}
}
}
}

parallel (
"tidb ci test": {
def label = "tidb-ci-test"
util.runTest(label, "tics/tests/tidb-ci", tidbBranch)
},
"gtest": {
def label = "gtest"
util.runTest(label, "tics/tests/gtest", tidbBranch)
},
"delta merge test": {
def label = "delta-merge-test"
util.runTest(label, "tics/tests/delta-merge-test", tidbBranch)
},
"fullstack test": {
def label = "fullstack-test"
util.runTest(label, "tics/tests/fullstack-test", tidbBranch)
},
"fullstack test2": {
def label = "fullstack-test2"
util.runTest(label, "tics/tests/fullstack-test2", tidbBranch)
},
"mutable test": {
def label = "mutable-test"
util.runTest(label, "tics/tests/mutable-test", tidbBranch)
},
)
}

stage('Summary') {
def duration = ((System.currentTimeMillis() - currentBuild.startTimeInMillis) / 1000 / 60).setScale(2, BigDecimal.ROUND_HALF_UP)
def msg = "Build Result: `${currentBuild.currentResult}`" + "\n" +
"Elapsed Time: `${duration} mins`" + "\n" +
"${env.RUN_DISPLAY_URL}"

echo "${msg}"

}
68 changes: 68 additions & 0 deletions .ci/util.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
def checkoutTiCS(commit, pullId) {
def refspec = "+refs/heads/*:refs/remotes/origin/*"
if (pullId) {
refspec += " +refs/pull/${pullId}/*:refs/remotes/origin/pr/${pullId}/*"
}
checkout(changelog: false, poll: false, scm: [
$class : "GitSCM",
branches : [
[name: "${commit}"],
],
userRemoteConfigs: [
[
url : "[email protected]:pingcap/tics.git",
refspec : refspec,
credentialsId: "github-sre-bot-ssh",
]
],
extensions : [
[$class: 'PruneStaleBranch'],
[$class: 'CleanBeforeCheckout'],
],
])
}

def runClosure(label, Closure body) {
podTemplate(name: label, label: label, instanceCap: 15, containers: [
containerTemplate(name: 'dockerd', image: 'docker:18.09.6-dind', privileged: true,
resourceRequestCpu: '5000m', resourceRequestMemory: '10Gi',
resourceLimitCpu: '16000m', resourceLimitMemory: '32Gi'),
containerTemplate(name: 'docker', image: 'hub.pingcap.net/zyguan/docker:build-essential-java',
alwaysPullImage: true, envVars: [
envVar(key: 'DOCKER_HOST', value: 'tcp://localhost:2375'),
], ttyEnabled: true, command: 'cat'),
]) {
node(label) {
body()
}
}
}

def runTest(label, testPath, tidbBranch) {
runClosure(label) {
stage("Checkout") {
dir("tics") {
checkoutTiCS("${params.ghprbActualCommit}", "${params.ghprbPullId}")
}
}
dir(testPath) {
stage("Test") {
timeout(time: 60, unit: 'MINUTES') {
container("docker") {
try {
sh "pwd"
sh "TAG=${params.ghprbActualCommit} BRANCH=${tidbBranch} bash -xe ./run.sh"
} catch (e) {
archiveArtifacts(artifacts: "log/**/*.log", allowEmptyArchive: true)
sh "find log -name '*.log' | xargs tail -n 500"
sh "docker ps -a"
throw e
}
}
}
}
}
}
}

return this
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,6 @@ release-centos7/tiflash
release-centos7/build-release
release-darwin/tiflash
release-darwin/build-release
tests/docker/data
tests/docker/log
tests/fullstack-test/dml/dml_gen/*
tests/mutable-test/mutable_dedup/skipping.visual.test/*
tests/mutable-test/mutable_dedup/small_parts.visual.test/*
libs/libtiflash-proxy
Expand Down
2 changes: 1 addition & 1 deletion libs/libdaemon/src/BaseDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ void BaseDaemon::buildLoggers(Poco::Util::AbstractConfiguration & config)
// Split log and error log.
Poco::AutoPtr<SplitterChannel> split = new SplitterChannel;

auto log_level = normalize(config.getString("logger.level", "trace"));
auto log_level = normalize(config.getString("logger.level", "debug"));
const auto log_path = config.getString("logger.log", "");
if (!log_path.empty())
{
Expand Down
3 changes: 2 additions & 1 deletion release-darwin/build/build-tiflash-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ cmake "$SRCPATH" \
-DENABLE_EMBEDDED_COMPILER=$ENABLE_EMBEDDED_COMPILER \
-DENABLE_ICU=OFF \
-DENABLE_MYSQL=OFF \
-Wno-dev
-Wno-dev \
-DNO_WERROR=ON

make -j $NPROC tiflash

Expand Down
1 change: 1 addition & 0 deletions tests/delta-merge-test/config
1 change: 1 addition & 0 deletions tests/delta-merge-test/mock-test-dt.yaml
21 changes: 21 additions & 0 deletions tests/delta-merge-test/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

source ../docker/util.sh

set_branch

set -xe

# We need to separate mock-test for dt and tmt, since this behavior
# is different in some tests
# * "tmt" engine ONLY support disable_bg_flush = false.
# * "dt" engine ONLY support disable_bg_flush = true.
# (only tics0 up) (for engine DetlaTree)
docker-compose -f mock-test-dt.yaml down
clean_data_log

docker-compose -f mock-test-dt.yaml up -d
docker-compose -f mock-test-dt.yaml exec -T tics0 bash -c 'cd /tests ; ./run-test.sh delta-merge-test'

docker-compose -f mock-test-dt.yaml down
clean_data_log
7 changes: 0 additions & 7 deletions tests/docker/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ version: '2.3'
services:
pd0:
image: hub.pingcap.net/qa/pd:${PD_BRANCH:-master}
ports:
- "2379:2379"
volumes:
- ./config/pd.toml:/pd.toml:ro
- ./data/pd0:/data
Expand All @@ -22,8 +20,6 @@ services:
restart: on-failure
tikv0:
image: hub.pingcap.net/qa/tikv:${TIKV_BRANCH:-master}
ports:
- "20160:20160"
volumes:
- ./config/tikv.toml:/tikv.toml:ro
- ./data/tikv0:/data
Expand All @@ -40,9 +36,6 @@ services:
restart: on-failure
tidb0:
image: hub.pingcap.net/qa/tidb:${TIDB_BRANCH:-master}
ports:
- "4000:4000"
- "10080:10080"
volumes:
- ./config/tidb.toml:/tidb.toml:ro
- ./log/tidb0:/log
Expand Down
7 changes: 0 additions & 7 deletions tests/docker/cluster_new_collation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ version: '2.3'
services:
pd0:
image: hub.pingcap.net/qa/pd:${PD_BRANCH:-master}
ports:
- "2379:2379"
volumes:
- ./config/pd.toml:/pd.toml:ro
- ./data/pd0:/data
Expand All @@ -22,8 +20,6 @@ services:
restart: on-failure
tikv0:
image: hub.pingcap.net/qa/tikv:${TIKV_BRANCH:-master}
ports:
- "20160:20160"
volumes:
- ./config/tikv.toml:/tikv.toml:ro
- ./data/tikv0:/data
Expand All @@ -40,9 +36,6 @@ services:
restart: on-failure
tidb0:
image: hub.pingcap.net/qa/tidb:${TIDB_BRANCH:-master}
ports:
- "4000:4000"
- "10080:10080"
volumes:
- ./config/tidb_new_collation.toml:/tidb.toml:ro
- ./log/tidb0:/log
Expand Down
7 changes: 0 additions & 7 deletions tests/docker/cluster_tidb_fail_point.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ version: '2.3'
services:
pd0:
image: hub.pingcap.net/qa/pd:${PD_BRANCH:-master}
ports:
- "2379:2379"
volumes:
- ./config/pd.toml:/pd.toml:ro
- ./data/pd0:/data
Expand All @@ -22,8 +20,6 @@ services:
restart: on-failure
tikv0:
image: hub.pingcap.net/qa/tikv:${TIKV_BRANCH:-master}
ports:
- "20160:20160"
volumes:
- ./config/tikv.toml:/tikv.toml:ro
- ./data/tikv0:/data
Expand All @@ -42,9 +38,6 @@ services:
image: hub.pingcap.net/qa/tidb:${TIDB_BRANCH:-master}-failpoint
environment:
GO_FAILPOINTS: "github.com/pingcap/tidb/server/enableTestAPI=return"
ports:
- "4000:4000"
- "10080:10080"
volumes:
- ./config/tidb.toml:/tidb.toml:ro
- ./log/tidb0:/log
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/docker/config/tiflash_dt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ http_port = 8123
addr = "0.0.0.0:20170"
advertise-addr = "tiflash0:20170"
data-dir = "/data"
config = "/tikv.toml"
log-file = "/log/tikv.log"
config = "/proxy.toml"
log-file = "/log/proxy.log"
engine-addr = "tiflash0:3930"
status-addr = "0.0.0.0:20181"
advertise-status-addr = "tiflash0:20181"
Expand Down
4 changes: 1 addition & 3 deletions tests/docker/gtest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ services:
tics-gtest:
image: hub.pingcap.net/tiflash/tics:${TAG:-master}
volumes:
- ./config/config.toml:/config.toml:ro
- ./config/users.toml:/users.toml:ro
- ./log/tics-gtest:/tmp/tiflash/log
- ..:/tests
- ./_env.sh:/tests/_env.sh
- ../docker/_env.sh:/tests/_env.sh
entrypoint: sleep infinity # just wait
7 changes: 1 addition & 6 deletions tests/docker/mock-test-dt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ services:
# tics0 container is for tests under mutable-test && delta-merge-test directory
tics0:
image: hub.pingcap.net/tiflash/tics:${TAG:-master}
ports:
- "3930:3930"
- "9000:9000"
- "8123:8123"
- "9009:9009"
volumes:
- ./config/tics_dt.toml:/config.toml:ro
- ./config/users.toml:/users.toml:ro
- ./data/tics_dt:/tmp/tiflash/data
- ./log/tics_dt:/tmp/tiflash/log
- ..:/tests
- ./_env.sh:/tests/_env.sh
- ../docker/_env.sh:/tests/_env.sh
command:
- --config-file
- /config.toml
7 changes: 1 addition & 6 deletions tests/docker/mock-test-tmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ services:
# tics0 container is for tests under mutable-test && delta-merge-test directory
tics0:
image: hub.pingcap.net/tiflash/tics:${TAG:-master}
ports:
- "3930:3930"
- "9000:9000"
- "8123:8123"
- "9009:9009"
volumes:
- ./config/tics_tmt.toml:/config.toml:ro
- ./config/users.toml:/users.toml:ro
- ./data/tics_tmt:/tmp/tiflash/data
- ./log/tics_tmt:/tmp/tiflash/log
- ..:/tests
- ./_env.sh:/tests/_env.sh
- ../docker/_env.sh:/tests/_env.sh
command:
- --config-file
- /config.toml
Loading

0 comments on commit 376f806

Please sign in to comment.