-
-
Notifications
You must be signed in to change notification settings - Fork 414
Update err for single conn pool when context.Done() return first #1981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
2d24b5c
62d7cd2
9653a28
ec32de7
2755f6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package pool_test | ||
|
|
||
| import ( | ||
| "context" | ||
| . "github.com/onsi/ginkgo" | ||
| . "github.com/onsi/gomega" | ||
|
|
||
| "github.com/go-pg/pg/v10/internal/pool" | ||
| ) | ||
|
|
||
| var _ = Describe("SingleConnPool", func() { | ||
| var p *pool.SingleConnPool | ||
|
|
||
| BeforeEach(func() { | ||
| p = pool.NewSingleConnPool(nil, &pool.Conn{}) | ||
| }) | ||
|
||
|
|
||
| It("remove a conn due to context is cancelled", func() { | ||
| ctx, cl := context.WithCancel(context.TODO()) | ||
|
||
| cn, err := p.Get(nil) | ||
| Expect(err).To(BeNil()) | ||
| Expect(cn).ToNot(BeNil()) | ||
|
|
||
| cl() | ||
| p.Remove(ctx, cn, nil) | ||
| cn, err = p.Get(nil) | ||
| Expect(cn).To(BeNil()) | ||
| Expect(err).ToNot(BeNil()) | ||
| }) | ||
|
|
||
|
||
| }) | ||
Uh oh!
There was an error while loading. Please reload this page.