omni_test

omni_test

omnigres : Testing framework

Overview

ID Extension Package Version Category License Language
2970
omni_test
omnigres
0.4.0
FEAT
Apache-2.0
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
----d--
No
No
No
Yes
no
no
Relationships
Schemas omni_test
Requires
dblink
omni_cloudevents
Siblings
omni
omni_auth
omni_aws
omni_cloudevents
omni_containers
omni_credentials
omni_email
omni_http
omni_httpc
omni_httpd
omni_id
omni_json
omni_kube
omni_ledger
omni_manifest
omni_mimetypes
omni_os
omni_polyfill
omni_python
omni_regex
omni_rest
omni_schema
omni_seq
omni_service
omni_session
omni_sql
omni_sqlite
omni_txn
omni_types
omni_var
omni_vfs
omni_vfs_types_v1
omni_web
omni_worker
omni_xml
omni_yaml

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
0.4.0
18
17
16
15
14
omnigres dblink, omni_cloudevents
RPM
PIGSTY
0.4.0
18
17
16
15
14
omnigres_$v -
DEB
PIGSTY
0.4.0
18
17
16
15
14
postgresql-$v-omnigres -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
MISS
PIGSTY 20250120
PIGSTY 20250120
PIGSTY 20250120
PIGSTY 20250120
el8.aarch64
MISS
PIGSTY 20250120
PIGSTY 20250120
PIGSTY 20250120
PIGSTY 20250120
el9.x86_64
MISS
PIGSTY 20250507
PIGSTY 20250507
PIGSTY 20250507
PIGSTY 20250507
el9.aarch64
MISS
PIGSTY 20250507
PIGSTY 20250507
PIGSTY 20250507
PIGSTY 20250507
el10.x86_64
MISS
MISS
MISS
MISS
MISS
el10.aarch64
MISS
MISS
MISS
MISS
MISS
d12.x86_64
MISS
PIGSTY 20250120
PIGSTY 20250120
PIGSTY 20250120
PIGSTY 20250120
d12.aarch64
MISS
PIGSTY 20250120
PIGSTY 20250120
PIGSTY 20250120
PIGSTY 20250120
d13.x86_64
PIGSTY 20251108
PIGSTY 20251108
PIGSTY 20251108
PIGSTY 20251108
PIGSTY 20251108
d13.aarch64
PIGSTY 20251108
PIGSTY 20251108
PIGSTY 20251108
PIGSTY 20251108
PIGSTY 20251108
u22.x86_64
MISS
PIGSTY 20250120
PIGSTY 20250120
PIGSTY 20250120
PIGSTY 20250120
u22.aarch64
MISS
PIGSTY 20250120
PIGSTY 20250120
PIGSTY 20250120
PIGSTY 20250120
u24.x86_64
PIGSTY 20251108
PIGSTY 20251108
PIGSTY 20251108
PIGSTY 20251108
PIGSTY 20251108
u24.aarch64
PIGSTY 20251108
PIGSTY 20251108
PIGSTY 20251108
PIGSTY 20251108
PIGSTY 20251108

Source

pig build pkg omnigres;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install omnigres;		# install via package name, for the active PG version
pig install omni_test;		# install by extension name, for the current active PG version

pig install omni_test -v 18;   # install for PG 18
pig install omni_test -v 17;   # install for PG 17
pig install omni_test -v 16;   # install for PG 16
pig install omni_test -v 15;   # install for PG 15
pig install omni_test -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION omni_test CASCADE; -- requires dblink, omni_cloudevents

Usage

omni_test: Testing framework

The omni_test extension enables test execution within PostgreSQL databases. It is a templated extension.

Setup

CREATE DATABASE myapp_test;
UPDATE pg_database SET datistemplate = true WHERE datname = 'myapp_test';

Writing Tests

Function tests:

CREATE FUNCTION my_test() RETURNS omni_test.test
    LANGUAGE plpgsql AS $$
BEGIN
    -- test assertions here
END;
$$;

Procedure tests (for non-atomic tests requiring COMMIT/ROLLBACK):

CREATE PROCEDURE my_test(INOUT omni_test.test)
    LANGUAGE plpgsql AS $$
BEGIN
    -- test logic
END;
$$;

Test Settings

CREATE PROCEDURE tx_test(INOUT test omni_test.test)
    SET omni_test.transaction_isolation = serializable
    LANGUAGE plpgsql AS $$ ... $$;

Running Tests

SELECT * FROM omni_test.run_tests('myapp_test');

Returns: name, description, start_time, end_time, error_message.

Filtering Tests

-- Exclude tests marked @slow:
SELECT * FROM omni_test.run_tests('myapp_test', filter => '^(?!.*@slow).*');

Each test runs in a fresh copy of the template database.

Last updated on