aboutsummaryrefslogtreecommitdiffstats
path: root/yt/yt/client/unittests/replication_card_ut.cpp
blob: 92bc3a52ebb29efd4d4f76313fd95c5d36c99d09 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include <yt/yt/client/chaos_client/replication_card.h>

#include <yt/yt/core/test_framework/framework.h>

namespace NYT::NChaosClient {
namespace {

////////////////////////////////////////////////////////////////////////////////

class TReplicationCardFetchOptionsTest
    : public ::testing::Test
    , public ::testing::WithParamInterface<std::tuple<
        TReplicationCardFetchOptions,
        TReplicationCardFetchOptions,
        bool>>
{ };

TEST_P(TReplicationCardFetchOptionsTest, Contains)
{
    const auto& params = GetParam();
    auto self = std::get<0>(params);
    auto& other = std::get<1>(params);
    auto expected = std::get<2>(params);


    EXPECT_EQ(self.Contains(other), expected)
        << "progress: " << std::get<0>(params) << std::endl
        << "update: " << std::get<1>(params) << std::endl
        << "expected: " << std::get<2>(params) << std::endl
        << "actual: " << self.Contains(other) << std::endl;
}

INSTANTIATE_TEST_SUITE_P(
    TReplicationCardFetchOptionsTest,
    TReplicationCardFetchOptionsTest,
    ::testing::Values(
        std::tuple(
            TReplicationCardFetchOptions {
                .IncludeCoordinators = true,
                .IncludeProgress = true,
                .IncludeHistory = true,
                .IncludeReplicatedTableOptions = true
            },
            TReplicationCardFetchOptions {
                .IncludeCoordinators = false,
                .IncludeProgress = false,
                .IncludeHistory = false,
                .IncludeReplicatedTableOptions = false
            },
            true),
        std::tuple(
            TReplicationCardFetchOptions {
                .IncludeCoordinators = true,
                .IncludeProgress = true,
                .IncludeHistory = true,
                .IncludeReplicatedTableOptions = true
            },
            TReplicationCardFetchOptions {
                .IncludeCoordinators = true,
                .IncludeProgress = true,
                .IncludeHistory = true,
                .IncludeReplicatedTableOptions = true
            },
            true),
        std::tuple(
            TReplicationCardFetchOptions {
                .IncludeCoordinators = true,
                .IncludeProgress = true,
                .IncludeHistory = true,
                .IncludeReplicatedTableOptions = true
            },
            TReplicationCardFetchOptions {
                .IncludeCoordinators = true,
                .IncludeProgress = false,
                .IncludeHistory = true,
                .IncludeReplicatedTableOptions = false
            },
            true),
        std::tuple(
            TReplicationCardFetchOptions {
                .IncludeCoordinators = true,
                .IncludeProgress = false,
                .IncludeHistory = true,
                .IncludeReplicatedTableOptions = false
            },
            TReplicationCardFetchOptions {
                .IncludeCoordinators = false,
                .IncludeProgress = true,
                .IncludeHistory = true,
                .IncludeReplicatedTableOptions = false
            },
            false)
));

////////////////////////////////////////////////////////////////////////////////

} // namespace
} // namespace NYT::NChaosClient