From e1241b2cf0e670964a11ceddbae5cb0d7d853435 Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Thu, 13 May 2021 23:04:00 +0100 Subject: [PATCH] initialised newreno in tests --- udp/congestion/newreno/newreno_test.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/udp/congestion/newreno/newreno_test.go b/udp/congestion/newreno/newreno_test.go index 813e400..e771cfd 100644 --- a/udp/congestion/newreno/newreno_test.go +++ b/udp/congestion/newreno/newreno_test.go @@ -21,8 +21,8 @@ type newRenoTest struct { halfRtt time.Duration } -func newNewRenoTest(rtt time.Duration) *newRenoTest { - return &newRenoTest{ +func newNewRenoTest(ctx context.Context, rtt time.Duration) *newRenoTest { + nr := &newRenoTest{ sideA: NewNewReno(), sideB: NewNewReno(), @@ -34,6 +34,12 @@ func newNewRenoTest(rtt time.Duration) *newRenoTest { halfRtt: rtt / 2, } + + p, _ := nr.sideA.Initial(ctx) + p, _, _ = nr.sideB.Handle(ctx, p) + p, _, _ = nr.sideA.Handle(ctx, p) + + return nr } func (n *newRenoTest) Start(ctx context.Context) { @@ -151,7 +157,7 @@ func TestNewReno_Congestion(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - c := newNewRenoTest(rtt) + c := newNewRenoTest(ctx, rtt) c.Start(ctx) c.RunSideA(ctx) c.RunSideB(ctx) @@ -189,7 +195,7 @@ func TestNewReno_Congestion(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - c := newNewRenoTest(rtt) + c := newNewRenoTest(ctx, rtt) c.Start(ctx) c.RunSideA(ctx) c.RunSideB(ctx) @@ -233,7 +239,7 @@ func TestNewReno_Congestion(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - c := newNewRenoTest(rtt) + c := newNewRenoTest(ctx, rtt) c.Start(ctx) c.RunSideA(ctx) c.RunSideB(ctx) @@ -293,7 +299,7 @@ func TestNewReno_Congestion(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - c := newNewRenoTest(rtt) + c := newNewRenoTest(ctx, rtt) c.Start(ctx) c.RunSideA(ctx) c.RunSideB(ctx)