Improved Pg test matrix (#616)
* Add postgres 10/11 to test matrix * Add docker-compose file fo running multiple postgres versions locally * Fix client test for pg 10, modify function details to include specific fields * Try to install latest postgres client * Add concurrency setting
This commit is contained in:
parent
4c40eef99a
commit
0dfec506cf
13
.github/workflows/checks.yml
vendored
13
.github/workflows/checks.yml
vendored
@ -8,6 +8,10 @@ env:
|
|||||||
GO_VERSION: 1.19
|
GO_VERSION: 1.19
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
name: tests
|
name: tests
|
||||||
@ -15,7 +19,7 @@ jobs:
|
|||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
pg_version: [12, 13, 14]
|
pg_version: [9.6, 10, 11, 12, 13, 14, 15]
|
||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
@ -32,6 +36,13 @@ jobs:
|
|||||||
--health-timeout 5s
|
--health-timeout 5s
|
||||||
--health-retries 5
|
--health-retries 5
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install latest Postgres client
|
||||||
|
run: |
|
||||||
|
sudo rm -f /etc/apt/sources.list.d/pgdg.list
|
||||||
|
curl --silent https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add
|
||||||
|
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
|
||||||
|
sudo apt-get update && sudo apt-get install -y postgresql-client-15
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
DROP DATABASE IF EXISTS "booktown";
|
DROP DATABASE IF EXISTS "booktown";
|
||||||
CREATE DATABASE "booktown";
|
CREATE DATABASE "booktown";
|
||||||
|
|
||||||
\connect booktown postgres
|
-- \connect booktown postgres
|
||||||
--
|
--
|
||||||
-- TOC Entry ID 2 (OID 2991542)
|
-- TOC Entry ID 2 (OID 2991542)
|
||||||
--
|
--
|
||||||
@ -1293,7 +1293,7 @@ CREATE VIEW "recent_shipments" as SELECT count(*) AS num_shipped, max(shipments.
|
|||||||
|
|
||||||
|
|
||||||
COPY "publishers" FROM stdin;
|
COPY "publishers" FROM stdin;
|
||||||
150 Kids Can Press Kids Can Press, 29 Birch Ave. Toronto, ON M4V 1E2
|
150 Kids Can Press Kids Can Press, 29 Birch Ave. Toronto,<EFBFBD>ON<EFBFBD><EFBFBD>M4V 1E2
|
||||||
91 Henry Holt & Company, Inc. Henry Holt & Company, Inc. 115 West 18th Street New York, NY 10011
|
91 Henry Holt & Company, Inc. Henry Holt & Company, Inc. 115 West 18th Street New York, NY 10011
|
||||||
113 O'Reilly & Associates O'Reilly & Associates, Inc. 101 Morris St, Sebastopol, CA 95472
|
113 O'Reilly & Associates O'Reilly & Associates, Inc. 101 Morris St, Sebastopol, CA 95472
|
||||||
62 Watson-Guptill Publications 1515 Boradway, New York, NY 10036
|
62 Watson-Guptill Publications 1515 Boradway, New York, NY 10036
|
||||||
|
48
docker-compose-pg.yml
Normal file
48
docker-compose-pg.yml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
x-base: &base
|
||||||
|
environment: &env
|
||||||
|
POSTGRES_DB: pgweb
|
||||||
|
POSTGRES_PASSWORD: pgweb
|
||||||
|
POSTGRES_USER: pgweb
|
||||||
|
healthcheck:
|
||||||
|
test: pg_isready -U pgweb -h 127.0.0.1
|
||||||
|
interval: 5s
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres15:
|
||||||
|
<<: *base
|
||||||
|
image: postgres:15
|
||||||
|
ports:
|
||||||
|
- 5433:5432
|
||||||
|
postgres14:
|
||||||
|
<<: *base
|
||||||
|
image: postgres:14
|
||||||
|
ports:
|
||||||
|
- 5434:5432
|
||||||
|
postgres13:
|
||||||
|
<<: *base
|
||||||
|
image: postgres:13
|
||||||
|
ports:
|
||||||
|
- 5435:5432
|
||||||
|
postgres12:
|
||||||
|
<<: *base
|
||||||
|
image: postgres:12
|
||||||
|
ports:
|
||||||
|
- 5436:5432
|
||||||
|
postgres11:
|
||||||
|
<<: *base
|
||||||
|
image: postgres:11
|
||||||
|
ports:
|
||||||
|
- 5437:5432
|
||||||
|
postgres10:
|
||||||
|
<<: *base
|
||||||
|
image: postgres:10
|
||||||
|
ports:
|
||||||
|
- 5438:5432
|
||||||
|
postgres9.6:
|
||||||
|
<<: *base
|
||||||
|
image: postgres:9.6
|
||||||
|
ports:
|
||||||
|
- 5439:5432
|
@ -7,6 +7,7 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -143,7 +144,7 @@ func teardownClient() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func teardown() {
|
func teardown(t *testing.T, allowFail bool) {
|
||||||
output, err := exec.Command(
|
output, err := exec.Command(
|
||||||
testCommands["dropdb"],
|
testCommands["dropdb"],
|
||||||
"-U", serverUser,
|
"-U", serverUser,
|
||||||
@ -152,9 +153,13 @@ func teardown() {
|
|||||||
serverDatabase,
|
serverDatabase,
|
||||||
).CombinedOutput()
|
).CombinedOutput()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil && strings.Contains(err.Error(), "does not exist") {
|
||||||
fmt.Println("Teardown error:", err)
|
t.Log("Teardown error:", err)
|
||||||
fmt.Printf("%s\n", output)
|
t.Logf("%s\n", output)
|
||||||
|
|
||||||
|
if !allowFail {
|
||||||
|
assert.NoError(t, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,7 +607,7 @@ func TestAll(t *testing.T) {
|
|||||||
|
|
||||||
initVars()
|
initVars()
|
||||||
setupCommands()
|
setupCommands()
|
||||||
teardown()
|
teardown(t, false)
|
||||||
setup()
|
setup()
|
||||||
setupClient()
|
setupClient()
|
||||||
|
|
||||||
@ -632,5 +637,5 @@ func TestAll(t *testing.T) {
|
|||||||
testDumpExport(t)
|
testDumpExport(t)
|
||||||
|
|
||||||
teardownClient()
|
teardownClient()
|
||||||
teardown()
|
teardown(t, true)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
SELECT
|
SELECT
|
||||||
p.*,
|
p.oid,
|
||||||
|
p.proname,
|
||||||
|
p.pronamespace,
|
||||||
|
p.proowner,
|
||||||
pg_get_functiondef(oid) AS functiondef
|
pg_get_functiondef(oid) AS functiondef
|
||||||
FROM
|
FROM
|
||||||
pg_catalog.pg_proc p
|
pg_catalog.pg_proc p
|
||||||
|
@ -40,7 +40,6 @@ WITH all_objects AS (
|
|||||||
WHERE
|
WHERE
|
||||||
n.nspname !~ '^pg_toast'
|
n.nspname !~ '^pg_toast'
|
||||||
AND n.nspname NOT IN ('information_schema', 'pg_catalog')
|
AND n.nspname NOT IN ('information_schema', 'pg_catalog')
|
||||||
AND p.prokind = 'f'
|
|
||||||
)
|
)
|
||||||
SELECT * FROM all_objects
|
SELECT * FROM all_objects
|
||||||
ORDER BY 1, 2
|
ORDER BY 1, 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user