mirror of
https://github.com/sosedoff/pgweb.git
synced 2024-12-13 15:35:28 +03:00
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
|
||||
CGO_ENABLED: 0
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: tests
|
||||
@ -15,7 +19,7 @@ jobs:
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
matrix:
|
||||
pg_version: [12, 13, 14]
|
||||
pg_version: [9.6, 10, 11, 12, 13, 14, 15]
|
||||
|
||||
services:
|
||||
postgres:
|
||||
@ -32,6 +36,13 @@ jobs:
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
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
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
@ -10,7 +10,7 @@
|
||||
DROP DATABASE IF EXISTS "booktown";
|
||||
CREATE DATABASE "booktown";
|
||||
|
||||
\connect booktown postgres
|
||||
-- \connect booktown postgres
|
||||
--
|
||||
-- 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;
|
||||
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
|
||||
113 O'Reilly & Associates O'Reilly & Associates, Inc. 101 Morris St, Sebastopol, CA 95472
|
||||
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"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -143,7 +144,7 @@ func teardownClient() {
|
||||
}
|
||||
}
|
||||
|
||||
func teardown() {
|
||||
func teardown(t *testing.T, allowFail bool) {
|
||||
output, err := exec.Command(
|
||||
testCommands["dropdb"],
|
||||
"-U", serverUser,
|
||||
@ -152,9 +153,13 @@ func teardown() {
|
||||
serverDatabase,
|
||||
).CombinedOutput()
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("Teardown error:", err)
|
||||
fmt.Printf("%s\n", output)
|
||||
if err != nil && strings.Contains(err.Error(), "does not exist") {
|
||||
t.Log("Teardown error:", err)
|
||||
t.Logf("%s\n", output)
|
||||
|
||||
if !allowFail {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -602,7 +607,7 @@ func TestAll(t *testing.T) {
|
||||
|
||||
initVars()
|
||||
setupCommands()
|
||||
teardown()
|
||||
teardown(t, false)
|
||||
setup()
|
||||
setupClient()
|
||||
|
||||
@ -632,5 +637,5 @@ func TestAll(t *testing.T) {
|
||||
testDumpExport(t)
|
||||
|
||||
teardownClient()
|
||||
teardown()
|
||||
teardown(t, true)
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
SELECT
|
||||
p.*,
|
||||
p.oid,
|
||||
p.proname,
|
||||
p.pronamespace,
|
||||
p.proowner,
|
||||
pg_get_functiondef(oid) AS functiondef
|
||||
FROM
|
||||
pg_catalog.pg_proc p
|
||||
|
@ -40,7 +40,6 @@ WITH all_objects AS (
|
||||
WHERE
|
||||
n.nspname !~ '^pg_toast'
|
||||
AND n.nspname NOT IN ('information_schema', 'pg_catalog')
|
||||
AND p.prokind = 'f'
|
||||
)
|
||||
SELECT * FROM all_objects
|
||||
ORDER BY 1, 2
|
||||
|
Loading…
Reference in New Issue
Block a user