Compare commits

..

1 commit

Author SHA1 Message Date
04cf704010
[#269] netmap: Add tests for non-ascii attributes in SELECT IN
Some checks failed
DCO / DCO (pull_request) Successful in 41s
Tests and linters / Lint (pull_request) Successful in 1m22s
Tests and linters / Tests (pull_request) Failing after 45s
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
2024-09-17 17:32:56 +03:00

View file

@ -548,11 +548,11 @@ func TestPlacementPolicy_NonAsciiAttributes(t *testing.T) {
p := newPlacementPolicy(
1,
[]ReplicaDescriptor{
newReplica(2, "Nodes"),
newReplica(2, "Nodes"),
newReplica(2, ""),
newReplica(2, ""),
},
[]Selector{
newSelector("Nodes", "Цвет", 2, "Colorful", (*Selector).SelectSame),
newSelector("", "Цвет", 2, "Colorful", (*Selector).SelectSame),
},
[]Filter{
newFilter("Colorful", "", "", netmap.OR,
@ -568,15 +568,13 @@ func TestPlacementPolicy_NonAsciiAttributes(t *testing.T) {
nodeInfoFromAttributes("Цвет", "Красный", "Форма", "Круг"),
nodeInfoFromAttributes("Цвет", "Синий", "Форма", "Треугольник"),
nodeInfoFromAttributes("Цвет", "Синий", "Форма", "Круг"),
nodeInfoFromAttributes("Свойство", "Мягкий", "Форма", "Треугольник"),
nodeInfoFromAttributes("Свойство", "Теплый", "Форма", "Круг"),
}
for i := range nodes {
nodes[i].SetPublicKey([]byte{byte(i)})
}
redNodes := nodes[:2]
blueNodes := nodes[2:4]
blueNodes := nodes[2:]
var nm NetMap
nm.SetNodes(nodes)
@ -595,18 +593,13 @@ func TestPlacementPolicy_NonAsciiAttributes(t *testing.T) {
})
}
t.Log(nodesPerReplica[0])
t.Log(nodesPerReplica[1])
t.Log(redNodes)
t.Log(blueNodes)
redMatchFirst := reflect.DeepEqual(redNodes, nodesPerReplica[0])
blueMatchFirst := reflect.DeepEqual(blueNodes, nodesPerReplica[0])
redMatchSecond := reflect.DeepEqual(redNodes, nodesPerReplica[1])
blueMatchSecond := reflect.DeepEqual(blueNodes, nodesPerReplica[1])
assert.True(t, (redMatchFirst && blueMatchSecond) || (blueMatchFirst && redMatchSecond))
assert.True(t, redMatchFirst && blueMatchSecond || blueMatchFirst && redMatchSecond)
}
func TestSelector_SetName(t *testing.T) {