Skip to content

Commit

Permalink
simplify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
chelseakomlo committed Mar 15, 2018
1 parent 8f3b9fb commit bd262da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions scheduler/feasible.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ func (c *DriverChecker) hasDrivers(option *structs.Node) bool {
return false
}

if !enabled {
return false
}
return enabled
}
}
return true
Expand Down
8 changes: 5 additions & 3 deletions scheduler/feasible_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/hashicorp/nomad/helper/uuid"
"github.com/hashicorp/nomad/nomad/mock"
"github.com/hashicorp/nomad/nomad/structs"
"github.com/stretchr/testify/require"
)

func TestStaticIterator_Reset(t *testing.T) {
Expand Down Expand Up @@ -127,7 +128,9 @@ func TestDriverChecker(t *testing.T) {
}

func TestDriverChecker_HealthChecks(t *testing.T) {
require := require.New(t)
_, ctx := testContext(t)

nodes := []*structs.Node{
mock.Node(),
mock.Node(),
Expand Down Expand Up @@ -182,9 +185,8 @@ func TestDriverChecker_HealthChecks(t *testing.T) {
testDrivers[i]: {},
}
checker := NewDriverChecker(ctx, drivers)
if act := checker.Feasible(c.Node); act != c.Result {
t.Fatalf("case(%d) failed: got %v; want %v", i, act, c.Result)
}
act := checker.Feasible(c.Node)
require.Equal(act, c.Result)
}
}

Expand Down

0 comments on commit bd262da

Please sign in to comment.