-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for listener
Close
+ invoke only pool release
Here, follow up #246 by adding a few more tests that verify a listener's state after `Close` has been invoked, including if it returned an error, which we're able to simulate by overriding pgx's `DialFunc` and returning a stand-in stub for an underlying `net.Conn`. Also, remove the explicit `Close` call on an underlying connection in favor of just invoking the pool's `Release` function. In case of an error condition, `Release` will detect that and do the right thing, and pgx is better tested/vetted to make sure that right thing happens.
- Loading branch information
Showing
3 changed files
with
145 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,9 @@ env: | |
# A suitable URL for non-test database. | ||
DATABASE_URL: postgres://postgres:[email protected]:5432/river_dev?sslmode=disable | ||
|
||
# Test database. | ||
TEST_DATABASE_URL: postgres://postgres:[email protected]:5432/river_testdb?sslmode=disable | ||
|
||
on: | ||
push: | ||
branches: | ||
|
@@ -65,9 +68,8 @@ jobs: | |
PGSSLMODE: disable | ||
|
||
- name: Test | ||
working-directory: . | ||
run: go test -p 1 -race ./... | ||
env: | ||
TEST_DATABASE_URL: postgres://postgres:[email protected]:5432/river_testdb?sslmode=disable | ||
|
||
- name: Test cmd/river | ||
working-directory: ./cmd/river | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters