Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
GehaFearless committed Nov 6, 2023
1 parent 8f3c7e1 commit 989ce80
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
17 changes: 15 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ function run_test()
m_count=3
if [ "${module}" == "recovery_test" ]; then
m_count=1
opts="meta_state_service_type=meta_state_service_simple,distributed_lock_service_type=distributed_lock_service_simple"
fqdn=`hostname -f`
opts="server_list=$fqdn:34601,meta_state_service_type=meta_state_service_simple,distributed_lock_service_type=distributed_lock_service_simple"
fi
if [ "${module}" == "backup_restore_test" ]; then
opts="cold_backup_disabled=false,cold_backup_checkpoint_reserve_minutes=0,cold_backup_root=onebox"
Expand All @@ -485,7 +486,19 @@ function run_test()
run_start_zk
fi
pushd ${BUILD_LATEST_DIR}/bin/${module}
sed -i "s/@LOCAL_HOSTNAME@/${LOCAL_HOSTNAME}/g" ./config.ini
local function_tests=(
backup_restore_test
recovery_test
restore_test
base_api_test
throttle_test
bulk_load_test
detect_hotspot_test
partition_split_test
)
if [[ "${function_tests[@]}" =~ "${test_modules}" ]]; then
sed -i "s/@LOCAL_HOSTNAME@/${LOCAL_HOSTNAME}/g" ./config.ini
fi
REPORT_DIR=${REPORT_DIR} TEST_BIN=${module} TEST_OPTS=${test_opts} ./run.sh
if [ $? != 0 ]; then
echo "run test \"$module\" in `pwd` failed"
Expand Down
4 changes: 2 additions & 2 deletions src/client_lib/pegasus_client_factory_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ pegasus_client *pegasus_client_factory_impl::get_client(const char *cluster_name
const char *app_name)
{
if (cluster_name == nullptr || cluster_name[0] == '\0') {
LOG_ERROR("invalid parameter 'cluster_name'");
LOG_ERROR("invalid parameter 'cluster_name' {}", cluster_name);
return nullptr;
}
if (app_name == nullptr || app_name[0] == '\0') {
LOG_ERROR("invalid parameter 'app_name'");
LOG_ERROR("invalid parameter 'app_name' {}", app_name);
return nullptr;
}

Expand Down
3 changes: 2 additions & 1 deletion src/meta/meta_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ error_code meta_service::start()
_failure_detector->acquire_leader_lock();
CHECK(_failure_detector->get_leader(nullptr), "must be primary at this point");
LOG_INFO("{}({}) got the primary lock, start to recover server state from remote storage",
dsn_primary_host_port(), dsn_primary_address());
dsn_primary_host_port(),
dsn_primary_address());

// initialize the load balancer
server_load_balancer *balancer = utils::factory_store<server_load_balancer>::create(
Expand Down
6 changes: 4 additions & 2 deletions src/test/function_test/recovery/test_recovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// IWYU pragma: no_include <gtest/gtest-message.h>
// IWYU pragma: no_include <gtest/gtest-test-part.h>
#include <gtest/gtest.h>
#include <unistd.h>
#include <algorithm>
#include <chrono>
#include <iostream>
Expand Down Expand Up @@ -75,8 +76,9 @@ class recovery_test : public test_util
std::vector<dsn::host_port> result;
result.reserve(ports.size());
for (const int &p : ports) {
dsn::rpc_address addr(global_env::instance()._host_ip.c_str(), p);
dsn::host_port hp(addr);
char hostname[1024];
gethostname(hostname, 1024);
dsn::host_port hp(hostname, p);
result.push_back(hp);
}
return result;
Expand Down

0 comments on commit 989ce80

Please sign in to comment.