Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbogus committed Oct 6, 2018
2 parents 9b1990c + 287c6a1 commit 46e9d5f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"log"
"time"
"math"

"github.com/prometheus/client_golang/prometheus"
)
Expand Down Expand Up @@ -81,7 +82,7 @@ func (ctx *scaleContext) newSize(avg float64, cov float64) (int32, error) {
if cov < ctx.Coverage {
err = fmt.Errorf("not enough metrics to calculate new size, required at least %.2f was %.2f metrics ratio", ctx.Coverage, cov)
} else {
replicas = int32(avg / float64(ctx.Threshold))
replicas = int32(math.Ceil(avg / float64(ctx.Threshold)))
}
return replicas, err
}
2 changes: 1 addition & 1 deletion actuator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestNewSize(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if got, want := s, int32(2); got != want {
if got, want := s, int32(3); got != want {
t.Errorf("Expected %d, got: %d", want, got)
}
}
Expand Down

0 comments on commit 46e9d5f

Please sign in to comment.