提交 dea2bd9b 编写于 作者: 小地鼠家的小松鼠's avatar 小地鼠家的小松鼠 提交者: QinZuoyan

fix: unit test failed and update rdsn (#384)

上级 695ad274
......@@ -20,7 +20,7 @@ cache:
- apt
before_install:
- wget https://media.githubusercontent.com/media/XiaoMi/pegasus-common/master/build-depends.tar.gz
- wget https://github.com/XiaoMi/pegasus-common/releases/download/deps/build-depends.tar.gz
- tar xfz build-depends.tar.gz
- rm -f build-depends.tar.gz
- cd packages
......@@ -35,8 +35,8 @@ install:
before_script:
- cd rdsn/thirdparty
- wget https://media.githubusercontent.com/media/XiaoMi/pegasus-common/master/pegasus-thirdparty-prebuild.tar.gz
- tar xfz pegasus-thirdparty-prebuild.tar.gz
- wget https://github.com/XiaoMi/pegasus-common/releases/download/deps/pegasus-thirdparty-prebuild.tar.gz
- tar xf pegasus-thirdparty-prebuild.tar.gz
- rm -f pegasus-thirdparty-prebuild.tar.gz
- cd ../..
- ulimit -c unlimited -S
......
Subproject commit fb3ed3bc5866bb3a7435e6f6fff31ff0dc5fa565
Subproject commit c3c13269083506ec28a7d3b931261f51b6c5f741
......@@ -308,11 +308,13 @@ function usage_test()
echo " -h|--help print the help info"
echo " -m|--modules set the test modules: pegasus_unit_test pegasus_function_test"
echo " -k|--keep_onebox whether keep the onebox after the test[default false]"
echo " --on_travis run tests on travis without some time-cosuming function tests"
}
function run_test()
{
local test_modules=""
local clear_flags="1"
local on_traivs=""
while [[ $# > 0 ]]; do
key="$1"
case $key in
......@@ -327,6 +329,9 @@ function run_test()
-k|--keep_onebox)
clear_flags=""
;;
--on_travis)
on_travis="--on_travis"
;;
*)
echo "Error: unknow option \"$key\""
echo
......@@ -349,7 +354,7 @@ function run_test()
for module in `echo $test_modules`; do
pushd $ROOT/src/builder/bin/$module
REPORT_DIR=$REPORT_DIR ./run.sh
REPORT_DIR=$REPORT_DIR ./run.sh $on_travis
if [ $? != 0 ]; then
echo "run test \"$module\" in `pwd` failed"
exit 1
......
......@@ -30,7 +30,7 @@ if [ ! -f zookeeper-3.4.6.tar.gz ]; then
download_url="http://git.n.xiaomi.com/pegasus/packages/raw/master/zookeeper-3.4.6.tar.gz"
wget -T 5 -t 1 $download_url
if [ $? -ne 0 ]; then
download_url="https://github.com/xiaomi/pegasus-common/raw/master/zookeeper-3.4.6.tar.gz"
download_url="https://github.com/XiaoMi/pegasus-common/releases/download/deps/zookeeper-3.4.6.tar.gz"
wget -T 5 -t 1 $download_url
if [ $? -ne 0 ]; then
echo "ERROR: download zookeeper failed"
......@@ -41,7 +41,7 @@ fi
if [ ! -d zookeeper-3.4.6 ]; then
echo "Decompressing zookeeper..."
tar xfz zookeeper-3.4.6.tar.gz
tar xf zookeeper-3.4.6.tar.gz
if [ $? -ne 0 ]; then
echo "ERROR: decompress zookeeper failed"
exit 1
......
......@@ -16,7 +16,7 @@ if [ "$modified" ]; then
exit 1
fi
"${root}"/run.sh build -c --skip_thirdparty --disable_gperf && ./run.sh test
"${root}"/run.sh build -c --skip_thirdparty --disable_gperf && ./run.sh test --on_travis
if [ $? ]; then
echo "travis failed with exit code $?"
......
......@@ -6,7 +6,7 @@
type = meta
name = meta
ports = @META_PORT@
pools = THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_META_STATE,THREAD_POOL_FD,THREAD_POOL_DLOCK
pools = THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER,THREAD_POOL_META_STATE,THREAD_POOL_FD,THREAD_POOL_DLOCK,THREAD_POOL_LOCAL_SERVICE
[apps.replica]
type = replica
......@@ -34,7 +34,7 @@
stderr_start_level = LOG_LEVEL_ERROR
[threadpool..default]
worker_count = 1
worker_count = 4
worker_priority = THREAD_xPRIORITY_NORMAL
partitioned = false
......@@ -87,6 +87,7 @@
server_load_balancer_type = greedy_load_balancer
min_live_node_count_for_unfreeze = 1
cold_backup_disabled = false
recover_from_replica_server = false
[replication]
allow_non_idempotent_write = true
......
......@@ -80,6 +80,8 @@ public:
void test_multi_remove()
{
dsn::fail::setup();
dsn::apps::multi_remove_request request;
dsn::apps::multi_remove_response response;
......@@ -123,6 +125,8 @@ public:
ASSERT_EQ(err, 0);
verify_response(response, 0, decree);
}
dsn::fail::teardown();
}
void test_batched_writes()
......
......@@ -38,7 +38,7 @@ set(MY_PROJ_LIBS
set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config.ini")
set(MY_BOOST_LIBS Boost::system Boost::filesystem)
set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
SET(CMAKE_INSTALL_RPATH ".")
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
......
......@@ -25,7 +25,7 @@ else()
set(MY_PROJ_LIBS ${MY_PROJ_LIBS} gtest)
endif()
set(MY_BOOST_LIBS Boost::system Boost::filesystem)
set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)
set(MY_BINPLACES "config.ini" "run.sh")
......
#!/bin/sh
#!/bin/bash
exit_if_fail() {
if [ $1 != 0 ]; then
......@@ -11,6 +11,23 @@ if [ -z $REPORT_DIR ]; then
REPORT_DIR="./"
fi
# If run function tests on traivs, we exclude some time-consuming tests
# incluing restore test, recovery test
on_travis="NO"
while [ $# -gt 0 ]; do
key="$1"
case $key in
--on_travis)
on_travis="YES"
;;
*)
echo "Error: unknow option \"$key\""
exit 1
;;
esac
shift
done
test_case=pegasus_function_test
config_file=config.ini
table_name=temp
......@@ -31,7 +48,9 @@ GTEST_OUTPUT="xml:$REPORT_DIR/slog_log.xml" GTEST_FILTER="lost_log.*" ./$test_ca
exit_if_fail $? "run test slog_lost failed: $test_case $config_file $table_name"
GTEST_OUTPUT="xml:$REPORT_DIR/recall.xml" GTEST_FILTER="drop_and_recall.*" ./$test_case $config_file $table_name
exit_if_fail $? "run test recall failed: $test_case $config_file $table_name"
GTEST_OUTPUT="xml:$REPORT_DIR/restore.xml" GTEST_FILTER="restore_test.*" ./$test_case $config_file $table_name
exit_if_fail $? "run test restore_test failed: $test_case $config_file $table_name"
GTEST_OUTPUT="xml:$REPORT_DIR/recovery.xml" GTEST_FILTER="recovery_test.*" ./$test_case $config_file $table_name
exit_if_fail $? "run test recovery failed: $test_case $config_file $table_name"
if [ $on_travis == "NO" ]; then
GTEST_OUTPUT="xml:$REPORT_DIR/restore.xml" GTEST_FILTER="restore_test.*" ./$test_case $config_file $table_name
exit_if_fail $? "run test restore_test failed: $test_case $config_file $table_name"
GTEST_OUTPUT="xml:$REPORT_DIR/recovery.xml" GTEST_FILTER="recovery_test.*" ./$test_case $config_file $table_name
exit_if_fail $? "run test recovery failed: $test_case $config_file $table_name"
fi
......@@ -28,18 +28,24 @@ class recovery_test : public testing::Test
protected:
virtual void SetUp()
{
// THREAD_POOL_META_SERVER worker count should be greater than 1
// This function test update 'distributed_lock_service_type' to
// 'distributed_lock_service_simple', which executes in threadpool THREAD_POOL_META_SERVER
// As a result, failure detection lock executes in this pool
// if worker count = 1, it will lead to ERR_TIMEOUT when execute 'ddl_client->do_recovery'
// 1. restart onebox, modify the config
chdir(global_env::instance()._pegasus_root.c_str());
system("./run.sh clear_onebox");
system("cp src/server/config-server.ini config-server-test-recovery.ini");
system("sed -i \"/^meta_state_service_type/c meta_state_service_type = "
system("cp src/server/config.min.ini config-server-test-recovery.ini");
system("sed -i \"/^\\s*meta_state_service_type/c meta_state_service_type = "
"meta_state_service_simple\" config-server-test-recovery.ini");
system("sed -i \"/^distributed_lock_service_type/c distributed_lock_service_type = "
system("sed -i \"/^\\s*distributed_lock_service_type/c distributed_lock_service_type = "
"distributed_lock_service_simple\" config-server-test-recovery.ini");
system("sed -i \"/^server_list/c server_list = @LOCAL_IP@:34601\" "
system("sed -i \"/^\\s*server_list/c server_list = @LOCAL_IP@:34601\" "
"config-server-test-recovery.ini");
system("sed -i \"/^perf_counter_enable_logging/c perf_counter_enable_logging = false\" "
system("sed -i \"/^\\s*perf_counter_enable_logging/c perf_counter_enable_logging = false\" "
"config-server-test-recovery.ini");
system("./run.sh start_onebox -m 1 -r 3 --config_path config-server-test-recovery.ini");
......@@ -158,11 +164,12 @@ public:
void config_meta_to_do_cold_recovery()
{
char command[512];
snprintf(command,
512,
"cd %s && sed -i \"/^recover_from_replica_server/c recover_from_replica_server = "
"true\" onebox/meta1/config.ini",
global_env::instance()._pegasus_root.c_str());
snprintf(
command,
512,
"cd %s && sed -i \"/^\\s*recover_from_replica_server/c recover_from_replica_server = "
"true\" onebox/meta1/config.ini",
global_env::instance()._pegasus_root.c_str());
system(command);
}
......
......@@ -27,10 +27,10 @@ public:
// modify the config to enable backup, and restart onebox
system("./run.sh clear_onebox");
system("cp src/server/config-server.ini config-server-test-restore.ini");
system("sed -i \"/^cold_backup_disabled/c cold_backup_disabled = false\" "
system("cp src/server/config.min.ini config-server-test-restore.ini");
system("sed -i \"/^\\s*cold_backup_disabled/c cold_backup_disabled = false\" "
"config-server-test-restore.ini");
std::string cmd = "sed -i \"/^cold_backup_root/c cold_backup_root = " + cluster_name;
std::string cmd = "sed -i \"/^\\s*cold_backup_root/c cold_backup_root = " + cluster_name;
cmd = cmd + std::string("\" config-server-test-restore.ini");
system(cmd.c_str());
system("./run.sh start_onebox --config_path config-server-test-restore.ini");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册