Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.

Commit

Permalink
Extend test to ensure CI coverage hits all lines as does local coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
achilleasa committed Feb 9, 2017
1 parent 17f0e3e commit 7b1ec68
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions server/middleware/concurrency/max_concurrent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,16 @@ func TestSingletonFactoryWithDynamicConfiguration(t *testing.T) {
m1 := f(nextFn)
m2 := f(server.MiddlewareFunc(func(_ context.Context, req transport.ImmutableMessage, res transport.Message) {}))

// Consume all tokens
// Let one request go through
okRes := transport.MakeGenericMessage()
defer okRes.Close()
m2.Handle(ctx, req, okRes)

if _, err := okRes.Payload(); err != nil {
t.Fatalf("expected call to succeed; got %v", err)
}

// Consume all tokens and block
go m1.Handle(ctx, req, res)
go m1.Handle(ctx, req, res)

Expand All @@ -324,7 +333,7 @@ func TestSingletonFactoryWithDynamicConfiguration(t *testing.T) {

// Add more tokens to the pool
s.SetKey(2, configPath+"/max_concurrent", "3")
okRes := transport.MakeGenericMessage()
okRes = transport.MakeGenericMessage()
defer okRes.Close()
m2.Handle(ctx, req, okRes)

Expand Down

0 comments on commit 7b1ec68

Please sign in to comment.