From 2ccda7f0c29d6740d733779b28f76942f0d84002 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Sat, 13 Nov 2021 18:47:55 -0500 Subject: [PATCH] Replace Travis with GitHub Workflows Travis has not worked in a while, so switch to GitHub workflows. All previous tests aside from Postgres upgrades have been replicated (and upgrades should be back soon). In the process, discover missing update SQL, so add it to `sql/pgtap--1.1.0--1.2.0.sql`. Yay testing! Also add a workflow for releasing pgTAP with a semantic version tag. --- .gitattributes | 2 +- .github/workflows/release.yml | 37 ++++ .github/workflows/test.yml | 63 +++++++ .gitignore | 1 + .travis.yml | 37 ---- Changes | 15 +- Makefile | 10 +- README.md | 2 +- sql/pgtap--1.1.0--1.2.0.sql | 49 ++++- test/expected/functap.out | 325 +++++++++++++++++----------------- test/sql/functap.sql | 12 +- test/test_MVU.sh | 4 +- tools/pg-travis-test.sh | 192 -------------------- 13 files changed, 331 insertions(+), 418 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml delete mode 100644 tools/pg-travis-test.sh diff --git a/.gitattributes b/.gitattributes index 834f849cc..796ed6fef 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ .gitignore export-ignore .gitattributes export-ignore tocgen export-ignore -.travis.yml export-ignore .release.mmd export-ignore +.github export-ignore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..b46447b7c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: ๐Ÿš€ Release +on: + push: + tags: [v*] +jobs: + release: + name: ๐Ÿš€ Release on GitHub and PGXN + runs-on: ubuntu-latest + container: pgxn/pgxn-tools + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PGXN_USERNAME: ${{ secrets.PGXN_USERNAME }} + PGXN_PASSWORD: ${{ secrets.PGXN_PASSWORD }} + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - name: Bundle the Release + id: bundle + run: pgxn-bundle + - name: Release on PGXN + run: pgxn-release + - name: Generate Release Changes + run: make latest-changes.md + - name: Create GitHub Release + id: release + uses: actions/create-release@v1 + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body_path: latest-changes.md + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.release.outputs.upload_url }} + asset_path: ./${{ steps.bundle.outputs.bundle }} + asset_name: ${{ steps.bundle.outputs.bundle }} + asset_content_type: application/zip diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..ae11b80a7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,63 @@ +name: ๐Ÿ˜ Test +on: + push: + pull_request: + schedule: + - cron: '0 14 3 * *' # Monthly at 2pm on the third +jobs: + build: + strategy: + matrix: + include: + - { version: 14, upgrade_to: "", update_from: 0.99.0 } + - { version: 13, upgrade_to: 14, update_from: 0.99.0 } + - { version: 12, upgrade_to: 13, update_from: 0.99.0 } + - { version: 11, upgrade_to: 12, update_from: 0.99.0 } # Versions prior to 0.99.0 don't support Postgres 11 + - { version: 10, upgrade_to: 11, update_from: 0.95.0 } + - { version: 9.6, upgrade_to: 10, update_from: 0.95.0 } + - { version: 9.5, upgrade_to: 9.6, update_from: 0.95.0 } + - { version: 9.4, upgrade_to: 9.5, update_from: 0.95.0 } + - { version: 9.3, upgrade_to: 9.4, update_from: 0.95.0 } + - { version: 9.2, upgrade_to: 9.3, update_from: "" } # updatecheck is not supported prior to 9.3 + - { version: 9.1, upgrade_to: 9.2, update_from: "" } + # Also test pg_upgrade across many versions + # - { version: 9.1, upgrade_to: 14, update_from: 0.99.0 } + # - { version: 9.4, upgrade_to: 14, update_from: 0.99.0 } + name: ๐Ÿ˜ PostgreSQL ${{ matrix.version }} + runs-on: ubuntu-latest + container: pgxn/pgxn-tools + env: + PGUSER: postgres + UPDATE_FROM: "${{ matrix.update_from }}" + steps: + - run: pg-start ${{ matrix.version }} + - uses: actions/checkout@v2 + + # Basic regression test. + - run: pg-build-test + + # Test update. + - run: 'if [ -d "$UPDATE_FROM" ]; then make uninstall clean updatecheck; fi' + + # Test upgrade. + # - run: ./test/test_MVU.sh -s 55667 55778 "{{ matrix.version }}" "{{ matrix.upgrade_to }}" "/usr/lib/postgresql/{{ matrix.version }}/bin/" "/usr/lib/postgresql/{{ matrix.upgrade_to }}/bin/" + + # Test all, install, test, test-serial, and test-parallel, both from clean + # repo and repeated with existing build, with and without PARALLEL_CONN=1. + - run: make uninstall clean all + - run: make all + - run: make uninstall clean install + - run: make install + - run: "psql -Ec 'CREATE EXTENSION pgtap'" + - run: make uninstall clean test + - run: make test + - run: make uninstall clean test PARALLEL_CONN=1 + - run: make test PARALLEL_CONN=1 + - run: make uninstall clean test-serial + - run: make test-serial + - run: make uninstall clean test-serial PARALLEL_CONN=1 + - run: make test-serial PARALLEL_CONN=1 + - run: make uninstall clean test-parallel + - run: make test-parallel + - run: make uninstall clean test-parallel PARALLEL_CONN=1 + - run: make test-parallel PARALLEL_CONN=1 diff --git a/.gitignore b/.gitignore index 565d29343..fc0b7c6d4 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ bbin *.sql.orig test/build +/latest-changes.md # Misc mac crap .DS_Store diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a148c4453..000000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: c -before_install: - - wget https://gist.githubusercontent.com/petere/5893799/raw/apt.postgresql.org.sh - - sudo sh ./apt.postgresql.org.sh - - sudo rm -vf /etc/apt/sources.list.d/pgdg-source.list - -env: - # WARNING! UPGRADE_TO tests pg_upgrade; UDPATE_FROM tests ALTER EXTENSION! Note UPGRADE vs UPDATE! - - UPGRADE_TO=9.2 PGVERSION=9.1 ALLOW_MISSING_EXTENSIONS=1 - - UPGRADE_TO=9.3 PGVERSION=9.2 ALLOW_MISSING_EXTENSIONS=1 - - UPGRADE_TO=9.4 PGVERSION=9.3 ALLOW_MISSING_EXTENSIONS=1 - - UPGRADE_TO=9.5 PGVERSION=9.4 - - UPGRADE_TO=9.6 PGVERSION=9.5 - - UPGRADE_TO=10 PGVERSION=9.6 - - UPGRADE_TO=11 PGVERSION=10 - - UPGRADE_TO=12 PGVERSION=11 UPDATE_FROM=0.99.0 # Versions prior to 0.99.0 don't support Postgres 11 - - UPGRADE_TO=13 PGVERSION=12 UPDATE_FROM=0.99.0 - - PGVERSION=13 UPDATE_FROM=0.99.0 - - # Duplication below is via s/-.*PGVERSION/- PARALLEL_CONN=1 PGVERSION/ - - PARALLEL_CONN=1 PGVERSION=9.1 ALLOW_MISSING_EXTENSIONS=1 - - PARALLEL_CONN=1 PGVERSION=9.2 ALLOW_MISSING_EXTENSIONS=1 - - PARALLEL_CONN=1 PGVERSION=9.3 ALLOW_MISSING_EXTENSIONS=1 - - PARALLEL_CONN=1 PGVERSION=9.4 - - PARALLEL_CONN=1 PGVERSION=9.5 - - PARALLEL_CONN=1 PGVERSION=9.6 - - PARALLEL_CONN=1 PGVERSION=10 - - PARALLEL_CONN=1 PGVERSION=11 UPDATE_FROM=0.99.0 # Versions prior to 0.99.0 don't support Postgres 11 - - PARALLEL_CONN=1 PGVERSION=12 UPDATE_FROM=0.99.0 - - PARALLEL_CONN=1 PGVERSION=13 UPDATE_FROM=0.99.0 - - # Also test pg_upgrade across many versions - - UPGRADE_TO=13 PGVERSION=9.1 ALLOW_MISSING_EXTENSIONS=1 - - UPGRADE_TO=13 PGVERSION=9.4 -script: bash tools/pg-travis-test.sh - -# vi: noexpandtab ts=2 sw=2 diff --git a/Changes b/Changes index 39bb3800e..f0438b06f 100644 --- a/Changes +++ b/Changes @@ -47,21 +47,22 @@ Revision history for pgTAP * Remove support for PostgreSQL older than 9.1. Note that some automated tests don't run on versions older than 9.4, so it's recommended you run PostgreSQL 9.4 at minimum. -* Add a `throw_excepton` argument to `finish()`. `finish(true)` will raise an +* Add a `throw_exception` argument to `finish()`. `finish(true)` will raise an exception if any tests failed. Thanks to Stephen Paul Weber for the idea (#80), and Rodolphe Quiรฉdeville for most of the work (#104)! -* Make description optional for col_not_null() (#221). +* Make description optional for `col_not_null()` (#221). * Fix syntax of test_user function example in the docs (#208). Thanks to PeteDevoy for the patch! -* Fix issue with pgtap-core referencing pg_proc.proisagg on PostgreSQL 11+ (#197) +* Fix issue with `pgtap-core` referencing `pg_proc.proisagg` on PostgreSQL 11+ + (#197). * Add PostgreSQL 12.0 to automated tests (#223). -* Fix pgtap_version(), which incorrectly returned 0.99 when upgrading from +* Fix `pgtap_version()`, which incorrectly returned 0.99 when upgrading from version 0.99.0 to 1.0.0 (#214). -* Fix issue with using pg_upgrade to PostgreSQL 11+ with pgTap installed (#201, - #215). +* Fix issue with using `pg_upgrade` to PostgreSQL 11+ with pgTAP installed + (#201, #215). * Start using `DEFAULT` in functions. * Add automated testing of extension upgrade scripts (#128), as well as testing - of pg_upgrade with pgTap installed (#218, #222). + of `pg_upgrade` with pgTAP installed (#218, #222). 1.0.0 2019-02-21T22:39:42Z -------------------------- diff --git a/Makefile b/Makefile index ead436bc7..fb5cf8451 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ MAINEXT = pgtap EXTENSION = $(MAINEXT) EXTVERSION = $(shell grep default_version $(MAINEXT).control | \ sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/") +DISTVERSION = $(shell grep -m 1 '[[:space:]]\{3\}"version":' META.json | \ + sed -e 's/[[:space:]]*"version":[[:space:]]*"\([^"]*\)",\{0,1\}/\1/') NUMVERSION = $(shell echo $(EXTVERSION) | sed -e 's/\([[:digit:]]*[.][[:digit:]]*\).*/\1/') VERSION_FILES = sql/$(MAINEXT)--$(EXTVERSION).sql sql/$(MAINEXT)-core--$(EXTVERSION).sql sql/$(MAINEXT)-schema--$(EXTVERSION).sql BASE_FILES = $(subst --$(EXTVERSION),,$(VERSION_FILES)) sql/uninstall_$(MAINEXT).sql @@ -446,9 +448,8 @@ $(B_DIR)/: pgtap-version-%: $(EXTENSION_DIR)/pgtap--%.sql @true # Necessary to have a fake action here - -# Travis will complain if we reinstall too quickly, so don't run make install -# unless actually necessary. +# CI/CD workflow might complain if we reinstall too quickly, so don't run make +# install unless actually necessary. $(EXTENSION_DIR)/pgtap--$(EXTVERSION).sql: sql/pgtap--$(EXTVERSION).sql $(MAKE) install @@ -484,6 +485,9 @@ updatecheck_setup: updatecheck_deps .PHONY: updatecheck_run updatecheck_run: updatecheck_setup installcheck +latest-changes.md: Changes + perl -e 'while (<>) {last if /^(v?\Q${DISTVERSION}\E)/; } print "Changes for v${DISTVERSION}:\n"; while (<>) { last if /^\s*$$/; s/^\s+//; print }' Changes > $@ + # # STOLEN FROM pgxntool # diff --git a/README.md b/README.md index 827c8aa17..e8b1eb1da 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ documentation in `doc/pgtap.mmd` or [online](https://pgtap.org/documentation.html "Complete pgTAP Documentation"). [![PGXN version](https://badge.fury.io/pg/pgtap.svg)](https://badge.fury.io/pg/pgtap) -[![Build Status](https://travis-ci.org/theory/pgtap.png)](https://travis-ci.org/theory/pgtap) +[![๐Ÿ˜ Postgres](https://github.com/theory/pgtap/actions/workflows/test.yml/badge.svg)](https://github.com/theory/pgtap/actions/workflows/test.yml) pgTAP must be installed on a host with PostgreSQL server running; it cannot be installed remotely. diff --git a/sql/pgtap--1.1.0--1.2.0.sql b/sql/pgtap--1.1.0--1.2.0.sql index 66538c75e..6f3c52a29 100644 --- a/sql/pgtap--1.1.0--1.2.0.sql +++ b/sql/pgtap--1.1.0--1.2.0.sql @@ -2,6 +2,53 @@ CREATE OR REPLACE FUNCTION pgtap_version() RETURNS NUMERIC AS 'SELECT 1.2;' LANGUAGE SQL IMMUTABLE; +-- isnt_member_of( role, members[], description ) +CREATE OR REPLACE FUNCTION isnt_member_of( NAME, NAME[], TEXT ) +RETURNS TEXT AS $$ +DECLARE + extra text[]; +BEGIN + IF NOT _has_role($1) THEN + RETURN fail( $3 ) || E'\n' || diag ( + ' Role ' || quote_ident($1) || ' does not exist' + ); + END IF; + + SELECT ARRAY( + SELECT quote_ident($2[i]) + FROM generate_series(1, array_upper($2, 1)) s(i) + LEFT JOIN pg_catalog.pg_roles r ON rolname = $2[i] + WHERE r.oid = ANY ( _grolist($1) ) + ORDER BY s.i + ) INTO extra; + IF extra[1] IS NULL THEN + RETURN ok( true, $3 ); + END IF; + RETURN ok( false, $3 ) || E'\n' || diag( + ' Members, who should not be in ' || quote_ident($1) || E' role:\n ' || + array_to_string( extra, E'\n ') + ); +END; +$$ LANGUAGE plpgsql; + +-- isnt_member_of( role, member, description ) +CREATE OR REPLACE FUNCTION isnt_member_of( NAME, NAME, TEXT ) +RETURNS TEXT AS $$ + SELECT isnt_member_of( $1, ARRAY[$2], $3 ); +$$ LANGUAGE SQL; + +-- isnt_member_of( role, members[] ) +CREATE OR REPLACE FUNCTION isnt_member_of( NAME, NAME[] ) +RETURNS TEXT AS $$ + SELECT isnt_member_of( $1, $2, 'Should not have members of role ' || quote_ident($1) ); +$$ LANGUAGE SQL; + +-- isnt_member_of( role, member ) +CREATE OR REPLACE FUNCTION isnt_member_of( NAME, NAME ) +RETURNS TEXT AS $$ + SELECT isnt_member_of( $1, ARRAY[$2] ); +$$ LANGUAGE SQL; + -- has_view( schema, view ) CREATE OR REPLACE FUNCTION has_view ( NAME, NAME ) RETURNS TEXT AS $$ @@ -121,7 +168,7 @@ EXCEPTION ); END; $$ LANGUAGE plpgsql; -======= + -- hasnt_operator( left_type, schema, name, right_type, return_type, description ) CREATE OR REPLACE FUNCTION hasnt_operator ( NAME, NAME, NAME, NAME, NAME, TEXT ) RETURNS TEXT AS $$ diff --git a/test/expected/functap.out b/test/expected/functap.out index 83ed9fad1..8d9f7469b 100644 --- a/test/expected/functap.out +++ b/test/expected/functap.out @@ -1,5 +1,5 @@ \unset ECHO -1..1012 +1..1009 ok 1 - simple function should pass ok 2 - simple function should have the proper description ok 3 - simple function should have the proper diagnostics @@ -849,166 +849,163 @@ ok 846 - isnt_window(func, desc) should have the proper diagnostics ok 847 - is_window(func, desc) should fail ok 848 - is_window(func, desc) should have the proper description ok 849 - is_window(func, desc) should have the proper diagnostics -ok 850 - isnt_window(win, desc) should fail -ok 851 - isnt_window(win, desc) should have the proper description -ok 852 - isnt_window(win, desc) should have the proper diagnostics -ok 853 - is_window(nowin, desc) should fail -ok 854 - is_window(nowin, desc) should have the proper description -ok 855 - is_window(nowin, desc) should have the proper diagnostics -ok 856 - isnt_window(nowin, desc) should fail -ok 857 - isnt_window(nowin, desc) should have the proper description -ok 858 - isnt_window(nowin, desc) should have the proper diagnostics -ok 859 - is_window(win) should pass -ok 860 - is_window(win) should have the proper description -ok 861 - is_window(win) should have the proper diagnostics -ok 862 - isnt_window(win) should fail -ok 863 - isnt_window(win) should have the proper description -ok 864 - isnt_window(win) should have the proper diagnostics -ok 865 - is_window(func) should fail -ok 866 - is_window(func) should have the proper description -ok 867 - is_window(func) should have the proper diagnostics -ok 868 - isnt_window(func) should pass -ok 869 - isnt_window(func) should have the proper description -ok 870 - isnt_window(func) should have the proper diagnostics -ok 871 - is_window(nowin) should fail -ok 872 - is_window(nowin) should have the proper description -ok 873 - is_window(nowin) should have the proper diagnostics -ok 874 - isnt_window(nowin) should fail -ok 875 - isnt_window(nowin) should have the proper description -ok 876 - isnt_window(nowin) should have the proper diagnostics -ok 877 - is_strict(schema, func, 0 args, desc) should pass -ok 878 - is_strict(schema, func, 0 args, desc) should have the proper description -ok 879 - is_strict(schema, func, 0 args, desc) should have the proper diagnostics -ok 880 - isnt_strict(schema, func, 0 args, desc) should fail -ok 881 - isnt_strict(schema, func, 0 args, desc) should have the proper description -ok 882 - isnt_strict(schema, func, 0 args, desc) should have the proper diagnostics -ok 883 - is_strict(schema, func, 0 args) should pass -ok 884 - is_strict(schema, func, 0 args) should have the proper description -ok 885 - is_strict(schema, func, 0 args) should have the proper diagnostics -ok 886 - isnt_strict(schema, func, 0 args) should fail -ok 887 - isnt_strict(schema, func, 0 args) should have the proper description -ok 888 - isnt_strict(schema, func, 0 args) should have the proper diagnostics -ok 889 - is_strict(schema, func, args, desc) should fail -ok 890 - is_strict(schema, func, args, desc) should have the proper description -ok 891 - is_strict(schema, func, args, desc) should have the proper diagnostics -ok 892 - isnt_strict(schema, func, args, desc) should pass -ok 893 - isnt_strict(schema, func, args, desc) should have the proper description -ok 894 - isnt_strict(schema, func, args, desc) should have the proper diagnostics -ok 895 - is_strict(schema, func, args) should fail -ok 896 - is_strict(schema, func, args) should have the proper description -ok 897 - is_strict(schema, func, args) should have the proper diagnostics -ok 898 - isnt_strict(schema, func, args) should pass -ok 899 - isnt_strict(schema, func, args) should have the proper description -ok 900 - isnt_strict(schema, func, args) should have the proper diagnostics -ok 901 - is_strict(schema, func, desc) should pass -ok 902 - is_strict(schema, func, desc) should have the proper description -ok 903 - is_strict(schema, func, desc) should have the proper diagnostics -ok 904 - isnt_strict(schema, func, desc) should fail -ok 905 - isnt_strict(schema, func, desc) should have the proper description -ok 906 - isnt_strict(schema, func, desc) should have the proper diagnostics -ok 907 - is_strict(schema, func) should pass -ok 908 - is_strict(schema, func) should have the proper description -ok 909 - is_strict(schema, func) should have the proper diagnostics -ok 910 - isnt_strict(schema, func) should fail -ok 911 - isnt_strict(schema, func) should have the proper description -ok 912 - isnt_strict(schema, func) should have the proper diagnostics -ok 913 - isnt_strict(schema, func, args, desc) should pass -ok 914 - isnt_strict(schema, func, args, desc) should have the proper description -ok 915 - isnt_strict(schema, func, args, desc) should have the proper diagnostics -ok 916 - isnt_strict(schema, func, args) should pass -ok 917 - isnt_strict(schema, func, args) should have the proper description -ok 918 - isnt_strict(schema, func, args) should have the proper diagnostics -ok 919 - is_strict(func, 0 args, desc) should pass -ok 920 - is_strict(func, 0 args, desc) should have the proper description -ok 921 - is_strict(func, 0 args, desc) should have the proper diagnostics -ok 922 - isnt_strict(func, 0 args, desc) should fail -ok 923 - isnt_strict(func, 0 args, desc) should have the proper description -ok 924 - isnt_strict(func, 0 args, desc) should have the proper diagnostics -ok 925 - is_strict(func, 0 args) should pass -ok 926 - is_strict(func, 0 args) should have the proper description -ok 927 - is_strict(func, 0 args) should have the proper diagnostics -ok 928 - isnt_strict(func, 0 args) should fail -ok 929 - isnt_strict(func, 0 args) should have the proper description -ok 930 - isnt_strict(func, 0 args) should have the proper diagnostics -ok 931 - is_strict(func, args, desc) should fail -ok 932 - is_strict(func, args, desc) should have the proper description -ok 933 - is_strict(func, args, desc) should have the proper diagnostics -ok 934 - isnt_strict(func, args, desc) should pass -ok 935 - isnt_strict(func, args, desc) should have the proper description -ok 936 - isnt_strict(func, args, desc) should have the proper diagnostics -ok 937 - is_strict(func, args) should fail -ok 938 - is_strict(func, args) should have the proper description -ok 939 - is_strict(func, args) should have the proper diagnostics -ok 940 - isnt_strict(func, args) should pass -ok 941 - isnt_strict(func, args) should have the proper description -ok 942 - isnt_strict(func, args) should have the proper diagnostics -ok 943 - is_strict(func, desc) should pass -ok 944 - is_strict(func, desc) should have the proper description -ok 945 - is_strict(func, desc) should have the proper diagnostics -ok 946 - isnt_strict(func, desc) should fail -ok 947 - isnt_strict(func, desc) should have the proper description -ok 948 - isnt_strict(func, desc) should have the proper diagnostics -ok 949 - is_strict(func) should pass -ok 950 - is_strict(func) should have the proper description -ok 951 - is_strict(func) should have the proper diagnostics -ok 952 - isnt_strict(func) should fail -ok 953 - isnt_strict(func) should have the proper description -ok 954 - isnt_strict(func) should have the proper diagnostics -ok 955 - function_volatility(schema, func, 0 args, volatile, desc) should pass -ok 956 - function_volatility(schema, func, 0 args, volatile, desc) should have the proper description -ok 957 - function_volatility(schema, func, 0 args, volatile, desc) should have the proper diagnostics -ok 958 - function_volatility(schema, func, 0 args, v, desc) should pass -ok 959 - function_volatility(schema, func, 0 args, v, desc) should have the proper description -ok 960 - function_volatility(schema, func, 0 args, v, desc) should have the proper diagnostics -ok 961 - function_volatility(schema, func, args, immutable, desc) should pass -ok 962 - function_volatility(schema, func, args, immutable, desc) should have the proper description -ok 963 - function_volatility(schema, func, args, immutable, desc) should have the proper diagnostics -ok 964 - function_volatility(schema, func, 0 args, stable, desc) should pass -ok 965 - function_volatility(schema, func, 0 args, stable, desc) should have the proper description -ok 966 - function_volatility(schema, func, 0 args, stable, desc) should have the proper diagnostics -ok 967 - function_volatility(schema, func, 0 args, volatile) should pass -ok 968 - function_volatility(schema, func, 0 args, volatile) should have the proper description -ok 969 - function_volatility(schema, func, 0 args, volatile) should have the proper diagnostics -ok 970 - function_volatility(schema, func, args, immutable) should pass -ok 971 - function_volatility(schema, func, args, immutable) should have the proper description -ok 972 - function_volatility(schema, func, volatile, desc) should pass -ok 973 - function_volatility(schema, func, volatile, desc) should have the proper description -ok 974 - function_volatility(schema, func, volatile, desc) should have the proper diagnostics -ok 975 - function_volatility(schema, func, volatile) should pass -ok 976 - function_volatility(schema, func, volatile) should have the proper description -ok 977 - function_volatility(schema, func, volatile) should have the proper diagnostics -ok 978 - function_volatility(schema, func, immutable, desc) should pass -ok 979 - function_volatility(schema, func, immutable, desc) should have the proper description -ok 980 - function_volatility(schema, func, immutable, desc) should have the proper diagnostics -ok 981 - function_volatility(schema, func, stable, desc) should pass -ok 982 - function_volatility(schema, func, stable, desc) should have the proper description -ok 983 - function_volatility(schema, func, stable, desc) should have the proper diagnostics -ok 984 - function_volatility(func, 0 args, volatile, desc) should pass -ok 985 - function_volatility(func, 0 args, volatile, desc) should have the proper description -ok 986 - function_volatility(func, 0 args, volatile, desc) should have the proper diagnostics -ok 987 - function_volatility(func, 0 args, v, desc) should pass -ok 988 - function_volatility(func, 0 args, v, desc) should have the proper description -ok 989 - function_volatility(func, 0 args, v, desc) should have the proper diagnostics -ok 990 - function_volatility(func, args, immutable, desc) should pass -ok 991 - function_volatility(func, args, immutable, desc) should have the proper description -ok 992 - function_volatility(func, args, immutable, desc) should have the proper diagnostics -ok 993 - function_volatility(func, 0 args, stable, desc) should pass -ok 994 - function_volatility(func, 0 args, stable, desc) should have the proper description -ok 995 - function_volatility(func, 0 args, stable, desc) should have the proper diagnostics -ok 996 - function_volatility(func, 0 args, volatile) should pass -ok 997 - function_volatility(func, 0 args, volatile) should have the proper description -ok 998 - function_volatility(func, 0 args, volatile) should have the proper diagnostics -ok 999 - function_volatility(func, args, immutable) should pass -ok 1000 - function_volatility(func, args, immutable) should have the proper description -ok 1001 - function_volatility(func, volatile, desc) should pass -ok 1002 - function_volatility(func, volatile, desc) should have the proper description -ok 1003 - function_volatility(func, volatile, desc) should have the proper diagnostics -ok 1004 - function_volatility(func, volatile) should pass -ok 1005 - function_volatility(func, volatile) should have the proper description -ok 1006 - function_volatility(func, volatile) should have the proper diagnostics -ok 1007 - function_volatility(func, immutable, desc) should pass -ok 1008 - function_volatility(func, immutable, desc) should have the proper description -ok 1009 - function_volatility(func, immutable, desc) should have the proper diagnostics -ok 1010 - function_volatility(func, stable, desc) should pass -ok 1011 - function_volatility(func, stable, desc) should have the proper description -ok 1012 - function_volatility(func, stable, desc) should have the proper diagnostics +ok 850 - is_window(nowin, desc) should fail +ok 851 - is_window(nowin, desc) should have the proper description +ok 852 - is_window(nowin, desc) should have the proper diagnostics +ok 853 - isnt_window(nowin, desc) should fail +ok 854 - isnt_window(nowin, desc) should have the proper description +ok 855 - isnt_window(nowin, desc) should have the proper diagnostics +ok 856 - is_window(win) should pass +ok 857 - is_window(win) should have the proper description +ok 858 - is_window(win) should have the proper diagnostics +ok 859 - isnt_window(win) should fail +ok 860 - isnt_window(win) should have the proper description +ok 861 - isnt_window(win) should have the proper diagnostics +ok 862 - is_window(func) should fail +ok 863 - is_window(func) should have the proper description +ok 864 - is_window(func) should have the proper diagnostics +ok 865 - isnt_window(func) should pass +ok 866 - isnt_window(func) should have the proper description +ok 867 - isnt_window(func) should have the proper diagnostics +ok 868 - is_window(nowin) should fail +ok 869 - is_window(nowin) should have the proper description +ok 870 - is_window(nowin) should have the proper diagnostics +ok 871 - isnt_window(nowin) should fail +ok 872 - isnt_window(nowin) should have the proper description +ok 873 - isnt_window(nowin) should have the proper diagnostics +ok 874 - is_strict(schema, func, 0 args, desc) should pass +ok 875 - is_strict(schema, func, 0 args, desc) should have the proper description +ok 876 - is_strict(schema, func, 0 args, desc) should have the proper diagnostics +ok 877 - isnt_strict(schema, func, 0 args, desc) should fail +ok 878 - isnt_strict(schema, func, 0 args, desc) should have the proper description +ok 879 - isnt_strict(schema, func, 0 args, desc) should have the proper diagnostics +ok 880 - is_strict(schema, func, 0 args) should pass +ok 881 - is_strict(schema, func, 0 args) should have the proper description +ok 882 - is_strict(schema, func, 0 args) should have the proper diagnostics +ok 883 - isnt_strict(schema, func, 0 args) should fail +ok 884 - isnt_strict(schema, func, 0 args) should have the proper description +ok 885 - isnt_strict(schema, func, 0 args) should have the proper diagnostics +ok 886 - is_strict(schema, func, args, desc) should fail +ok 887 - is_strict(schema, func, args, desc) should have the proper description +ok 888 - is_strict(schema, func, args, desc) should have the proper diagnostics +ok 889 - isnt_strict(schema, func, args, desc) should pass +ok 890 - isnt_strict(schema, func, args, desc) should have the proper description +ok 891 - isnt_strict(schema, func, args, desc) should have the proper diagnostics +ok 892 - is_strict(schema, func, args) should fail +ok 893 - is_strict(schema, func, args) should have the proper description +ok 894 - is_strict(schema, func, args) should have the proper diagnostics +ok 895 - isnt_strict(schema, func, args) should pass +ok 896 - isnt_strict(schema, func, args) should have the proper description +ok 897 - isnt_strict(schema, func, args) should have the proper diagnostics +ok 898 - is_strict(schema, func, desc) should pass +ok 899 - is_strict(schema, func, desc) should have the proper description +ok 900 - is_strict(schema, func, desc) should have the proper diagnostics +ok 901 - isnt_strict(schema, func, desc) should fail +ok 902 - isnt_strict(schema, func, desc) should have the proper description +ok 903 - isnt_strict(schema, func, desc) should have the proper diagnostics +ok 904 - is_strict(schema, func) should pass +ok 905 - is_strict(schema, func) should have the proper description +ok 906 - is_strict(schema, func) should have the proper diagnostics +ok 907 - isnt_strict(schema, func) should fail +ok 908 - isnt_strict(schema, func) should have the proper description +ok 909 - isnt_strict(schema, func) should have the proper diagnostics +ok 910 - isnt_strict(schema, func, args, desc) should pass +ok 911 - isnt_strict(schema, func, args, desc) should have the proper description +ok 912 - isnt_strict(schema, func, args, desc) should have the proper diagnostics +ok 913 - isnt_strict(schema, func, args) should pass +ok 914 - isnt_strict(schema, func, args) should have the proper description +ok 915 - isnt_strict(schema, func, args) should have the proper diagnostics +ok 916 - is_strict(func, 0 args, desc) should pass +ok 917 - is_strict(func, 0 args, desc) should have the proper description +ok 918 - is_strict(func, 0 args, desc) should have the proper diagnostics +ok 919 - isnt_strict(func, 0 args, desc) should fail +ok 920 - isnt_strict(func, 0 args, desc) should have the proper description +ok 921 - isnt_strict(func, 0 args, desc) should have the proper diagnostics +ok 922 - is_strict(func, 0 args) should pass +ok 923 - is_strict(func, 0 args) should have the proper description +ok 924 - is_strict(func, 0 args) should have the proper diagnostics +ok 925 - isnt_strict(func, 0 args) should fail +ok 926 - isnt_strict(func, 0 args) should have the proper description +ok 927 - isnt_strict(func, 0 args) should have the proper diagnostics +ok 928 - is_strict(func, args, desc) should fail +ok 929 - is_strict(func, args, desc) should have the proper description +ok 930 - is_strict(func, args, desc) should have the proper diagnostics +ok 931 - isnt_strict(func, args, desc) should pass +ok 932 - isnt_strict(func, args, desc) should have the proper description +ok 933 - isnt_strict(func, args, desc) should have the proper diagnostics +ok 934 - is_strict(func, args) should fail +ok 935 - is_strict(func, args) should have the proper description +ok 936 - is_strict(func, args) should have the proper diagnostics +ok 937 - isnt_strict(func, args) should pass +ok 938 - isnt_strict(func, args) should have the proper description +ok 939 - isnt_strict(func, args) should have the proper diagnostics +ok 940 - is_strict(func, desc) should pass +ok 941 - is_strict(func, desc) should have the proper description +ok 942 - is_strict(func, desc) should have the proper diagnostics +ok 943 - isnt_strict(func, desc) should fail +ok 944 - isnt_strict(func, desc) should have the proper description +ok 945 - isnt_strict(func, desc) should have the proper diagnostics +ok 946 - is_strict(func) should pass +ok 947 - is_strict(func) should have the proper description +ok 948 - is_strict(func) should have the proper diagnostics +ok 949 - isnt_strict(func) should fail +ok 950 - isnt_strict(func) should have the proper description +ok 951 - isnt_strict(func) should have the proper diagnostics +ok 952 - function_volatility(schema, func, 0 args, volatile, desc) should pass +ok 953 - function_volatility(schema, func, 0 args, volatile, desc) should have the proper description +ok 954 - function_volatility(schema, func, 0 args, volatile, desc) should have the proper diagnostics +ok 955 - function_volatility(schema, func, 0 args, v, desc) should pass +ok 956 - function_volatility(schema, func, 0 args, v, desc) should have the proper description +ok 957 - function_volatility(schema, func, 0 args, v, desc) should have the proper diagnostics +ok 958 - function_volatility(schema, func, args, immutable, desc) should pass +ok 959 - function_volatility(schema, func, args, immutable, desc) should have the proper description +ok 960 - function_volatility(schema, func, args, immutable, desc) should have the proper diagnostics +ok 961 - function_volatility(schema, func, 0 args, stable, desc) should pass +ok 962 - function_volatility(schema, func, 0 args, stable, desc) should have the proper description +ok 963 - function_volatility(schema, func, 0 args, stable, desc) should have the proper diagnostics +ok 964 - function_volatility(schema, func, 0 args, volatile) should pass +ok 965 - function_volatility(schema, func, 0 args, volatile) should have the proper description +ok 966 - function_volatility(schema, func, 0 args, volatile) should have the proper diagnostics +ok 967 - function_volatility(schema, func, args, immutable) should pass +ok 968 - function_volatility(schema, func, args, immutable) should have the proper description +ok 969 - function_volatility(schema, func, volatile, desc) should pass +ok 970 - function_volatility(schema, func, volatile, desc) should have the proper description +ok 971 - function_volatility(schema, func, volatile, desc) should have the proper diagnostics +ok 972 - function_volatility(schema, func, volatile) should pass +ok 973 - function_volatility(schema, func, volatile) should have the proper description +ok 974 - function_volatility(schema, func, volatile) should have the proper diagnostics +ok 975 - function_volatility(schema, func, immutable, desc) should pass +ok 976 - function_volatility(schema, func, immutable, desc) should have the proper description +ok 977 - function_volatility(schema, func, immutable, desc) should have the proper diagnostics +ok 978 - function_volatility(schema, func, stable, desc) should pass +ok 979 - function_volatility(schema, func, stable, desc) should have the proper description +ok 980 - function_volatility(schema, func, stable, desc) should have the proper diagnostics +ok 981 - function_volatility(func, 0 args, volatile, desc) should pass +ok 982 - function_volatility(func, 0 args, volatile, desc) should have the proper description +ok 983 - function_volatility(func, 0 args, volatile, desc) should have the proper diagnostics +ok 984 - function_volatility(func, 0 args, v, desc) should pass +ok 985 - function_volatility(func, 0 args, v, desc) should have the proper description +ok 986 - function_volatility(func, 0 args, v, desc) should have the proper diagnostics +ok 987 - function_volatility(func, args, immutable, desc) should pass +ok 988 - function_volatility(func, args, immutable, desc) should have the proper description +ok 989 - function_volatility(func, args, immutable, desc) should have the proper diagnostics +ok 990 - function_volatility(func, 0 args, stable, desc) should pass +ok 991 - function_volatility(func, 0 args, stable, desc) should have the proper description +ok 992 - function_volatility(func, 0 args, stable, desc) should have the proper diagnostics +ok 993 - function_volatility(func, 0 args, volatile) should pass +ok 994 - function_volatility(func, 0 args, volatile) should have the proper description +ok 995 - function_volatility(func, 0 args, volatile) should have the proper diagnostics +ok 996 - function_volatility(func, args, immutable) should pass +ok 997 - function_volatility(func, args, immutable) should have the proper description +ok 998 - function_volatility(func, volatile, desc) should pass +ok 999 - function_volatility(func, volatile, desc) should have the proper description +ok 1000 - function_volatility(func, volatile, desc) should have the proper diagnostics +ok 1001 - function_volatility(func, volatile) should pass +ok 1002 - function_volatility(func, volatile) should have the proper description +ok 1003 - function_volatility(func, volatile) should have the proper diagnostics +ok 1004 - function_volatility(func, immutable, desc) should pass +ok 1005 - function_volatility(func, immutable, desc) should have the proper description +ok 1006 - function_volatility(func, immutable, desc) should have the proper diagnostics +ok 1007 - function_volatility(func, stable, desc) should pass +ok 1008 - function_volatility(func, stable, desc) should have the proper description +ok 1009 - function_volatility(func, stable, desc) should have the proper diagnostics diff --git a/test/sql/functap.sql b/test/sql/functap.sql index f02475ffe..fb3297248 100644 --- a/test/sql/functap.sql +++ b/test/sql/functap.sql @@ -1,7 +1,7 @@ \unset ECHO \i test/setup.sql -SELECT plan(1012); +SELECT plan(1009); -- SELECT * FROM no_plan(); CREATE SCHEMA someschema; @@ -2391,7 +2391,7 @@ SELECT * FROM check_test( ); SELECT * FROM check_test( - isnt_window( 'ntile'::name, 'whatever' ), + isnt_window( 'lag'::name, 'whatever' ), false, 'isnt_window(win, desc)', 'whatever', @@ -2422,14 +2422,6 @@ SELECT * FROM check_test( '' ); -SELECT * FROM check_test( - isnt_window( 'dense_rank'::name, 'whatever' ), - false, - 'isnt_window(win, desc)', - 'whatever', - '' -); - -- Test diagnostics SELECT * FROM check_test( is_window( 'nonesuch'::name, 'whatever' ), diff --git a/test/test_MVU.sh b/test/test_MVU.sh index 64e0bcf3b..81125debe 100755 --- a/test/test_MVU.sh +++ b/test/test_MVU.sh @@ -181,7 +181,7 @@ if command -v pg_ctlcluster > /dev/null; then new_initdb="sudo pg_createcluster $NEW_VERSION $cluster_name -u $USER -p $NEW_PORT -d $new_dir -- -A trust" new_pg_ctl="sudo pg_ctlcluster $NEW_VERSION test_pg_upgrade" - # See also ../pg-travis-test.sh + # See also ../.github/workflows/test.yml new_pg_upgrade=/usr/lib/postgresql/$NEW_VERSION/bin/pg_upgrade else ctl_separator='' @@ -312,7 +312,7 @@ add_exclude 9.1 9.2 test/sql/throwtap.sql add_exclude 9.4 9.5 test/sql/policy.sql test/sql/throwtap.sql add_exclude 9.6 10 test/sql/partitions.sql -# Use this if there's a single test failing in Travis that you can't figure out... +# Use this if there's a single test failing .github/workflows/test.yml that you can't figure out... #(cd $(dirname $0)/..; pg_prove -v --pset tuples_only=1 test/sql/throwtap.sql) export EXCLUDE_TEST_FILES diff --git a/tools/pg-travis-test.sh b/tools/pg-travis-test.sh deleted file mode 100644 index 05b32c7f5..000000000 --- a/tools/pg-travis-test.sh +++ /dev/null @@ -1,192 +0,0 @@ -#!/bin/bash - -# Based on https://gist.github.com/petere/6023944 - -set -E -e -u -o pipefail - -# -# NOTE: you can control what tests run by setting the TARGETS environment -# variable for a particular branch in the Travis console -# - -# You can set this to higher levels for more debug output -#export DEBUG=9 -#set -x - -BASEDIR=`dirname $0` -if ! . $BASEDIR/util.sh; then - echo "FATAL: error sourcing $BASEDIR/util.sh" 1>&2 - exit 99 -fi -trap err_report ERR - -# For sanity sake, ensure that we run from the top level directory -cd "$BASEDIR"/.. || die 3 "Unable to cd to $BASEDIR/.." - -export UPGRADE_TO=${UPGRADE_TO:-} -FAIL_FAST=${FAIL_FAST:-} -failed='' -tests_run=0 - -get_packages() { - echo "libtap-parser-sourcehandler-pgtap-perl postgresql-$1 postgresql-server-dev-$1" -} -get_path() { - # See also test/test_MVU.sh - echo "/usr/lib/postgresql/$1/bin/" -} - -# Do NOT use () here; we depend on being able to set failed -test_cmd() { -local status rc -if [ "$1" == '-s' ]; then - status="$2" - shift 2 -else - status="$1" -fi - -# NOTE! While this script is under tools/, we expect to be running from the main directory - -# NOTE: simply aliasing a local variable to "$@" does not work as desired, -# probably because by default the variable isn't an array. If it ever becomes -# an issue we can figure out how to do it. - -echo -echo ############################################################################# -echo "PG-TRAVIS: running $@" -echo ############################################################################# -tests_run=$((tests_run + 1)) -# Use || so as not to trip up -e, and a sub-shell to be safe. -rc=0 -( "$@" ) || rc=$? -if [ $rc -ne 0 ]; then - echo - echo '!!!!!!!!!!!!!!!! FAILURE !!!!!!!!!!!!!!!!' - echo "$@ returned $rc" - echo '!!!!!!!!!!!!!!!! FAILURE !!!!!!!!!!!!!!!!' - echo - failed="$failed '$status'" - [ -z "$FAIL_FAST" ] || die 1 "command failed and \$FAIL_FAST is not empty" -fi -} - -# Ensure test_cmd sets failed properly -old_FAST_FAIL=$FAIL_FAST -FAIL_FAST='' -test_cmd false > /dev/null # DO NOT redirect stderr, otherwise it's horrible to debug problems here! -if [ -z "$failed" ]; then - echo "code error: test_cmd() did not set \$failed" - exit 91 -fi -failed='' -FAIL_FAST=$old_FAST_FAIL - -test_make() { - # Many tests depend on install, so just use sudo for all of them - test_cmd -s "$*" sudo make "$@" -} - -######################################################## -# TEST TARGETS -sanity() { - test_make clean regress -} - -update() { - # pg_regress --launcher not supported prior to 9.1 - # There are some other failures in 9.1 and 9.2 (see https://travis-ci.org/decibel/pgtap/builds/358206497). - echo $PGVERSION | grep -qE "8[.]|9[.][012]" || test_make clean updatecheck -} - -tests_run_by_target_all=11 # 1 + 5 * 2 -all() { - local tests_run_start=$tests_run - # the test* targets use pg_prove, which assumes it's making a default psql - # connection to a database that has pgTap installed, so we need to set that - # up. - test_cmd -s "all(): psql create extension" psql -Ec 'CREATE EXTENSION pgtap' - - # TODO: install software necessary to allow testing 'html' target - # UPDATE tests_run_by_target_all IF YOU ADD ANY TESTS HERE! - for t in all install test test-serial test-parallel ; do - # Test from a clean slate... - test_make uninstall clean $t - # And then test again - test_make $t - done - local commands_run=$(($tests_run - $tests_run_start)) - [ $commands_run -eq $tests_run_by_target_all ] || die 92 "all() expected to run $tests_run_by_target_all but actually ran $commands_run tests" -} - -upgrade() { -if [ -n "$UPGRADE_TO" ]; then - # We need to tell test_MVU.sh to run some steps via sudo since we're - # actually installing from pgxn into a system directory. We also use a - # different port number to avoid conflicting with existing clusters. - test_cmd test/test_MVU.sh -s 55667 55778 $PGVERSION $UPGRADE_TO "$(get_path $PGVERSION)" "$(get_path $UPGRADE_TO)" -fi -} - - -######################################################## -# Install packages -packages="python-setuptools postgresql-common $(get_packages $PGVERSION)" - -if [ -n "$UPGRADE_TO" ]; then - packages="$packages $(get_packages $UPGRADE_TO)" -fi - -sudo apt-get update - -# bug: https://www.postgresql.org/message-id/20130508192711.GA9243@msgid.df7cb.de -sudo update-alternatives --remove-all postmaster.1.gz - -# stop all existing instances (because of https://github.com/travis-ci/travis-cookbooks/pull/221) -sudo service postgresql stop -# and make sure they don't come back -echo 'exit 0' | sudo tee /etc/init.d/postgresql -sudo chmod a+x /etc/init.d/postgresql - -sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install $packages - -# Need to explicitly set which pg_config we want to use -export PG_CONFIG="$(get_path $PGVERSION)pg_config" -[ "$PG_CONFIG" != 'pg_config' ] - -# Make life easier for test_MVU.sh -sudo usermod -a -G postgres $USER - - -# Setup cluster -export PGPORT=55435 -export PGUSER=postgres -sudo pg_createcluster --start $PGVERSION test -p $PGPORT -- -A trust - -sudo easy_install pgxnclient - -set +x -total_tests=$((3 + $tests_run_by_target_all)) -for t in ${TARGETS:-sanity update upgrade all}; do - $t -done - -# You can use this to check tests that are failing pg_prove -#pg_prove -f --pset tuples_only=1 test/sql/unique.sql test/sql/check.sql || true - -if [ $tests_run -eq $total_tests ]; then - echo Ran $tests_run tests -elif [ $tests_run -gt 0 ]; then - echo "WARNING! ONLY RAN $tests_run OUT OF $total_tests TESTS!" - # We don't consider this an error... -else - echo No tests were run! - exit 2 -fi - -if [ -n "$failed" ]; then - echo - # $failed will have a leading space if it's not empty - echo "These test targets failed:$failed" - exit 1 -fi