(t *testing.T)
| 28 | } |
| 29 | |
| 30 | func TestManagerReuseSameEntry(t *testing.T) { |
| 31 | var created atomic.Int64 |
| 32 | |
| 33 | manager, err := NewReuseManager(&ReuseConfig{ |
| 34 | MaxConcurrency: "1", |
| 35 | MaxConnections: "1", |
| 36 | HMaxRequestTimes: "10", |
| 37 | }, makeTestTransportFactory(&created)) |
| 38 | if err != nil { |
| 39 | t.Fatal(err) |
| 40 | } |
| 41 | |
| 42 | transport1 := manager.GetTransport().(*ReuseTransport) |
| 43 | id1 := transportID(transport1) |
| 44 | |
| 45 | transport1.Close() |
| 46 | |
| 47 | transport2 := manager.GetTransport().(*ReuseTransport) |
| 48 | id2 := transportID(transport2) |
| 49 | |
| 50 | if id1 != id2 { |
| 51 | t.Fatalf("expected same transport to be reused, got %d and %d", id1, id2) |
| 52 | } |
| 53 | |
| 54 | transport2.Close() |
| 55 | manager.Close() |
| 56 | } |
| 57 | |
| 58 | func TestManagerRespectMaxConnections(t *testing.T) { |
| 59 | var created atomic.Int64 |
nothing calls this directly
no test coverage detected