Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

refactor: refactor backup_test #721

Merged
merged 3 commits into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 5 additions & 3 deletions src/meta/meta_backup_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <dsn/dist/block_service.h>
#include <dsn/http/http_server.h>
#include <dsn/perf_counter/perf_counter_wrapper.h>
#include <gtest/gtest_prod.h>

#include "meta_data.h"

Expand Down Expand Up @@ -353,6 +354,10 @@ class backup_service
std::string get_backup_path(const std::string &policy_name, int64_t backup_id);

private:
friend class meta_service_test_app;

FRIEND_TEST(meta_backup_service_test, test_add_backup_policy);

void start_create_policy_meta_root(dsn::task_ptr callback);
void start_sync_policies();
error_code sync_policies_from_remote_storage();
Expand All @@ -366,9 +371,6 @@ class backup_service

bool is_valid_policy_name_unlocked(const std::string &policy_name);

private:
friend class meta_service_test_app;

policy_factory _factory;
meta_service *_meta_svc;
server_state *_state;
Expand Down
20 changes: 11 additions & 9 deletions src/meta/meta_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,18 @@ class meta_service : public serverlet<meta_service>
bool check_freeze() const;

private:
friend class test::test_checker;
friend class meta_service_test_app;
friend class bulk_load_service_test;
friend class meta_backup_service_test;
friend class meta_backup_test_base;
friend class meta_duplication_service;
friend class meta_http_service;
friend class meta_http_service_test;
friend class meta_load_balance_test;
friend class meta_service_test;
friend class meta_service_test_app;
friend class meta_test_base;
friend class policy_context_test;
friend class test::test_checker;

replication_options _opts;
meta_options _meta_opts;
Expand All @@ -229,13 +238,6 @@ class meta_service : public serverlet<meta_service>
std::shared_ptr<server_load_balancer> _balancer;
std::shared_ptr<backup_service> _backup_handler;

friend class meta_test_base;
friend class meta_duplication_service;
friend class meta_http_service_test;
friend class meta_load_balance_test;
friend class meta_backup_test_base;
friend class meta_http_service;
friend class meta_service_test;
std::unique_ptr<meta_duplication_service> _dup_svc;

std::unique_ptr<meta_split_service> _split_svc;
Expand Down
24 changes: 13 additions & 11 deletions src/meta/server_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,16 @@

#pragma once

#include <unordered_map>
#include <boost/lexical_cast.hpp>

#include <dsn/dist/replication/replication_other_types.h>
#include <dsn/dist/block_service.h>
#include <dsn/tool-api/task_tracker.h>
#include <dsn/perf_counter/perf_counter_wrapper.h>
#include <dsn/tool-api/task_tracker.h>
#include <gtest/gtest_prod.h>
#include <unordered_map>

#include "common/replication_common.h"
#include "meta_data.h"

#include "meta_service.h"

namespace dsn {
Expand Down Expand Up @@ -292,16 +291,19 @@ class server_state
void transition_staging_state(std::shared_ptr<app_state> &app);

private:
friend class test::test_checker;
friend class meta_service_test_app;
friend class meta_test_base;
friend class meta_duplication_service_test;
friend class meta_load_balance_test;
friend class meta_duplication_service;
friend class meta_split_service;
friend class bulk_load_service;
friend class bulk_load_service_test;
friend class meta_app_operation_test;
friend class meta_duplication_service;
friend class meta_duplication_service_test;
friend class meta_load_balance_test;
friend class meta_split_service;
friend class meta_service_test_app;
friend class meta_test_base;
friend class test::test_checker;

FRIEND_TEST(meta_backup_service_test, test_add_backup_policy);
FRIEND_TEST(policy_context_test, test_app_dropped_during_backup);

dsn::task_tracker _tracker;

Expand Down
Loading