blob: 5bca51f8111888f511e517d8e2b88ac4505d882a (
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
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#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 {
/**
* Class is just a wrapper for distribution, so little needs to be tested. Just
* that:
*
* - get ideal nodes calls gets propagated correctly.
* - Changes in distribution/cluster state is picked up.
*/
TEST(IdealNodeCalculatorImplTest, test_normal_usage)
{
ClusterState state("storage:10");
Distribution distr(Distribution::getDefaultDistributionConfig(3, 10));
IdealNodeCalculatorImpl impl;
IdealNodeCalculatorConfigurable& configurable(impl);
IdealNodeCalculator& calc(impl);
configurable.setDistribution(distr);
configurable.setClusterState(state);
std::string expected("[storage.8, storage.9, storage.6]");
EXPECT_EQ(
expected,
calc.getIdealStorageNodes(document::BucketId(16, 5)).toString());
}
}
|