Skip to content
Snippets Groups Projects
Commit 003614ad authored by Elliott Shugerman's avatar Elliott Shugerman
Browse files

test all versions

parent d6ef2ead
Branches schonert/patch-1
No related tags found
No related merge requests found
# run-tests --threads=0
use assert
use std log
......@@ -12,14 +14,16 @@ use std log
# }
$env.POSTGRES_CONTAINER_NAME = "postgres"
$env.BACKUP_SERVICE_CONTAINER_NAME = "backup-service"
$env.POSTGRES_USER = "postgres"
$env.POSTGRES_PASSWORD = "secret"
$env.SEED_DATABASE = "pagila"
const DEFAULT_DATABASE = 'postgres'
const base_env = {
POSTGRES_CONTAINER_NAME: "postgres",
BACKUP_SERVICE_CONTAINER_NAME: "backup-service",
POSTGRES_USER: "postgres",
POSTGRES_PASSWORD: "secret",
SEED_DATABASE: "pagila",
}
def exec-sql [--database: string ] {
(
......@@ -73,23 +77,66 @@ def assert-test-db-populated [] {
}
def assert-test-db-dne [] {
# note may log a psql error (database pagila dne)
# TODO: make this do what the name says more directly
let rows = 'SELECT count(1) FROM public.customer;' | exec-sql
assert (($rows | is-empty) or ($rows.count.0 == 0))
}
with-env { POSTGRES_VERSION: "15", ALPINE_VERSION: "3.17" } {
timeit {
delete-services
create-services
create-test-db
populate-test-db
assert-test-db-populated
backup
drop-test-db
assert-test-db-dne
create-test-db # restore needs it to already exist
restore
assert-test-db-populated # asserts there's actually data in the table
delete-services
const version_pairs = [
{ POSTGRES_VERSION: '11', ALPINE_VERSION: '3.10' },
{ POSTGRES_VERSION: '12', ALPINE_VERSION: '3.12' },
{ POSTGRES_VERSION: '13', ALPINE_VERSION: '3.14' },
{ POSTGRES_VERSION: '14', ALPINE_VERSION: '3.16' },
{ POSTGRES_VERSION: '15', ALPINE_VERSION: '3.17' },
{ POSTGRES_VERSION: '16', ALPINE_VERSION: '3.19' },
]
def full-test [postgres_version: string alpine_version: string] {
let full_env = $base_env | merge { POSTGRES_VERSION: $postgres_version, ALPINE_VERSION: $alpine_version };
with-env $full_env {
timeit {
delete-services
create-services
create-test-db
populate-test-db
assert-test-db-populated
backup
drop-test-db
assert-test-db-dne
create-test-db # restore needs it to already exist
restore
assert-test-db-populated # asserts there's actually data in the table
delete-services
}
}
}
#[test]
def test-pg-11 [] {
full-test '11' '3.10'
}
#[test]
def test-pg-12 [] {
full-test '12' '3.12'
}
#[test]
def test-pg-13 [] {
full-test '13' '3.14'
}
#[test]
def test-pg-14 [] {
full-test '14' '3.16'
}
#[test]
def test-pg-15 [] {
full-test '15' '3.17' # TODO: try 18
}
#[test]
def test-pg-16 [] {
full-test '16' '3.19'
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment