Skip to content

Commit

Permalink
adding more info for unitest
Browse files Browse the repository at this point in the history
  • Loading branch information
ranlavanet committed Jan 30, 2025
1 parent 876a58d commit 7875fba
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions protocol/provideroptimizer/provider_optimizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,18 @@ func TestProviderOptimizerBasicRelayData(t *testing.T) {
// because of a high minimum entries value, so filter the providers that are only in the worst tier
selectionTier, _, _ := providerOptimizer.CalculateSelectionTiers(providersGen.providersAddresses, nil, cu, requestBlock)
tier3Entries := selectionTier.GetTier(3, providerOptimizer.OptimizerNumTiers, 1)
tier2Entries := selectionTier.GetTier(2, providerOptimizer.OptimizerNumTiers, 1)
worstTierEntries := map[string]struct{}{}
worstTierEntries := map[string]struct{}{
providersGen.providersAddresses[5]: {},
providersGen.providersAddresses[6]: {},
providersGen.providersAddresses[7]: {},
}
for _, entry := range tier3Entries {
// verify that the worst providers are the ones with the bad latency
if entry.Address != providersGen.providersAddresses[5] &&
entry.Address != providersGen.providersAddresses[6] &&
entry.Address != providersGen.providersAddresses[7] {
t.Fatalf("entry %s is not in the worst tier", entry.Address)
}
worstTierEntries[entry.Address] = struct{}{}
}
for _, entry := range tier2Entries {
// remove the providers that are also in tier 2
delete(worstTierEntries, entry.Address)
}

require.NotEqual(t, tier, 3) // we shouldn't pick the low tier providers
Expand Down Expand Up @@ -205,8 +203,9 @@ func TestProviderOptimizerBasicRelayData(t *testing.T) {
secondLeastPicked: secondLeastCount,
}

for address := range worstTierEntries {
require.Contains(t, minimumScores, address)
utils.LavaFormatInfo("results", utils.LogAttr("results", results))
for address := range minimumScores {
require.Contains(t, worstTierEntries, address, results, minimumScores, worstTierEntries)
}
}

Expand Down

0 comments on commit 7875fba

Please sign in to comment.