Add one more unit test

This commit is contained in:
Preetha Appan 2018-01-23 16:12:45 -06:00
parent a75540cec6
commit fa18c0def4
No known key found for this signature in database
GPG key ID: 9F7C19990A50EAFC

View file

@ -64,7 +64,7 @@ func TestLimitIterator_ScoreThreshold(t *testing.T) {
}
var nodes []*structs.Node
for i := 0; i < 10; i++ {
for i := 0; i < 5; i++ {
nodes = append(nodes, mock.Node())
}
@ -270,6 +270,32 @@ func TestLimitIterator_ScoreThreshold(t *testing.T) {
limit: 2,
maxSkip: 2,
},
{
desc: "maxSkip is more than available nodes",
nodes: []*RankedNode{
{
Node: nodes[0],
Score: -2,
},
{
Node: nodes[1],
Score: 1,
},
},
expectedOut: []*RankedNode{
{
Node: nodes[1],
Score: 1,
},
{
Node: nodes[0],
Score: -2,
},
},
threshold: -1,
limit: 2,
maxSkip: 10,
},
}
for _, tc := range testCases {