Skip to content
Snippets Groups Projects
Commit c727beaf authored by Michael Paquier's avatar Michael Paquier
Browse files

wal_utils: Add basic set of regression tests for history parsing

parent 2c3fcc4d
No related branches found
No related tags found
No related merge requests found
# Ignore test paths
/results/
Loading
Loading
@@ -3,6 +3,7 @@ MODULES = wal_utils
EXTENSION = wal_utils
DATA = wal_utils--1.0.sql
PGFILEDESC = "wal_utils - Set of tools for WAL data"
REGRESS = parse_wal_history
 
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
Loading
Loading
1 0/09D4F390 no recovery target specified
2 0/117BEB70 no recovery target specified
3 0/187BEB38 no recovery target specified
4 0/188BEB38 no recovery target specified
5 0/189BEB38 no recovery target specified
7 0/249BEB38 no recovery target specified
# Ignore all generated output
/parse_wal_history.out
-- Install extension for tests
CREATE EXTENSION wal_utils;
CREATE TABLE history_data (data text);
-- Note that COPY truncates newlines.
-- Load history file that succeeds
COPY history_data FROM '@abs_srcdir@/data/example_success.history' WITH (FORMAT csv);
SELECT string_agg(data, E'\n') FROM history_data;
SELECT parse_wal_history(string_agg(data, E'\n')) FROM history_data;
DROP TABLE history_data;
-- Install extension for tests
CREATE EXTENSION wal_utils;
CREATE TABLE history_data (data text);
-- Note that COPY truncates newlines.
-- Load history file that succeeds
COPY history_data FROM '@abs_srcdir@/data/example_success.history' WITH (FORMAT csv);
SELECT string_agg(data, E'\n') FROM history_data;
string_agg
------------------------------------------------------
1 0/09D4F390 no recovery target specified+
2 0/117BEB70 no recovery target specified+
3 0/187BEB38 no recovery target specified+
4 0/188BEB38 no recovery target specified+
5 0/189BEB38 no recovery target specified+
7 0/249BEB38 no recovery target specified
(1 row)
SELECT parse_wal_history(string_agg(data, E'\n')) FROM history_data;
parse_wal_history
---------------------------
(1,,0/9D4F390)
(2,0/9D4F390,0/117BEB70)
(3,0/117BEB70,0/187BEB38)
(4,0/187BEB38,0/188BEB38)
(5,0/188BEB38,0/189BEB38)
(7,0/189BEB38,0/249BEB38)
(6 rows)
DROP TABLE history_data;
# Ignore all generated input
/parse_wal_history.sql
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