(t *testing.T)
| 36 | } |
| 37 | |
| 38 | func TestClientManagerAddWithoutNew(t *testing.T) { |
| 39 | wg := sync.WaitGroup{} |
| 40 | |
| 41 | manager := apns2.ClientManager{ |
| 42 | MaxSize: 1, |
| 43 | MaxAge: 5 * time.Minute, |
| 44 | Factory: apns2.NewClient, |
| 45 | } |
| 46 | |
| 47 | for i := 0; i < 2; i++ { |
| 48 | wg.Add(1) |
| 49 | go func() { |
| 50 | manager.Add(apns2.NewClient(mockCert())) |
| 51 | assert.Equal(t, 1, manager.Len()) |
| 52 | wg.Done() |
| 53 | }() |
| 54 | } |
| 55 | wg.Wait() |
| 56 | } |
| 57 | |
| 58 | func TestClientManagerLenWithoutNew(t *testing.T) { |
| 59 | manager := apns2.ClientManager{ |