Move ch ring placement back from old FnLB. (#930)

* fn: bring back CH ring placer into FN repo based on original FnLB
* fn: move placement code into runnerpool directory
This commit is contained in:
Tolga Ceylan
2018-04-10 17:26:24 -07:00
committed by GitHub
parent 95d7379a81
commit e7658db822
23 changed files with 2926 additions and 64 deletions

View File

@@ -150,7 +150,7 @@ func setupMockRunnerPool(expectedRunners []string, execSleep time.Duration, maxC
}
func TestOneRunner(t *testing.T) {
placer := NewNaivePlacer()
placer := pool.NewNaivePlacer()
rp := setupMockRunnerPool([]string{"171.19.0.1"}, 10*time.Millisecond, 5)
call := &mockRunnerCall{slotDeadline: time.Now().Add(1 * time.Second)}
err := placer.PlaceCall(rp, context.Background(), call)
@@ -160,7 +160,7 @@ func TestOneRunner(t *testing.T) {
}
func TestEnforceTimeoutFromContext(t *testing.T) {
placer := NewNaivePlacer()
placer := pool.NewNaivePlacer()
rp := setupMockRunnerPool([]string{"171.19.0.1"}, 10*time.Millisecond, 5)
call := &mockRunnerCall{slotDeadline: time.Now().Add(1 * time.Second)}
ctx, cancel := context.WithDeadline(context.Background(), time.Now())
@@ -172,7 +172,7 @@ func TestEnforceTimeoutFromContext(t *testing.T) {
}
func TestSpilloverToSecondRunner(t *testing.T) {
placer := NewNaivePlacer()
placer := pool.NewNaivePlacer()
rp := setupMockRunnerPool([]string{"171.19.0.1", "171.19.0.2"}, 10*time.Millisecond, 2)
parallelCalls := 3
@@ -200,7 +200,7 @@ func TestSpilloverToSecondRunner(t *testing.T) {
}
func TestEnforceSlotTimeout(t *testing.T) {
placer := NewNaivePlacer()
placer := pool.NewNaivePlacer()
rp := setupMockRunnerPool([]string{"171.19.0.1", "171.19.0.2"}, 10*time.Millisecond, 2)
parallelCalls := 5