Skip to content

Commit

Permalink
[Maps] Fix apis Maps endpoints getTile should return vector tile cont…
Browse files Browse the repository at this point in the history
…aining document (elastic#114509)

* [Maps] Fix apis Maps endpoints getTile should return vector tile containing document

* use find instead of if statement

* eslint

* can not use layer.feature.find is layer.feature is not an array

* unskip other test where fix has been merged

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
2 people authored and gbamparop committed Oct 13, 2021
1 parent 22bd32d commit 6bb644b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
27 changes: 21 additions & 6 deletions x-pack/test/api_integration/apis/maps/get_tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@ import Protobuf from 'pbf';
import expect from '@kbn/expect';
import { MVT_SOURCE_LAYER_NAME } from '../../../../plugins/maps/common/constants';

function findFeature(layer, callbackFn) {
for (let i = 0; i < layer.length; i++) {
const feature = layer.feature(i);
if (callbackFn(feature)) {
return feature;
}
}
}

export default function ({ getService }) {
const supertest = getService('supertest');

// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/114471
describe.skip('getTile', () => {
describe('getTile', () => {
it('should return vector tile containing document', async () => {
const resp = await supertest
.get(
Expand All @@ -32,8 +40,12 @@ export default function ({ getService }) {
const layer = jsonTile.layers[MVT_SOURCE_LAYER_NAME];
expect(layer.length).to.be(3); // 2 docs + the metadata feature

// 1st doc
const feature = layer.feature(0);
// Verify ES document

const feature = findFeature(layer, (feature) => {
return feature.properties._id === 'AU_x3_BsGFA8no6Qjjug';
});
expect(feature).not.to.be(undefined);
expect(feature.type).to.be(1);
expect(feature.extent).to.be(4096);
expect(feature.id).to.be(undefined);
Expand All @@ -46,8 +58,11 @@ export default function ({ getService }) {
});
expect(feature.loadGeometry()).to.eql([[{ x: 44, y: 2382 }]]);

// Metadata feature
const metadataFeature = layer.feature(2);
// Verify metadata feature
const metadataFeature = findFeature(layer, (feature) => {
return feature.properties.__kbn_metadata_feature__;
});
expect(metadataFeature).not.to.be(undefined);
expect(metadataFeature.type).to.be(3);
expect(metadataFeature.extent).to.be(4096);
expect(metadataFeature.id).to.be(undefined);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export default function ({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['maps']);
const security = getService('security');

// FLAKY: https://github.com/elastic/kibana/issues/114418
describe.skip('docvalue_fields', () => {
describe('docvalue_fields', () => {
before(async () => {
await security.testUser.setRoles(['global_maps_read', 'test_logstash_reader'], false);
});
Expand Down

0 comments on commit 6bb644b

Please sign in to comment.