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

[GCS] Delete redis gcs client and redis_xxx_accessor #12996

Merged
merged 19 commits into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
fix object manager ut
  • Loading branch information
clay4megtr committed Dec 23, 2020
commit b0ac4cdd3337395d4c8eac00d734cbd17f3d263d
22 changes: 19 additions & 3 deletions src/ray/object_manager/test/object_manager_stress_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,24 @@ namespace ray {

using rpc::GcsNodeInfo;

static inline void flushall_redis(void) {
static inline bool flushall_redis(void) {
redisContext *context = redisConnect("127.0.0.1", 6379);
if (context == nullptr || context->err) {
return false;
}
freeReplyObject(redisCommand(context, "FLUSHALL"));
freeReplyObject(redisCommand(context, "SET NumRedisShards 1"));
freeReplyObject(redisCommand(context, "LPUSH RedisShards 127.0.0.1:6380"));
redisFree(context);

redisContext *shard_context = redisConnect("127.0.0.1", 6380);
if (shard_context == nullptr || shard_context->err) {
return false;
}
freeReplyObject(redisCommand(shard_context, "FLUSHALL"));
redisFree(shard_context);

return true;
}

int64_t current_time_ms() {
Expand Down Expand Up @@ -72,6 +86,7 @@ class MockServer {
node_info.set_object_manager_port(object_manager_port);

ray::Status status = gcs_client_->Nodes().RegisterSelf(node_info, nullptr);
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
return status;
}

Expand All @@ -86,7 +101,7 @@ class MockServer {
class TestObjectManagerBase : public ::testing::Test {
public:
void SetUp() {
flushall_redis();
WaitForCondition(flushall_redis, 7000);

// start store
socket_name_1 = TestSetupUtil::StartObjectStore();
Expand All @@ -99,7 +114,7 @@ class TestObjectManagerBase : public ::testing::Test {
// start first server
gcs_server_socket_name_ = TestSetupUtil::StartGcsServer("127.0.0.1");
gcs::GcsClientOptions client_options("127.0.0.1", 6379, /*password*/ "",
/*is_test_client=*/true);
/*is_test_client=*/false);
gcs_client_1 = std::make_shared<gcs::ServiceBasedGcsClient>(client_options);
RAY_CHECK_OK(gcs_client_1->Connect(main_service));
ObjectManagerConfig om_config_1;
Expand Down Expand Up @@ -428,5 +443,6 @@ TEST_F(StressTestObjectManager, StartStressTestObjectManager) {
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
ray::TEST_STORE_EXEC_PATH = std::string(argv[1]);
ray::TEST_GCS_SERVER_EXEC_PATH = std::string(argv[2]);
return RUN_ALL_TESTS();
}
3 changes: 3 additions & 0 deletions src/ray/object_manager/test/object_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ using rpc::GcsNodeInfo;
static inline void flushall_redis(void) {
redisContext *context = redisConnect("127.0.0.1", 6379);
freeReplyObject(redisCommand(context, "FLUSHALL"));
freeReplyObject(redisCommand(context, "SET NumRedisShards 1"));
freeReplyObject(redisCommand(context, "LPUSH RedisShards 127.0.0.1:6380"));
redisFree(context);
}

Expand Down Expand Up @@ -489,5 +491,6 @@ int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
ray::TEST_STORE_EXEC_PATH = std::string(argv[1]);
wait_timeout_ms = std::stoi(std::string(argv[2]));
ray::TEST_GCS_SERVER_EXEC_PATH = std::string(argv[3]);
return RUN_ALL_TESTS();
}
8 changes: 6 additions & 2 deletions src/ray/test/run_object_manager_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,22 @@ fi
REDIS_MODULE="./bazel-bin/libray_redis_module.so"
LOAD_MODULE_ARGS=(--loadmodule "${REDIS_MODULE}")
STORE_EXEC="./bazel-bin/plasma_store_server"
GCS_SERVER_EXEC="./bazel-bin/gcs_server"

# Allow cleanup commands to fail.
bazel run //:redis-cli -- -p 6379 shutdown || true
bazel run //:redis-cli -- -p 6380 shutdown || true
sleep 1s
bazel run //:redis-server -- --loglevel warning "${LOAD_MODULE_ARGS[@]}" --port 6379 &
bazel run //:redis-server -- --loglevel warning "${LOAD_MODULE_ARGS[@]}" --port 6380 &
sleep 1s
# Run tests.
./bazel-bin/object_manager_stress_test $STORE_EXEC
./bazel-bin/object_manager_stress_test $STORE_EXEC $GCS_SERVER_EXEC
sleep 1s
# Use timeout=1000ms for the Wait tests.
./bazel-bin/object_manager_test $STORE_EXEC 1000
./bazel-bin/object_manager_test $STORE_EXEC 1000 $GCS_SERVER_EXEC
bazel run //:redis-cli -- -p 6379 shutdown
bazel run //:redis-cli -- -p 6380 shutdown
sleep 1s

# Include raylet integration test once it's ready.
Expand Down