Skip to content

Commit

Permalink
Fixing service maps API test (#77586)
Browse files Browse the repository at this point in the history
* fixing api tests

* fixing api tests
  • Loading branch information
cauemarcondes authored Sep 16, 2020
1 parent f70aace commit 6c5258a
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 152 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

163 changes: 11 additions & 152 deletions x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, any> }) => {
environments.add(element.data['service.environment']);
});
expect(environments.size).to.eql(1);
expect(environments.has(ENVIRONMENT_NOT_DEFINED)).to.eql(true);
expectSnapshot(body).toMatch();
});
});
});
Expand Down

0 comments on commit 6c5258a

Please sign in to comment.