diff --git a/x-pack/test/apm_api_integration/trial/tests/service_maps/__snapshots__/service_maps.snap b/x-pack/test/apm_api_integration/trial/tests/service_maps/__snapshots__/service_maps.snap index 2306ca16dd71d..1424ca42539c0 100644 --- a/x-pack/test/apm_api_integration/trial/tests/service_maps/__snapshots__/service_maps.snap +++ b/x-pack/test/apm_api_integration/trial/tests/service_maps/__snapshots__/service_maps.snap @@ -1,5 +1,68 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Service Maps with a trial license /api/apm/service-map when there is data returns service map elements filtering by environment not defined 1`] = ` +Object { + "elements": Array [ + Object { + "data": Object { + "agent.name": "nodejs", + "id": "opbeans-node", + "service.environment": "ENVIRONMENT_NOT_DEFINED", + "service.name": "opbeans-node", + }, + }, + Object { + "data": Object { + "agent.name": "python", + "id": "opbeans-python", + "service.environment": "ENVIRONMENT_NOT_DEFINED", + "service.name": "opbeans-python", + }, + }, + Object { + "data": Object { + "agent.name": "ruby", + "id": "opbeans-ruby", + "service.environment": "ENVIRONMENT_NOT_DEFINED", + "service.name": "opbeans-ruby", + }, + }, + Object { + "data": Object { + "agent.name": "java", + "id": "opbeans-java", + "service.environment": "ENVIRONMENT_NOT_DEFINED", + "service.name": "opbeans-java", + }, + }, + Object { + "data": Object { + "agent.name": "go", + "id": "opbeans-go", + "service.environment": "ENVIRONMENT_NOT_DEFINED", + "service.name": "opbeans-go", + }, + }, + Object { + "data": Object { + "agent.name": "rum-js", + "id": "opbeans-rum", + "service.environment": "ENVIRONMENT_NOT_DEFINED", + "service.name": "opbeans-rum", + }, + }, + Object { + "data": Object { + "agent.name": "dotnet", + "id": "opbeans-dotnet", + "service.environment": "ENVIRONMENT_NOT_DEFINED", + "service.name": "opbeans-dotnet", + }, + }, + ], +} +`; + exports[`Service Maps with a trial license /api/apm/service-map when there is data returns the correct data 3`] = ` Array [ Object { diff --git a/x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts b/x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts index 5be9f2c836af9..be3301964bd3c 100644 --- a/x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts +++ b/x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts @@ -86,159 +86,18 @@ export default function serviceMapsApiTests({ getService }: FtrProviderContext) }); it('returns service map elements filtering by environment not defined', async () => { - const encodedStart = encodeURIComponent('2020-06-28T10:24:46.055Z'); - const encodedEnd = encodeURIComponent('2020-06-29T10:24:46.055Z'); - const environment = 'ENVIRONMENT_NOT_DEFINED'; - const resp = await supertest.get( - `/api/apm/service-map?start=${encodedStart}&end=${encodedEnd}&environment=${environment}` + const ENVIRONMENT_NOT_DEFINED = 'ENVIRONMENT_NOT_DEFINED'; + const { body, status } = await supertest.get( + `/api/apm/service-map?start=${start}&end=${end}&environment=${ENVIRONMENT_NOT_DEFINED}` ); - expect(resp.status).to.be(200); - expectSnapshot(resp.body).toMatchInline(` - Object { - "elements": Array [ - Object { - "data": Object { - "id": "client~opbeans-node", - "source": "client", - "sourceData": Object { - "agent.name": "rum-js", - "id": "client", - "service.environment": "ENVIRONMENT_NOT_DEFINED", - "service.name": "client", - }, - "target": "opbeans-node", - "targetData": Object { - "agent.name": "nodejs", - "id": "opbeans-node", - "service.environment": "ENVIRONMENT_NOT_DEFINED", - "service.name": "opbeans-node", - }, - }, - }, - Object { - "data": Object { - "id": "opbeans-java~>postgresql", - "source": "opbeans-java", - "sourceData": Object { - "agent.name": "java", - "id": "opbeans-java", - "service.environment": "ENVIRONMENT_NOT_DEFINED", - "service.name": "opbeans-java", - }, - "target": ">postgresql", - "targetData": Object { - "id": ">postgresql", - "label": "postgresql", - "span.destination.service.resource": "postgresql", - "span.subtype": "postgresql", - "span.type": "db", - }, - }, - }, - Object { - "data": Object { - "id": "opbeans-node~>postgresql", - "source": "opbeans-node", - "sourceData": Object { - "agent.name": "nodejs", - "id": "opbeans-node", - "service.environment": "ENVIRONMENT_NOT_DEFINED", - "service.name": "opbeans-node", - }, - "target": ">postgresql", - "targetData": Object { - "id": ">postgresql", - "label": "postgresql", - "span.destination.service.resource": "postgresql", - "span.subtype": "postgresql", - "span.type": "db", - }, - }, - }, - Object { - "data": Object { - "id": "opbeans-node~>redis", - "source": "opbeans-node", - "sourceData": Object { - "agent.name": "nodejs", - "id": "opbeans-node", - "service.environment": "ENVIRONMENT_NOT_DEFINED", - "service.name": "opbeans-node", - }, - "target": ">redis", - "targetData": Object { - "id": ">redis", - "label": "redis", - "span.destination.service.resource": "redis", - "span.subtype": "redis", - "span.type": "cache", - }, - }, - }, - Object { - "data": Object { - "id": "opbeans-node~opbeans-java", - "source": "opbeans-node", - "sourceData": Object { - "agent.name": "nodejs", - "id": "opbeans-node", - "service.environment": "ENVIRONMENT_NOT_DEFINED", - "service.name": "opbeans-node", - }, - "target": "opbeans-java", - "targetData": Object { - "agent.name": "java", - "id": "opbeans-java", - "service.environment": "ENVIRONMENT_NOT_DEFINED", - "service.name": "opbeans-java", - }, - }, - }, - Object { - "data": Object { - "agent.name": "rum-js", - "id": "client", - "service.environment": "ENVIRONMENT_NOT_DEFINED", - "service.name": "client", - }, - }, - Object { - "data": Object { - "agent.name": "nodejs", - "id": "opbeans-node", - "service.environment": "ENVIRONMENT_NOT_DEFINED", - "service.name": "opbeans-node", - }, - }, - Object { - "data": Object { - "id": ">redis", - "label": "redis", - "span.destination.service.resource": "redis", - "span.subtype": "redis", - "span.type": "cache", - }, - }, - Object { - "data": Object { - "agent.name": "java", - "id": "opbeans-java", - "service.environment": "ENVIRONMENT_NOT_DEFINED", - "service.name": "opbeans-java", - }, - }, - Object { - "data": Object { - "id": ">postgresql", - "label": "postgresql", - "span.destination.service.resource": "postgresql", - "span.subtype": "postgresql", - "span.type": "db", - }, - }, - ], - } - `); + expect(status).to.be(200); + const environments = new Set(); + body.elements.forEach((element: { data: Record }) => { + environments.add(element.data['service.environment']); + }); + expect(environments.size).to.eql(1); + expect(environments.has(ENVIRONMENT_NOT_DEFINED)).to.eql(true); + expectSnapshot(body).toMatch(); }); }); });