Skip to content

Commit f08d1a2

Browse files
Update tier1Like test topology to reflect current tier1 structure (#5117)
Resolves #4933 This change updates the `tier1Like` topology to contain 7 orgs of 3 validators each. It renames the old `teir1Like` [sic] topology to `slightlyUnbalancedOrgs` and continues to use it in tests that operate over multiple topologies.
2 parents 5e38c8b + 7446ea4 commit f08d1a2

File tree

1 file changed

+49
-9
lines changed

1 file changed

+49
-9
lines changed

src/herder/test/HerderTests.cpp

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5847,10 +5847,39 @@ unbalancedOrgs()
58475847
return {sks, validators};
58485848
}
58495849

5850-
// Generate a tier1-like topology. This topology has 7 HIGH quality orgs, 6 of
5851-
// which have 3 validators and 1 has 5 validators.
5850+
// Generate a tier 1-like topology. This topology has 7 HIGH quality orgs, each
5851+
// with 3 validators.
58525852
static Topology
5853-
teir1Like()
5853+
tier1Like()
5854+
{
5855+
std::vector<SecretKey> sks;
5856+
std::vector<ValidatorEntry> validators;
5857+
int constexpr numOrgs = 7;
5858+
int constexpr validatorsPerOrg = 3;
5859+
5860+
for (int i = 0; i < numOrgs; ++i)
5861+
{
5862+
std::string const org = fmt::format("org-{}", i);
5863+
for (int j = 0; j < validatorsPerOrg; ++j)
5864+
{
5865+
SecretKey const& key =
5866+
sks.emplace_back(SecretKey::pseudoRandomForTesting());
5867+
ValidatorEntry& entry = validators.emplace_back();
5868+
entry.mName = fmt::format("validator-{}-{}", i, j);
5869+
entry.mHomeDomain = org;
5870+
entry.mQuality = ValidatorQuality::VALIDATOR_HIGH_QUALITY;
5871+
entry.mKey = key.getPublicKey();
5872+
entry.mHasHistory = false;
5873+
}
5874+
}
5875+
5876+
return {sks, validators};
5877+
}
5878+
5879+
// Generate a slightly unbalanced topology. This topology has 7 HIGH quality
5880+
// orgs, 6 of which have 3 validators and 1 has 5 validators.
5881+
static Topology
5882+
slightlyUnbalancedOrgs()
58545883
{
58555884
std::vector<SecretKey> sks;
58565885
std::vector<ValidatorEntry> validators;
@@ -6088,7 +6117,12 @@ TEST_CASE("getNodeWeight", "[herder]")
60886117

60896118
SECTION("Tier1-like topology")
60906119
{
6091-
testWeights(teir1Like().second);
6120+
testWeights(tier1Like().second);
6121+
}
6122+
6123+
SECTION("Tier1-like topology with a single unbalanced org")
6124+
{
6125+
testWeights(slightlyUnbalancedOrgs().second);
60926126
}
60936127

60946128
SECTION("Random topology")
@@ -6265,7 +6299,13 @@ TEST_CASE("Fair nomination win rates", "[herder]")
62656299

62666300
SECTION("Tier 1-like topology")
62676301
{
6268-
auto [sks, validators] = teir1Like();
6302+
auto [sks, validators] = tier1Like();
6303+
testWinProbabilities(sks, validators, 10000);
6304+
}
6305+
6306+
SECTION("Tier 1-like topology with a single unbalanced org")
6307+
{
6308+
auto [sks, validators] = slightlyUnbalancedOrgs();
62696309
testWinProbabilities(sks, validators, 10000);
62706310
}
62716311

@@ -6537,19 +6577,19 @@ TEST_CASE("Asymmetric quorum timeouts", "[herder]")
65376577

65386578
SECTION("Tier 1-like topology with replaced org")
65396579
{
6540-
auto t = teir1Like();
6580+
auto t = tier1Like();
65416581
testAsymmetricTimeouts(t, replaceOneOrg(t), numLedgers);
65426582
}
65436583

65446584
SECTION("Tier 1-like topology with 1 added org")
65456585
{
6546-
auto t = teir1Like();
6586+
auto t = tier1Like();
65476587
testAsymmetricTimeouts(t, addOrgs(1, t), numLedgers);
65486588
}
65496589

65506590
SECTION("Tier 1-like topology with 3 added orgs")
65516591
{
6552-
auto t = teir1Like();
6592+
auto t = tier1Like();
65536593
testAsymmetricTimeouts(t, addOrgs(3, t), numLedgers);
65546594
}
65556595
}
@@ -6714,7 +6754,7 @@ TEST_CASE("Unresponsive quorum timeouts", "[herder]")
67146754
// Number of slots to run for
67156755
int constexpr numLedgers = 20000;
67166756

6717-
auto t = teir1Like();
6757+
auto t = tier1Like();
67186758
for (int i = 1; i <= 5; ++i)
67196759
{
67206760
CLOG_INFO(Herder, "Simulating nomination with {} unresponsive nodes",

0 commit comments

Comments
 (0)