From 7aeb54d53d6170f4896d952dc66f694a83d63f40 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Wed, 8 Jul 2015 12:59:49 +0200 Subject: [PATCH] Enables multilayer ported tests --- .../fixtures/test_table_0_0_0_multilayer2.png | Bin 0 -> 1085 bytes .../fixtures/test_table_0_0_0_multilayer3.png | Bin 0 -> 582 bytes .../fixtures/test_table_0_0_0_multilayer4.png | Bin 0 -> 895 bytes test/acceptance/ported/multilayer.js | 125 ++++++++++++------ .../ported/support/ported_server_options.js | 3 + 5 files changed, 91 insertions(+), 37 deletions(-) create mode 100644 test/acceptance/ported/fixtures/test_table_0_0_0_multilayer2.png create mode 100644 test/acceptance/ported/fixtures/test_table_0_0_0_multilayer3.png create mode 100644 test/acceptance/ported/fixtures/test_table_0_0_0_multilayer4.png diff --git a/test/acceptance/ported/fixtures/test_table_0_0_0_multilayer2.png b/test/acceptance/ported/fixtures/test_table_0_0_0_multilayer2.png new file mode 100644 index 0000000000000000000000000000000000000000..ebc9ca55dffb81b7e630f3c2eda7773048e2faf4 GIT binary patch literal 1085 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|GzJD17Ec$)kcv5P@5X0LO_gE) zkT1|upXBKD?3yb}SeSO$tR?GoIvZK_oEJH~SL#R%aB;lgYktYK_bC`@Zt_;(PbG_dnlrzVhC8OHQEG z)C30(t=*|w`TgCK6SXHd=AQJwJvn}xin`V0=F^jHpPJ@w+#8(@1M!~vC}B(Q&`c%gHN{4 zp0w{)DZ}RtMmtM`i#|19I`TR5&rM1FN@L0QUUu5~)vj-MHCV>XUi04f9Ix(zkLk|? zPPQ#MBeZEzS?vMUn7McM?2Y*}KlaG8`R6W9I-BYhVE1g*tx~4?>l<|?|0Q$Is<-;9 z`duadx}M04)a0Em@)3ug&G&nJ{9x(H)mvY)E{mCNvrAtx{?)VmB^y(IxEMv*eQUc_ z%6#)w)1coAj%N3Md#-4%%hA6{zgGS zZQ9X)la7Wq9ACra5NoY{m%YGF_&ejDh~0G=nbMP$l||Va_`PqP7FhyvkJY4o-?eSH zHxz%8V>r*`kQ+Vu;Ah{QfAU`MeE6=flRj~z`RDF?8JFr9df&{u!~ftI(BHvks_JaB zFZ{{(f5)+9ec9dvJh@M$cdAQ9o^o&AuN^u6%k_1lKiIV=os&JebLkD)7Zsl6pQ?Y( zc)Im9i(X>srM;`qTx=KL_>+J7o!Nh4?){r}>nmfiM*PLt=t=SXIvYMpOE=^Q8AvQ+^d@*?%G;|H`l3n!0=O>$3Rr9b}lNtDnm{r-UW|gCn$O literal 0 HcmV?d00001 diff --git a/test/acceptance/ported/fixtures/test_table_0_0_0_multilayer3.png b/test/acceptance/ported/fixtures/test_table_0_0_0_multilayer3.png new file mode 100644 index 0000000000000000000000000000000000000000..c5d6acab82dfeae5409bef7585252a87abc11150 GIT binary patch literal 582 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|GzJDHUQZXtkcv5PZ`yiK3uIt> zP+j!m>=$!nz9w{q&HJy>M1JSDm$;DeC&)IXZJy z?e!<0eqEzA)53=>Eo(b-l<}5HYvTUM{d+rS`W{QaD*5YqoF?lh`^^7S`N#aGw&d+~ zu_75U_hUBI9siO4>09{QWe$(o>{af+`^ca(XWD80tnI8)SMBHL+VVEJ%aEzsalRC^57BvDX2iP5l zbyy;$4vYKSu2 -1, "Missing expected token " + token1 + " from redis"); assert.ok(_.indexOf(matches, 'map_cfg|'+token2) > -1, @@ -917,17 +939,20 @@ describe.skip('multilayer', function() { { options: { sql: "select st_setsrid('LINESTRING(-60 -60,-60 60)'::geometry, 4326) as the_geom", cartocss_version: '2.0.2', - cartocss: '#layer { line-width:16; line-color:#ff0000; }' + cartocss: '#layer { line-width:16; line-color:#ff0000; }', + geom_column: 'the_geom' } }, { options: { sql: "select st_setsrid('LINESTRING(-100 0,100 0)'::geometry, 4326) as the_geom", cartocss_version: '2.0.2', - cartocss: '#layer { line-width:16; line-color:#00ff00; }' + cartocss: '#layer { line-width:16; line-color:#00ff00; }', + geom_column: 'the_geom' } }, { options: { sql: "select st_setsrid('LINESTRING(60 -60,60 60)'::geometry, 4326) as the_geom", cartocss_version: '2.0.2', - cartocss: '#layer { line-width:16; line-color:#0000ff; }' + cartocss: '#layer { line-width:16; line-color:#0000ff; }', + geom_column: 'the_geom' } } ] }; @@ -966,7 +991,7 @@ describe.skip('multilayer', function() { }, {}, function(res) { assert.equal(res.statusCode, 200, res.body); assert.equal(res.headers['content-type'], "image/png"); - assert.imageEqualsFile(res.body, './test/fixtures/test_table_0_0_0_multilayer4.png', + assert.imageEqualsFile(res.body, './test/acceptance/ported/fixtures/test_table_0_0_0_multilayer4.png', IMAGE_EQUALS_TOLERANCE_PER_MIL, function(err) { next(err); }); @@ -1005,12 +1030,14 @@ describe.skip('multilayer', function() { { options: { sql: "select 'single''quote' as n, 'SRID=4326;POINT(0 0)'::geometry as the_geom", cartocss: '#s [n="single\'quote" ] { marker-fill:red; }', - cartocss_version: '2.1.0' + cartocss_version: '2.1.0', + geom_column: 'the_geom' } }, { options: { sql: "select 'double\"quote' as n, 'SRID=4326;POINT(2 0)'::geometry as the_geom", cartocss: '#s [n="double\\"quote" ] { marker-fill:red; }', - cartocss_version: '2.1.0' + cartocss_version: '2.1.0', + geom_column: 'the_geom' } } ] }; @@ -1039,7 +1066,8 @@ describe.skip('multilayer', function() { { options: { sql: "select 1.0 as n, 'SRID=4326;POINT(0 0)'::geometry as the_geom", cartocss: '#s [n=1e-4 ] { marker-fill:red; }', - cartocss_version: '2.1.0' + cartocss_version: '2.1.0', + geom_column: 'the_geom' } } ] }; @@ -1067,7 +1095,8 @@ describe.skip('multilayer', function() { { options: { sql: "select 1.0 as n, 'SRID=4326;POINT(0 0)'::geometry as the_geom", cartocss: '#s { text-name: [n]; text-face-name: "<%= font %>"; }', - cartocss_version: '2.1.0' + cartocss_version: '2.1.0', + geom_column: 'the_geom' } } ] }; @@ -1237,13 +1266,15 @@ describe.skip('multilayer', function() { sql: 'select cartodb_id, ST_Translate(the_geom, 50, 0) as the_geom from test_table limit 2', cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }', cartocss_version: '2.0.1', - interactivity: [ 'cartodb_id' ] + interactivity: [ 'cartodb_id' ], + geom_column: 'the_geom' } }, { options: { sql: 'select cartodb_id, ST_Translate(the_geom, -50, 0) as the_geom from test_table limit 2 offset 2', cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }', cartocss_version: '2.0.2', - interactivity: [ 'cartodb_id' ] + interactivity: [ 'cartodb_id' ], + geom_column: 'the_geom' } } ] }; @@ -1295,20 +1326,30 @@ describe.skip('multilayer', function() { }); // See https://github.com/CartoDB/Windshaft/issues/163 - it("has different token for different database", - function(done) { + it("has different token for different database", function(done) { var layergroup = { version: '1.0.1', layers: [ { options: { sql: 'select 1 as i, 2::int2 as n, now() as t, ST_SetSRID(ST_MakePoint(0,0),3857) as the_geom', cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }', - cartocss_version: '2.0.1' + cartocss_version: '2.0.1', + geom_column: 'the_geom' } } ] }; + var initialMapConfigs = 0; var token1, token2; step( + function count_mapconfig() { + var next = this; + redis_client.keys('map_cfg|*', function(err, matches) { + if (matches) { + initialMapConfigs = matches.length; + } + next(null); + }); + }, function do_post_1() { var next = this; @@ -1323,7 +1364,7 @@ describe.skip('multilayer', function() { assert.ifError(err); assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body); var parsedBody = JSON.parse(res.body); - token1 = parsedBody.layergroupid; + token1 = LayergroupToken.parse(parsedBody.layergroupid).token; return null; }, function do_post_2() @@ -1340,7 +1381,7 @@ describe.skip('multilayer', function() { assert.ifError(err); assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body); var parsedBody = JSON.parse(res.body); - token2 = parsedBody.layergroupid; + token2 = LayergroupToken.parse(parsedBody.layergroupid).token; assert.ok(token1 !== token2); return null; }, @@ -1353,7 +1394,7 @@ describe.skip('multilayer', function() { if ( err ) { errors.push(err.message); } - assert.equal(matches.length, 2); + assert.equal(matches.length, initialMapConfigs + 2); assert.ok(_.indexOf(matches, 'map_cfg|'+token1) > -1, "Missing expected token " + token1 + " from redis"); assert.ok(_.indexOf(matches, 'map_cfg|'+token2) > -1, @@ -1388,8 +1429,18 @@ describe.skip('multilayer', function() { } } ] }; + var initialMapConfigs = 0; var token1; step( + function count_mapconfig() { + var next = this; + redis_client.keys('map_cfg|*', function(err, matches) { + if (matches) { + initialMapConfigs = matches.length; + } + next(null); + }); + }, function do_post_1() { var next = this; @@ -1404,7 +1455,7 @@ describe.skip('multilayer', function() { assert.ifError(err); assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body); var parsedBody = JSON.parse(res.body); - token1 = parsedBody.layergroupid; + token1 = LayergroupToken.parse(parsedBody.layergroupid).token; return null; }, function do_get_tile(err) @@ -1435,7 +1486,7 @@ describe.skip('multilayer', function() { errors.push(err.message); } try { - assert.equal(matches.length, 1); + assert.equal(matches.length, initialMapConfigs + 1); assert.ok(_.indexOf(matches, 'map_cfg|'+token1) > -1, "Missing expected token " + token1 + " from redis"); } catch (e) { diff --git a/test/acceptance/ported/support/ported_server_options.js b/test/acceptance/ported/support/ported_server_options.js index 2e328473..a635fa51 100644 --- a/test/acceptance/ported/support/ported_server_options.js +++ b/test/acceptance/ported/support/ported_server_options.js @@ -58,6 +58,9 @@ module.exports = _.extend({}, serverOptions, { _.extend(req.params, req.query); req.params.user = 'localhost'; req.params.dbuser = 'test_windshaft_publicuser'; + if (req.params.dbname !== 'windshaft_test2') { + req.params.dbuser = 'test_windshaft_cartodb_user_1'; + } req.params.dbname = 'test_windshaft_cartodb_user_1_db';