satellite/overlay: NR placement should exclude nodes without geofencing information
https://github.com/storj/storj-private/issues/378 Change-Id: If2af02083496e5a8eefe27beabb406388ee50644
This commit is contained in:
parent
ae5e742a12
commit
6f002f4220
@ -68,7 +68,7 @@ func (d *ConfigurablePlacementRule) AddLegacyStaticRules() {
|
||||
d.placements[storj.EU] = nodeselection.NodeFilters{nodeselection.NewCountryFilter(nodeselection.EuCountries)}
|
||||
d.placements[storj.US] = nodeselection.NodeFilters{nodeselection.NewCountryFilter(location.NewSet(location.UnitedStates))}
|
||||
d.placements[storj.DE] = nodeselection.NodeFilters{nodeselection.NewCountryFilter(location.NewSet(location.Germany))}
|
||||
d.placements[storj.NR] = nodeselection.NodeFilters{nodeselection.NewCountryFilter(location.NewFullSet().Without(location.Russia, location.Belarus))}
|
||||
d.placements[storj.NR] = nodeselection.NodeFilters{nodeselection.NewCountryFilter(location.NewFullSet().Without(location.Russia, location.Belarus, location.None))}
|
||||
}
|
||||
|
||||
// AddPlacementRule registers a new placement.
|
||||
|
@ -113,4 +113,35 @@ func TestPlacementFromString(t *testing.T) {
|
||||
|
||||
})
|
||||
|
||||
t.Run("legacy geofencing rules", func(t *testing.T) {
|
||||
p := NewPlacementRules()
|
||||
p.AddLegacyStaticRules()
|
||||
|
||||
t.Run("nr", func(t *testing.T) {
|
||||
nr := p.placements[storj.NR]
|
||||
require.True(t, nr.MatchInclude(&nodeselection.SelectedNode{
|
||||
CountryCode: location.UnitedKingdom,
|
||||
}))
|
||||
require.False(t, nr.MatchInclude(&nodeselection.SelectedNode{
|
||||
CountryCode: location.Russia,
|
||||
}))
|
||||
require.False(t, nr.MatchInclude(&nodeselection.SelectedNode{
|
||||
CountryCode: 0,
|
||||
}))
|
||||
})
|
||||
t.Run("us", func(t *testing.T) {
|
||||
us := p.placements[storj.US]
|
||||
require.True(t, us.MatchInclude(&nodeselection.SelectedNode{
|
||||
CountryCode: location.UnitedStates,
|
||||
}))
|
||||
require.False(t, us.MatchInclude(&nodeselection.SelectedNode{
|
||||
CountryCode: location.Germany,
|
||||
}))
|
||||
require.False(t, us.MatchInclude(&nodeselection.SelectedNode{
|
||||
CountryCode: 0,
|
||||
}))
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user