Merge branch 'master' into gdal-1.11

This commit is contained in:
Raul Ochoa 2014-09-22 15:08:13 +02:00
commit 40ff44e0fe
5 changed files with 31 additions and 31 deletions

View File

@ -8,6 +8,7 @@ before_script:
- sudo apt-get update - sudo apt-get update
- sudo apt-get install -q postgresql-9.3-postgis-2.1 - sudo apt-get install -q postgresql-9.3-postgis-2.1
- sudo apt-get install -q postgresql-contrib-9.3 - sudo apt-get install -q postgresql-contrib-9.3
- sudo apt-get install -q postgresql-plpython-9.3
- sudo apt-get install -q postgis - sudo apt-get install -q postgis
- sudo apt-get install -q gdal-bin - sudo apt-get install -q gdal-bin
- echo -e "local\tall\tall\ttrust\nhost\tall\tall\t127.0.0.1/32\ttrust\nhost\tall\tall\t::1/128\ttrust" |sudo tee /etc/postgresql/9.3/main/pg_hba.conf - echo -e "local\tall\tall\ttrust\nhost\tall\tall\t127.0.0.1/32\ttrust\nhost\tall\tall\t::1/128\ttrust" |sudo tee /etc/postgresql/9.3/main/pg_hba.conf
@ -16,6 +17,9 @@ before_script:
- psql -c 'CREATE EXTENSION postgis;' -U postgres -d template_postgis - psql -c 'CREATE EXTENSION postgis;' -U postgres -d template_postgis
- ./configure - ./configure
env:
- PGUSER=postgres
language: node_js language: node_js
node_js: node_js:
- "0.8" - "0.8"

View File

