diff --git a/pkg/netmap/netmap.go b/pkg/netmap/netmap.go index 95e823b3..e8ea6478 100644 --- a/pkg/netmap/netmap.go +++ b/pkg/netmap/netmap.go @@ -68,6 +68,8 @@ func (m *Netmap) GetContainerNodes(p *PlacementPolicy, pivot []byte) (ContainerN for _, s := range p.Selectors() { result[i] = append(result[i], flattenNodes(c.Selections[s.Name()])...) } + + continue } nodes, ok := c.Selections[r.Selector()] diff --git a/pkg/netmap/selector_test.go b/pkg/netmap/selector_test.go index b1cf378e..20f5bebe 100644 --- a/pkg/netmap/selector_test.go +++ b/pkg/netmap/selector_test.go @@ -119,6 +119,32 @@ func TestPlacementPolicy_LowerBound(t *testing.T) { require.Equal(t, 3, len(v.Flatten())) } +func TestIssue213(t *testing.T) { + p := newPlacementPolicy(1, + []*Replica{ + newReplica(4, ""), + }, + []*Selector{ + newSelector("", "", ClauseDistinct, 4, "LOC_EU"), + }, + []*Filter{ + newFilter("LOC_EU", "Location", "Europe", OpEQ), + }) + nodes := []NodeInfo{ + nodeInfoFromAttributes("Location", "Europe", "Country", "Russia", "City", "Moscow"), + nodeInfoFromAttributes("Location", "Europe", "Country", "Russia", "City", "Saint-Petersburg"), + nodeInfoFromAttributes("Location", "Europe", "Country", "Sweden", "City", "Stockholm"), + nodeInfoFromAttributes("Location", "Europe", "Country", "Finalnd", "City", "Helsinki"), + } + + nm, err := NewNetmap(NodesFromInfo(nodes)) + require.NoError(t, err) + + v, err := nm.GetContainerNodes(p, nil) + require.NoError(t, err) + require.Equal(t, 4, len(v.Flatten())) +} + func TestPlacementPolicy_ProcessSelectors(t *testing.T) { p := newPlacementPolicy(2, nil, []*Selector{