satellite/overlay: improve realistic placement rule test
10 --> node tag inclusion in raw format 11 --> same, but using same subnet is enabled 12 --> same as 11 but with US restrictions Change-Id: I20792689e0caf5fe190f566a770d70c3b3824793
This commit is contained in:
parent
973b54365e
commit
4ccce11893
@ -228,6 +228,8 @@ func TestPlacementFromString(t *testing.T) {
|
||||
rules1 := NewPlacementRules()
|
||||
err := rules1.AddPlacementFromString(`
|
||||
10:tag("12whfK1EDvHJtajBiAUeajQLYcWqxcQmdYQU5zX5cCf6bAxfgu4","selected","true");
|
||||
11:annotated(placement(10),annotation("autoExcludeSubnet","off"));
|
||||
12:placement(11) && country("US");
|
||||
0:exclude(placement(10));
|
||||
1:country("EU") && exclude(placement(10));
|
||||
2:country("EEA") && exclude(placement(10));
|
||||
@ -290,6 +292,16 @@ func TestPlacementFromString(t *testing.T) {
|
||||
}
|
||||
assert.False(t, rules1.CreateFilters(6).MatchInclude(node))
|
||||
|
||||
// check if annotation present on 11,12, but not on other
|
||||
for i := 0; i < 20; i++ {
|
||||
subnetDisabled := nodeselection.GetAnnotation(rules1.CreateFilters(storj.PlacementConstraint(i)), nodeselection.AutoExcludeSubnet) == nodeselection.AutoExcludeSubnetOFF
|
||||
if i == 11 || i == 12 {
|
||||
require.True(t, subnetDisabled, "Placement filter should be disabled for %d", i)
|
||||
} else {
|
||||
require.False(t, subnetDisabled, "Placement filter should be enabled for %d", i)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user