diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-02-19 05:11:08 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-02-19 07:19:55 +0000 |
commit | d29666a12b9777829c328310ddff6af2580e59c5 (patch) | |
tree | 4c4b26c17af397fb6577cfa506c25e27bd24a41f /vdslib/src/tests | |
parent | 0be286e9026e96f8a1b032a2f2a08e943cf771ec (diff) |
- Reduce visibility of ClusterState and Distribution.
Diffstat (limited to 'vdslib/src/tests')
-rw-r--r-- | vdslib/src/tests/distribution/distributiontest.cpp | 21 | ||||
-rw-r--r-- | vdslib/src/tests/distribution/idealnodecalculatorimpltest.cpp | 2 |
2 files changed, 12 insertions, 11 deletions
diff --git a/vdslib/src/tests/distribution/distributiontest.cpp b/vdslib/src/tests/distribution/distributiontest.cpp index a1c5e541f3b..7210ebd960d 100644 --- a/vdslib/src/tests/distribution/distributiontest.cpp +++ b/vdslib/src/tests/distribution/distributiontest.cpp @@ -7,6 +7,7 @@ #include <vespa/fastos/file.h> #include <vespa/vdslib/distribution/distribution.h> #include <vespa/vdslib/distribution/idealnodecalculator.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vdslib/state/random.h> #include <vespa/vespalib/data/slime/slime.h> #include <vespa/vespalib/gtest/gtest.h> @@ -39,14 +40,13 @@ TEST(DistributionTest, test_verify_java_distributions) tests.push_back("retired"); for (uint32_t i=0; i<tests.size(); ++i) { std::string test = tests[i]; - ClusterState state; + std::string mystate; { std::ifstream in("distribution/testdata/java_" + test + ".state"); - std::string mystate; in >> mystate; in.close(); - state = ClusterState(mystate); } + ClusterState state(mystate); Distribution distr(readConfig<vespa::config::content::StorDistributionConfig>( "file:distribution/testdata/java_" + test + ".cfg")); std::ofstream of("distribution/testdata/cpp_" + test + ".distribution"); @@ -499,21 +499,21 @@ TEST(DistributionTest, test_move) TEST(DistributionTest, test_move_constraints) { - ClusterState systemState("storage:10"); + ClusterState clusterState("storage:10"); Distribution distr(Distribution::getDefaultDistributionConfig(3, 12)); std::vector<std::vector<uint16_t> > initBuckets(10000); for (unsigned i = 0; i < initBuckets.size(); i++) { initBuckets[i] = distr.getIdealStorageNodes( - systemState, document::BucketId(16, i)); + clusterState, document::BucketId(16, i)); sort(initBuckets[i].begin(), initBuckets[i].end()); } { // Check that adding a down node has no effect std::vector<std::vector<uint16_t> > addedDownBuckets(10000); - systemState = ClusterState("storage:11 .10.s:d"); + ClusterState systemState("storage:11 .10.s:d"); for (unsigned i = 0; i < addedDownBuckets.size(); i++) { addedDownBuckets[i] = distr.getIdealStorageNodes( @@ -537,7 +537,7 @@ TEST(DistributionTest, test_move_constraints) // Check that if we disable one node, we're not moving stuff away from // any other node std::vector<std::vector<uint16_t> > removed0Buckets(10000); - systemState = ClusterState("storage:10 .0.s:d"); + ClusterState systemState("storage:10 .0.s:d"); for (unsigned i = 0; i < removed0Buckets.size(); i++) { removed0Buckets[i] = distr.getIdealStorageNodes( @@ -568,7 +568,7 @@ TEST(DistributionTest, test_move_constraints) // Check that if we're adding one node, we're not moving stuff to any // other node std::vector<std::vector<uint16_t> > added10Buckets(10000); - systemState = ClusterState("storage:11"); + ClusterState systemState("storage:11"); for (unsigned i = 0; i < added10Buckets.size(); i++) { added10Buckets[i] = distr.getIdealStorageNodes( @@ -823,10 +823,9 @@ TEST(DistributionTest, test_hierarchical_no_redistribution) EXPECT_EQ(0, v.size()); v.clear(); - state = ClusterState( - "distributor:5 .0.s:d storage:5 .0.s:d .1.s:d .1.m:foo\\x20bar"); + ClusterState state2("distributor:5 .0.s:d storage:5 .0.s:d .1.s:d .1.m:foo\\x20bar"); std::ostringstream ost; - state.printStateGroupwise(ost, distribution, true, ""); + state2.printStateGroupwise(ost, distribution, true, ""); EXPECT_EQ(std::string("\n" "ClusterState(Version: 0, Cluster state: Up, Distribution bits: 16) {\n" " Top group. 2 branches with distribution *|* {\n" diff --git a/vdslib/src/tests/distribution/idealnodecalculatorimpltest.cpp b/vdslib/src/tests/distribution/idealnodecalculatorimpltest.cpp index f54c94ae8f9..5bca51f8111 100644 --- a/vdslib/src/tests/distribution/idealnodecalculatorimpltest.cpp +++ b/vdslib/src/tests/distribution/idealnodecalculatorimpltest.cpp @@ -2,6 +2,8 @@ #include <vespa/config-stor-distribution.h> #include <vespa/vdslib/distribution/idealnodecalculatorimpl.h> +#include <vespa/vdslib/distribution/distribution.h> +#include <vespa/vdslib/state/clusterstate.h> #include <vespa/vespalib/gtest/gtest.h> namespace storage::lib { |