Compare commits
1 commit
04cf704010
...
116cfcbf7b
Author | SHA1 | Date | |
---|---|---|---|
116cfcbf7b |
1 changed files with 12 additions and 5 deletions
|
@ -548,11 +548,11 @@ func TestPlacementPolicy_NonAsciiAttributes(t *testing.T) {
|
||||||
p := newPlacementPolicy(
|
p := newPlacementPolicy(
|
||||||
1,
|
1,
|
||||||
[]ReplicaDescriptor{
|
[]ReplicaDescriptor{
|
||||||
newReplica(2, ""),
|
newReplica(2, "Nodes"),
|
||||||
newReplica(2, ""),
|
newReplica(2, "Nodes"),
|
||||||
},
|
},
|
||||||
[]Selector{
|
[]Selector{
|
||||||
newSelector("", "Цвет", 2, "Colorful", (*Selector).SelectSame),
|
newSelector("Nodes", "Цвет", 2, "Colorful", (*Selector).SelectSame),
|
||||||
},
|
},
|
||||||
[]Filter{
|
[]Filter{
|
||||||
newFilter("Colorful", "", "", netmap.OR,
|
newFilter("Colorful", "", "", netmap.OR,
|
||||||
|
@ -568,13 +568,15 @@ func TestPlacementPolicy_NonAsciiAttributes(t *testing.T) {
|
||||||
nodeInfoFromAttributes("Цвет", "Красный", "Форма", "Круг"),
|
nodeInfoFromAttributes("Цвет", "Красный", "Форма", "Круг"),
|
||||||
nodeInfoFromAttributes("Цвет", "Синий", "Форма", "Треугольник"),
|
nodeInfoFromAttributes("Цвет", "Синий", "Форма", "Треугольник"),
|
||||||
nodeInfoFromAttributes("Цвет", "Синий", "Форма", "Круг"),
|
nodeInfoFromAttributes("Цвет", "Синий", "Форма", "Круг"),
|
||||||
|
nodeInfoFromAttributes("Свойство", "Мягкий", "Форма", "Треугольник"),
|
||||||
|
nodeInfoFromAttributes("Свойство", "Теплый", "Форма", "Круг"),
|
||||||
}
|
}
|
||||||
for i := range nodes {
|
for i := range nodes {
|
||||||
nodes[i].SetPublicKey([]byte{byte(i)})
|
nodes[i].SetPublicKey([]byte{byte(i)})
|
||||||
}
|
}
|
||||||
|
|
||||||
redNodes := nodes[:2]
|
redNodes := nodes[:2]
|
||||||
blueNodes := nodes[2:]
|
blueNodes := nodes[2:4]
|
||||||
|
|
||||||
var nm NetMap
|
var nm NetMap
|
||||||
nm.SetNodes(nodes)
|
nm.SetNodes(nodes)
|
||||||
|
@ -593,13 +595,18 @@ 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])
|
redMatchFirst := reflect.DeepEqual(redNodes, nodesPerReplica[0])
|
||||||
blueMatchFirst := reflect.DeepEqual(blueNodes, nodesPerReplica[0])
|
blueMatchFirst := reflect.DeepEqual(blueNodes, nodesPerReplica[0])
|
||||||
|
|
||||||
redMatchSecond := reflect.DeepEqual(redNodes, nodesPerReplica[1])
|
redMatchSecond := reflect.DeepEqual(redNodes, nodesPerReplica[1])
|
||||||
blueMatchSecond := reflect.DeepEqual(blueNodes, 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) {
|
func TestSelector_SetName(t *testing.T) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue