mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 12:06:37 +00:00
@ -10,7 +10,8 @@ import (
|
||||
)
|
||||
|
||||
func TestScale1to5(t *testing.T) {
|
||||
newReplicas := handlers.CalculateReplicas("firing", 1, 20)
|
||||
minReplicas := uint64(1)
|
||||
newReplicas := handlers.CalculateReplicas("firing", 1, 20, minReplicas)
|
||||
if newReplicas != 5 {
|
||||
t.Log("Expected increment in blocks of 5 from 1 to 5")
|
||||
t.Fail()
|
||||
@ -18,7 +19,8 @@ func TestScale1to5(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestScale5to10(t *testing.T) {
|
||||
newReplicas := handlers.CalculateReplicas("firing", 5, 20)
|
||||
minReplicas := uint64(1)
|
||||
newReplicas := handlers.CalculateReplicas("firing", 5, 20, minReplicas)
|
||||
if newReplicas != 10 {
|
||||
t.Log("Expected increment in blocks of 5 from 5 to 10")
|
||||
t.Fail()
|
||||
@ -26,7 +28,8 @@ func TestScale5to10(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestScaleCeilingOf20Replicas_Noaction(t *testing.T) {
|
||||
newReplicas := handlers.CalculateReplicas("firing", 20, 20)
|
||||
minReplicas := uint64(1)
|
||||
newReplicas := handlers.CalculateReplicas("firing", 20, 20, minReplicas)
|
||||
if newReplicas != 20 {
|
||||
t.Log("Expected ceiling of 20 replicas")
|
||||
t.Fail()
|
||||
@ -34,7 +37,8 @@ func TestScaleCeilingOf20Replicas_Noaction(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestScaleCeilingOf20Replicas(t *testing.T) {
|
||||
newReplicas := handlers.CalculateReplicas("firing", 19, 20)
|
||||
minReplicas := uint64(1)
|
||||
newReplicas := handlers.CalculateReplicas("firing", 19, 20, minReplicas)
|
||||
if newReplicas != 20 {
|
||||
t.Log("Expected ceiling of 20 replicas")
|
||||
t.Fail()
|
||||
@ -42,7 +46,8 @@ func TestScaleCeilingOf20Replicas(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBackingOff10to1(t *testing.T) {
|
||||
newReplicas := handlers.CalculateReplicas("resolved", 10, 20)
|
||||
minReplicas := uint64(1)
|
||||
newReplicas := handlers.CalculateReplicas("resolved", 10, 20, minReplicas)
|
||||
if newReplicas != 1 {
|
||||
t.Log("Expected backing off to 1 replica")
|
||||
t.Fail()
|
||||
|
Reference in New Issue
Block a user