Skip to content

Commit 4938abb

Browse files
authored
refactor little-used helper interface (#27894)
There's no production code that expect this specific interface and I tried to remove it because I missed it was only used in a single test. Generally it's a good idea to define such interfaces close to their point of use, but in this case it's not even worth defining an interface for. The "generic memdb" branch I worked on a while back has a `Count` method we'll be able to use for this kind of thing down the road, but for now let's remove this otherwise dead code.
1 parent 7dcbdf0 commit 4938abb

2 files changed

Lines changed: 4 additions & 25 deletions

File tree

helper/iterator/iterator.go

Lines changed: 0 additions & 23 deletions
This file was deleted.

scheduler/scheduler_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"testing"
99

1010
"github.com/hashicorp/nomad/ci"
11-
"github.com/hashicorp/nomad/helper/iterator"
1211
"github.com/hashicorp/nomad/helper/pointer"
1312
"github.com/hashicorp/nomad/helper/uuid"
1413
"github.com/hashicorp/nomad/nomad/mock"
@@ -201,7 +200,10 @@ func TestScheduler_JobRegister_MemoryMaxHonored(t *testing.T) {
201200
case "system", "sysbatch":
202201
nodes, err := h.State.NodesByNodePool(nil, job.NodePool)
203202
must.NoError(t, err)
204-
expectedAllocCount = iterator.Len(nodes)
203+
expectedAllocCount = 0
204+
for raw := nodes.Next(); raw != nil; raw = nodes.Next() {
205+
expectedAllocCount++
206+
}
205207
}
206208
must.Len(t, expectedAllocCount, allocs)
207209
alloc := allocs[0]

0 commit comments

Comments
 (0)