@ -1,5 +1,9 @@
1.17.1 - 2014-mm-dd 1.17.1 - 2014-mm-dd
------------------- -------------------
Bug fixes:
* Fixes "make check" on systems with non-default PostgreSQL superuser (#152)
1.17.0 - 2014-09-17 1.17.0 - 2014-09-17
------------------- -------------------

View File

@ -57,3 +57,7 @@ tests
Run ```make check``` or see test/README.md Run ```make check``` or see test/README.md
Note that the environment should be set to ensure the default
PostgreSQL user is superuser (PGUSER=postgres make check).

View File

@ -10,7 +10,7 @@ var app = require(global.settings.app_root + '/app/controllers/app')()
, fs = require('fs') , fs = require('fs')
, libxmljs = require('libxmljs') , libxmljs = require('libxmljs')
, http = require('http') , http = require('http')
, server_utils = require('../../support/server_utils'); , server_utils = require('../../support/server_utils')
; ;
// allow lots of emitters to be set to silence warning // allow lots of emitters to be set to silence warning
@ -18,18 +18,6 @@ app.setMaxListeners(0);
suite('export.kml', function() { suite('export.kml', function() {
var expected_cache_control = 'no-cache,max-age=3600,must-revalidate,public';
var expected_cache_control_persist = 'public,max-age=31536000';
// use dec_sep for internationalization
var checkDecimals = function(x, dec_sep){
var tmp='' + x;
if (tmp.indexOf(dec_sep)>-1)
return tmp.length-tmp.indexOf(dec_sep)-1;
else
return 0;
}
// Check if an attribute is in the KML output // Check if an attribute is in the KML output
// //
// NOTE: "name" and "description" attributes are threated specially // NOTE: "name" and "description" attributes are threated specially
@ -60,7 +48,7 @@ var hasAttribute = function(kml, att) {
//if ( lowerkml.indexOf('simplefield name="'+ loweratt + '"') != -1 ) return true; //if ( lowerkml.indexOf('simplefield name="'+ loweratt + '"') != -1 ) return true;
//if ( lowerkml.indexOf('<'+loweratt+'>') != -1 ) return true; //if ( lowerkml.indexOf('<'+loweratt+'>') != -1 ) return true;
return false; return false;
} };
// Return the first coordinate array found in KML // Return the first coordinate array found in KML
var extractCoordinates = function(kml) { var extractCoordinates = function(kml) {
@ -85,7 +73,7 @@ var extractCoordinates = function(kml) {
} }
return coo; return coo;
} };
// Return the first folder name in KML // Return the first folder name in KML
var extractFolderName = function(kml) { var extractFolderName = function(kml) {
@ -104,7 +92,7 @@ var extractFolderName = function(kml) {
//console.log("coo: " + coo); //console.log("coo: " + coo);
if ( ! coo ) return; if ( ! coo ) return;
return coo; return coo;
} };
// KML tests // KML tests
@ -120,13 +108,13 @@ test('KML format, unauthenticated', function(done){
assert.equal(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd); assert.equal(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
var row0 = res.body; var row0 = res.body;
var checkfields = {'Name':1, 'address':1, 'cartodb_id':1, 'the_geom':0, 'the_geom_webmercator':0}; var checkfields = {'Name':1, 'address':1, 'cartodb_id':1, 'the_geom':0, 'the_geom_webmercator':0};
for ( var f in checkfields ) { Object.keys(checkfields).forEach(function(f) {
if ( checkfields[f] ) { if ( checkfields[f] ) {
assert.ok(hasAttribute(row0, f), "result does not include '" + f + "': " + row0); assert.ok(hasAttribute(row0, f), "result does not include '" + f + "': " + row0);
} else { } else {
assert.ok(!hasAttribute(row0, f), "result includes '" + f + "'"); assert.ok(!hasAttribute(row0, f), "result includes '" + f + "'");
} }
} });
done(); done();
}); });
}); });
@ -176,14 +164,14 @@ test('KML format, skipfields', function(done){
assert.equal(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd); assert.equal(true, /^attachment/.test(cd), 'KML is not disposed as attachment: ' + cd);
assert.equal(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd); assert.equal(true, /filename=cartodb-query.kml/gi.test(cd), 'Unexpected KML filename: ' + cd);
var row0 = res.body; var row0 = res.body;
var checkfields = {'Name':1, 'address':0, 'cartodb_id':0, 'the_geom':0, 'the_geom_webmercator':0}; var checkFields = {'Name':1, 'address':0, 'cartodb_id':0, 'the_geom':0, 'the_geom_webmercator':0};
for ( var f in checkfields ) { Object.keys(checkFields).forEach(function(f) {
if ( checkfields[f] ) { if ( checkFields[f] ) {
assert.ok(hasAttribute(row0, f), "result does not include '" + f + "': " + row0); assert.ok(hasAttribute(row0, f), "result does not include '" + f + "': " + row0);
} else { } else {
assert.ok(!hasAttribute(row0, f), "result includes '" + f + "'"); assert.ok(!hasAttribute(row0, f), "result includes '" + f + "'");
} }
} });
done(); done();
}); });
}); });
@ -231,7 +219,7 @@ test('KML format, unauthenticated, concurrent requests', function(done){
//console.log("Listening on port " + port); //console.log("Listening on port " + port);
for (var i=0; i<concurrency; ++i) { for (var i=0; i<concurrency; ++i) {
//console.log("Sending request"); //console.log("Sending request");
var req = http.request({ http.request({
host: 'localhost', host: 'localhost',
port: port, port: port,
path: '/api/v1/sql?' + query, path: '/api/v1/sql?' + query,
@ -272,7 +260,7 @@ test('GET /api/v1/sql as kml with no rows', function(done){
},{ }, function(res){ },{ }, function(res){
assert.equal(res.statusCode, 200, res.body); assert.equal(res.statusCode, 200, res.body);
// NOTE: GDAL-1.11+ added 'id="root_doc"' attribute to the output // NOTE: GDAL-1.11+ added 'id="root_doc"' attribute to the output
var pat = RegExp('^<\\?xml version="1.0" encoding="utf-8" \\?><kml xmlns="http://www.opengis.net/kml/2.2"><Document( id="root_doc")?><Folder><name>cartodb_query</name></Folder></Document></kml>$'); var pat = new RegExp('^<\\?xml version="1.0" encoding="utf-8" \\?><kml xmlns="http://www.opengis.net/kml/2.2"><Document( id="root_doc")?><Folder><name>cartodb_query</name></Folder></Document></kml>$');
var body = res.body.replace(/\n/g,''); var body = res.body.replace(/\n/g,'');
assert.ok(body.match(pat), assert.ok(body.match(pat),
"Response:\n" + body + '\ndoes not match pattern:\n' + pat); "Response:\n" + body + '\ndoes not match pattern:\n' + pat);
@ -292,7 +280,7 @@ test('GET /api/v1/sql as kml with ending semicolon', function(done){
},{ }, function(res){ },{ }, function(res){
assert.equal(res.statusCode, 200, res.body); assert.equal(res.statusCode, 200, res.body);
// NOTE: GDAL-1.11+ added 'id="root_doc"' attribute to the output // NOTE: GDAL-1.11+ added 'id="root_doc"' attribute to the output
var pat = RegExp('^<\\?xml version="1.0" encoding="utf-8" \\?><kml xmlns="http://www.opengis.net/kml/2.2"><Document( id="root_doc")?><Folder><name>cartodb_query</name></Folder></Document></kml>$'); var pat = new RegExp('^<\\?xml version="1.0" encoding="utf-8" \\?><kml xmlns="http://www.opengis.net/kml/2.2"><Document( id="root_doc")?><Folder><name>cartodb_query</name></Folder></Document></kml>$');
var body = res.body.replace(/\n/g,''); var body = res.body.replace(/\n/g,'');
assert.ok(body.match(pat), assert.ok(body.match(pat),
"Response:\n" + body + '\ndoes not match pattern:\n' + pat); "Response:\n" + body + '\ndoes not match pattern:\n' + pat);

View File

@ -65,21 +65,21 @@ export PGHOST PGPORT
if test x"$PREPARE_PGSQL" = xyes; then if test x"$PREPARE_PGSQL" = xyes; then
echo "preparing postgres..." echo "preparing postgres..."
dropdb -U postgres ${TEST_DB} # 2> /dev/null # error expected if doesn't exist, but not otherwise dropdb ${TEST_DB} # 2> /dev/null # error expected if doesn't exist, but not otherwise
createdb -U postgres -Ttemplate_postgis -EUTF8 ${TEST_DB} || die "Could not create test database" createdb -Ttemplate_postgis -EUTF8 ${TEST_DB} || die "Could not create test database"
cat test.sql | cat test.sql |
sed "s/:PUBLICUSER/${PUBLICUSER}/" | sed "s/:PUBLICUSER/${PUBLICUSER}/" |
sed "s/:PUBLICPASS/${PUBLICPASS}/" | sed "s/:PUBLICPASS/${PUBLICPASS}/" |
sed "s/:TESTUSER/${TESTUSER}/" | sed "s/:TESTUSER/${TESTUSER}/" |
sed "s/:TESTPASS/${TESTPASS}/" | sed "s/:TESTPASS/${TESTPASS}/" |
psql -U postgres -v ON_ERROR_STOP=1 ${TEST_DB} || exit 1 psql -v ON_ERROR_STOP=1 ${TEST_DB} || exit 1
# TODO: send in a single run, togheter with test.sql # TODO: send in a single run, togheter with test.sql
psql -U postgres -c "CREATE EXTENSION plpythonu;" ${TEST_DB} psql -c "CREATE EXTENSION plpythonu;" ${TEST_DB}
curl -L -s https://github.com/CartoDB/cartodb-postgresql/raw/cdb/scripts-available/CDB_QueryStatements.sql -o support/CDB_QueryStatements.sql curl -L -s https://github.com/CartoDB/cartodb-postgresql/raw/cdb/scripts-available/CDB_QueryStatements.sql -o support/CDB_QueryStatements.sql
curl -L -s https://github.com/CartoDB/cartodb-postgresql/raw/cdb/scripts-available/CDB_QueryTables.sql -o support/CDB_QueryTables.sql curl -L -s https://github.com/CartoDB/cartodb-postgresql/raw/cdb/scripts-available/CDB_QueryTables.sql -o support/CDB_QueryTables.sql
psql -U postgres -f support/CDB_QueryStatements.sql ${TEST_DB} psql -f support/CDB_QueryStatements.sql ${TEST_DB}
psql -U postgres -f support/CDB_QueryTables.sql ${TEST_DB} psql -f support/CDB_QueryTables.sql ${TEST_DB}
fi fi