Skip to content

Commit

Permalink
fix up scheduling test
Browse files Browse the repository at this point in the history
  • Loading branch information
chelseakomlo committed Mar 21, 2018
1 parent eb3a53e commit 89ffc96
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
31 changes: 16 additions & 15 deletions scheduler/feasible.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ func (c *DriverChecker) hasDrivers(option *structs.Node) bool {
// corresponds with every driver. As a Nomad server might be on a later
// version than a Nomad client, we need to check for compatibility here
// to verify the client supports this.
if option.Drivers != nil {
driverInfo := option.Drivers[driver]
if driverInfo, ok := option.Drivers[driver]; ok {
if driverInfo == nil {
c.ctx.Logger().
Printf("[WARN] scheduler.DriverChecker: node %v has no driver info set for %v",
Expand All @@ -144,21 +143,23 @@ func (c *DriverChecker) hasDrivers(option *structs.Node) bool {
}

return driverInfo.Detected && driverInfo.Healthy
} else {
value, ok := option.Attributes[driverStr]
if !ok {
return false
}
}

enabled, err := strconv.ParseBool(value)
if err != nil {
c.ctx.Logger().
Printf("[WARN] scheduler.DriverChecker: node %v has invalid driver setting %v: %v",
option.ID, driverStr, value)
return false
}
value, ok := option.Attributes[driverStr]
if !ok {
return false
}

return enabled
enabled, err := strconv.ParseBool(value)
if err != nil {
c.ctx.Logger().
Printf("[WARN] scheduler.DriverChecker: node %v has invalid driver setting %v: %v",
option.ID, driverStr, value)
return false
}

if !enabled {
return false
}
}
return true
Expand Down
2 changes: 1 addition & 1 deletion scheduler/feasible_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func TestDriverChecker(t *testing.T) {
}
}

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

Expand Down

0 comments on commit 89ffc96

Please sign in to comment.