From e469fb792045524ed339b8f91de7443526898356 Mon Sep 17 00:00:00 2001 From: Mario de Frutos Date: Thu, 15 Feb 2018 18:30:57 +0100 Subject: [PATCH 1/3] Fix travis problem showing regression diffs --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index bccfc2d..7330ccf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: c -dist: precise +group: travis_stable +sudo: required env: global: @@ -31,8 +32,7 @@ before_install: - sudo apt-get -y install postgresql-9.5-postgis-2.2=2.2.2.0-cdb2 # configure it to accept local connections from postgres - - echo -e "# TYPE DATABASE USER ADDRESS METHOD \nlocal all postgres trust\nlocal all all trust\nhost all all 127.0.0.1/32 trust" \ - | sudo tee /etc/postgresql/9.5/main/pg_hba.conf + - echo -e "# TYPE DATABASE USER ADDRESS METHOD \nlocal all postgres trust\nlocal all all trust\nhost all all 127.0.0.1/32 trust" \ | sudo tee /etc/postgresql/9.5/main/pg_hba.conf - sudo /etc/init.d/postgresql restart 9.5 install: @@ -40,4 +40,4 @@ install: script: - cd src/pg - - make test || { cat src/pg/test/regression.diffs; false; } + - make test || { cat $TRAVIS_BUILD_DIR/src/pg/test/regression.diffs; false; } From fb17d05714ea560967b72c3f36799dc68b32bff4 Mon Sep 17 00:00:00 2001 From: Mario de Frutos Date: Fri, 16 Feb 2018 09:47:39 +0100 Subject: [PATCH 2/3] Improve Travis testing - Added multiple versions of PostgreSQL to test (9.5, 9.6 and 10) - Added multiple versions of Postgis to test - Cleand travis yaml in favor of a script done in other project thanks to Paul Ramsey --- .travis.yml | 34 +++++++----------------------- scripts/ci/install_postgres.sh | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 27 deletions(-) create mode 100644 scripts/ci/install_postgres.sh diff --git a/.travis.yml b/.travis.yml index 7330ccf..a7a3cbf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,34 +6,14 @@ env: global: - PAGER=cat +matrix: + include: + - env: PGSQL_VERSION=9.5 POSTGIS_VERSION=2.2 + - env: PGSQL_VERSION=9.6 POSTGIS_VERSION=2.3 + - env: PGSQL_VERSION=10 POSTGIS_VERSION=2.4 + before_install: - - sudo add-apt-repository -y ppa:cartodb/postgresql-9.5 - - sudo add-apt-repository -y ppa:cartodb/gis - - sudo add-apt-repository -y ppa:cartodb/gis-testing - - sudo apt-get update - - # Install postgres db and build deps - - sudo /etc/init.d/postgresql stop # stop travis default instance - - sudo apt-get -y remove --purge postgresql-9.1 - - sudo apt-get -y remove --purge postgresql-9.2 - - sudo apt-get -y remove --purge postgresql-9.3 - - sudo apt-get -y remove --purge postgresql-9.4 - - sudo apt-get -y remove --purge postgresql-9.5 - - sudo rm -rf /var/lib/postgresql/ - - sudo rm -rf /var/log/postgresql/ - - sudo rm -rf /etc/postgresql/ - - sudo apt-get -y remove --purge postgis-2.2 - - sudo apt-get -y autoremove - - - sudo apt-get -y install postgresql-9.5=9.5.2-3cdb3 - - sudo apt-get -y install postgresql-server-dev-9.5=9.5.2-3cdb3 - - sudo apt-get -y install postgresql-plpython-9.5=9.5.2-3cdb3 - - sudo apt-get -y install postgresql-9.5-postgis-scripts=2.2.2.0-cdb2 - - sudo apt-get -y install postgresql-9.5-postgis-2.2=2.2.2.0-cdb2 - - # configure it to accept local connections from postgres - - echo -e "# TYPE DATABASE USER ADDRESS METHOD \nlocal all postgres trust\nlocal all all trust\nhost all all 127.0.0.1/32 trust" \ | sudo tee /etc/postgresql/9.5/main/pg_hba.conf - - sudo /etc/init.d/postgresql restart 9.5 + - sudo bash $TRAVIS_BUILD_DIR/scripts/ci/install_postgres.sh install: - sudo make install diff --git a/scripts/ci/install_postgres.sh b/scripts/ci/install_postgres.sh new file mode 100644 index 0000000..9ea6676 --- /dev/null +++ b/scripts/ci/install_postgres.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# echo commands +set -x + +# exit on error +set -e + +dpkg -l | grep postgresql + +# Add the PDGD repository +apt-key adv --keyserver keys.gnupg.net --recv-keys 7FCC7D46ACCC4CF8 +add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" +apt-get update + +# Remove those all PgSQL versions except the one we're testing +PGSQL_VERSIONS=(9.2 9.3 9.4 9.5 9.6 10) +/etc/init.d/postgresql stop # stop travis default instance +for V in "${PGSQL_VERSIONS[@]}"; do + if [ "$V" != "$PGSQL_VERSION" ]; then + apt-get -y remove --purge postgresql-${V} postgresql-client-${V} postgresql-contrib-${V} postgresql-${V}-postgis-2.3-scripts + else + apt-get -y remove --purge postgresql-${V}-postgis-2.3-scripts + fi +done + +apt-get -y autoremove + +# Install PostgreSQL +apt-get -y install postgresql-${PGSQL_VERSION} postgresql-${PGSQL_VERSION}-postgis-${POSTGIS_VERSION} postgresql-server-dev-${PGSQL_VERSION} + +# Configure it to accept local connections from postgres +echo -e "# TYPE DATABASE USER ADDRESS METHOD \nlocal all postgres trust\nlocal all all trust\nhost all all 127.0.0.1/32 trust" > /etc/postgresql/${PGSQL_VERSION}/main/pg_hba.conf + +# Restart PostgreSQL +/etc/init.d/postgresql restart ${PGSQL_VERSION} + +dpkg -l | grep postgresql From db585177ab91eb982679a178704fc9b99e7217a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Ignacio=20S=C3=A1nchez=20Lara?= Date: Fri, 6 Apr 2018 13:37:07 +0200 Subject: [PATCH 3/3] Explicit pre-2.4 PostGIS equal operator Before PostGIS 2.4, `=` meant equality of bounding boxes, but now it's strict equalty. --- .../sql/44_observatory_geometries_test.sql | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pg/test/sql/44_observatory_geometries_test.sql b/src/pg/test/sql/44_observatory_geometries_test.sql index 4178525..3ddbf92 100644 --- a/src/pg/test/sql/44_observatory_geometries_test.sql +++ b/src/pg/test/sql/44_observatory_geometries_test.sql @@ -12,17 +12,17 @@ SET client_min_messages TO WARNING; -- expect most recent census tract boundary at cartodb nyc -- timespan implictly null -SELECT cdb_observatory.OBS_GetBoundary( +SELECT st_envelope(cdb_observatory.OBS_GetBoundary( cdb_observatory._TestPoint(), 'us.census.tiger.census_tract' -) = :'cartodb_census_tract_geometry' As OBS_GetBoundary_cartodb_census_tract; +)) = st_envelope(st_asewkb(:'cartodb_census_tract_geometry')) As OBS_GetBoundary_cartodb_census_tract; -- expect most recent census county boundary (brooklyn) at cartodb nyc -- timespan implictly null -SELECT cdb_observatory.OBS_GetBoundary( +SELECT st_envelope(cdb_observatory.OBS_GetBoundary( cdb_observatory._TestPoint(), 'us.census.tiger.county' -) = :'cartodb_county_geometry' As OBS_GetBoundary_cartodb_county; +)) = st_envelope(st_asewkb(:'cartodb_county_geometry')) As OBS_GetBoundary_cartodb_county; -- expect null geometry since boundary_id is null -- timespan implictly null @@ -39,11 +39,11 @@ SELECT cdb_observatory.OBS_GetBoundary( ) IS NULL As OBS_GetBoundary_null_island_census_tract; -- expect census tract boundary at cartodb nyc from 2014 -SELECT cdb_observatory.OBS_GetBoundary( +SELECT st_envelope(cdb_observatory.OBS_GetBoundary( cdb_observatory._TestPoint(), 'us.census.tiger.census_tract', '2015' -) = :'cartodb_census_tract_geometry' As OBS_GetBoundary_year_census_tract; +)) = st_envelope(st_asewkb(:'cartodb_census_tract_geometry')) As OBS_GetBoundary_year_census_tract; -- should return null -- look for census tracts a year before census released them @@ -86,10 +86,10 @@ SELECT cdb_observatory.OBS_GetBoundaryId( -- should give geometry of King's County/Brooklyn, NY -SELECT cdb_observatory.OBS_GetBoundaryById( +SELECT st_envelope(cdb_observatory.OBS_GetBoundaryById( '36047', 'us.census.tiger.county' -) = :'cartodb_county_geometry' As OBS_GetBoundaryById_cartodb_county; +)) = st_envelope(st_asewkb(:'cartodb_county_geometry')) As OBS_GetBoundaryById_cartodb_county; -- Should match output of GetBoundary on similar inputs SELECT cdb_observatory.OBS_GetBoundaryById( @@ -101,11 +101,11 @@ SELECT cdb_observatory.OBS_GetBoundaryById( ) As OBS_GetBoundaryById_compared_with_obs_GetBoundary; -- should give null since boundary_id does not match geometry reference id -SELECT cdb_observatory.OBS_GetBoundaryById( +SELECT st_envelope(cdb_observatory.OBS_GetBoundaryById( '36047', 'us.census.tiger.county', '2015' -) = :'cartodb_county_geometry' OBS_GetBoundaryById_boundary_id_mismatch_geom_id; +)) = st_envelope(st_asewkb(:'cartodb_county_geometry')) OBS_GetBoundaryById_boundary_id_mismatch_geom_id; -- should give null since boundary_id does not match geometry reference id SELECT cdb_observatory.OBS_GetBoundaryById(