Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit 870453f

Browse files
author
Chris Wiechmann
committed
Back to async tests
1 parent fb32067 commit 870453f

File tree

1 file changed

+57
-57
lines changed

1 file changed

+57
-57
lines changed

apibuilder4elastic/test/trafficMonitorAPI/asAdmin/http/test_search_endpoint_AsAdmin.js

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ describe('Endpoints', function () {
5151
*/
5252
after(() => stopApiBuilder(server));
5353

54-
describe('Search', () => {
55-
it('[Search-0001] Execute a search without a limit including all requests from instance-1', () => {
56-
return requestAsync({
54+
describe('Search', async () => {
55+
it('[Search-0001] Execute a search without a limit including all requests from instance-1', async () => {
56+
return await requestAsync({
5757
method: 'GET',
5858
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search`,
5959
headers: {
@@ -74,12 +74,12 @@ describe('Endpoints', function () {
7474
});
7575
});
7676

77-
it('[Endpoint-0002] should return with one result for instance-2', () => {
77+
it('[Endpoint-0002] should return with one result for instance-2', async () => {
7878
const auth = {
7979
user: server.apibuilder.config.apikey || 'test',
8080
password: ''
8181
};
82-
return requestAsync({
82+
return await requestAsync({
8383
method: 'GET',
8484
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-2/ops/search`,
8585
headers: {
@@ -96,12 +96,12 @@ describe('Endpoints', function () {
9696
});
9797
});
9898

99-
it('[Endpoint-0003] should restrict based on the URI and HTTP Verb', () => {
99+
it('[Endpoint-0003] should restrict based on the URI and HTTP Verb', async () => {
100100
const auth = {
101101
user: server.apibuilder.config.apikey || 'test',
102102
password: ''
103103
};
104-
return requestAsync({
104+
return await requestAsync({
105105
method: 'GET',
106106
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=uri&value=%2Fv2%2Fpet%2FfindByStatus&field=method&value=GET`,
107107
headers: {
@@ -119,12 +119,12 @@ describe('Endpoints', function () {
119119
checkFields(body.data, true);
120120
});
121121
});
122-
it('[Endpoint-0004] should return 1 entry based on duration filter', () => {
122+
it('[Endpoint-0004] should return 1 entry based on duration filter', async () => {
123123
const auth = {
124124
user: server.apibuilder.config.apikey || 'test',
125125
password: ''
126126
};
127-
return requestAsync({
127+
return await requestAsync({
128128
method: 'GET',
129129
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=duration&op=gt&value=100`,
130130
headers: {
@@ -140,12 +140,12 @@ describe('Endpoints', function () {
140140
checkFields(body.data, true);
141141
});
142142
});
143-
it('[Endpoint-0005] should return 1 entry based on operation filter', () => {
143+
it('[Endpoint-0005] should return 1 entry based on operation filter', async () => {
144144
const auth = {
145145
user: server.apibuilder.config.apikey || 'test',
146146
password: ''
147147
};
148-
return requestAsync({
148+
return await requestAsync({
149149
method: 'GET',
150150
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=operation&value=findPetsByStatus`,
151151
headers: {
@@ -162,12 +162,12 @@ describe('Endpoints', function () {
162162
checkFields(body.data, true);
163163
});
164164
});
165-
it('[Endpoint-0006] should return 0 entries as all test data is in the past', () => {
165+
it('[Endpoint-0006] should return 0 entries as all test data is in the past', async () => {
166166
const auth = {
167167
user: server.apibuilder.config.apikey || 'test',
168168
password: ''
169169
};
170-
return requestAsync({
170+
return await requestAsync({
171171
method: 'GET',
172172
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?ago=5m`, // The first entry is generated with 8 minutes in the past
173173
headers: {
@@ -182,7 +182,7 @@ describe('Endpoints', function () {
182182
expect(body.data).to.have.lengthOf(0);
183183
});
184184
});
185-
it('[Endpoint-0007] should return 2 when using a custom time-range', () => {
185+
it('[Endpoint-0007] should return 2 when using a custom time-range', async () => {
186186
//
187187
/**
188188
* The dates given here must be aligned with dates in search_test_documents.js. Currently configured like so:
@@ -195,7 +195,7 @@ describe('Endpoints', function () {
195195
const greaterThenThisDate = getDate('10h', true);
196196
const lowerThanThisDate = getDate('10m', true);
197197
console.log(`Query with greaterThenThisDate: ${greaterThenThisDate} and lowerThanThisDate: ${lowerThanThisDate}`);
198-
return requestAsync({
198+
return await requestAsync({
199199
method: 'GET',
200200
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=timestamp&op=gt&value=${greaterThenThisDate}&field=timestamp&op=lt&value=${lowerThanThisDate}`,
201201
headers: {
@@ -212,7 +212,7 @@ describe('Endpoints', function () {
212212
expect(body.data[1].correlationId).to.equal("19250f5f4321b5ba2a4de364");
213213
});
214214
});
215-
it('[Endpoint-0008] should return 3 when using a wider custom time-range', () => {
215+
it('[Endpoint-0008] should return 3 when using a wider custom time-range', async () => {
216216
//
217217
/**
218218
* The dates given here must be aligned with dates in search_test_documents.js. Currently configured like so:
@@ -226,7 +226,7 @@ describe('Endpoints', function () {
226226
const greaterThenThisDate = getDate('110h', true);
227227
const lowerThanThisDate = getDate('5m', true);
228228
console.log(`Query with greaterThenThisDate: ${greaterThenThisDate} and lowerThanThisDate: ${lowerThanThisDate}`);
229-
return requestAsync({
229+
return await requestAsync({
230230
method: 'GET',
231231
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=timestamp&op=gt&value=${greaterThenThisDate}&field=timestamp&op=lt&value=${lowerThanThisDate}`,
232232
headers: {
@@ -245,8 +245,8 @@ describe('Endpoints', function () {
245245
expect(body.data[3].correlationId).to.equal("19250f5f4321b5ba2a4de364");
246246
});
247247
});
248-
it('[Endpoint-0009] should return two entries with localport 8080', () => {
249-
return requestAsync({
248+
it('[Endpoint-0009] should return two entries with localport 8080', async () => {
249+
return await requestAsync({
250250
method: 'GET',
251251
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=localPort&value=8080`,
252252
headers: {
@@ -263,8 +263,8 @@ describe('Endpoints', function () {
263263
});
264264
});
265265

266-
it('[Endpoint-0010A] should return one entry with localport 8080 and given subject-id', () => {
267-
return requestAsync({
266+
it('[Endpoint-0010A] should return one entry with localport 8080 and given subject-id', async () => {
267+
return await requestAsync({
268268
method: 'GET',
269269
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=localPort&value=8080&field=subject&value=Chris-Test`,
270270
headers: {
@@ -281,8 +281,8 @@ describe('Endpoints', function () {
281281
expect(body.data[0].subject).to.equals('Chris-Test');
282282
});
283283
});
284-
it('[Endpoint-0010B] should return one entry with localport 8080 and a part of the original subject ID', () => {
285-
return requestAsync({
284+
it('[Endpoint-0010B] should return one entry with localport 8080 and a part of the original subject ID', async () => {
285+
return await requestAsync({
286286
method: 'GET',
287287
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=localPort&value=8080&field=subject&value=Chris`,
288288
headers: {
@@ -299,8 +299,8 @@ describe('Endpoints', function () {
299299
expect(body.data[0].subject).to.equals('Chris-Test');
300300
});
301301
});
302-
it('[Endpoint-0011] should return one entry with localport 8080 and given subject-id', () => {
303-
return requestAsync({
302+
it('[Endpoint-0011] should return one entry with localport 8080 and given subject-id', async () => {
303+
return await requestAsync({
304304
method: 'GET',
305305
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=status&value=404`,
306306
headers: {
@@ -317,8 +317,8 @@ describe('Endpoints', function () {
317317
expect(body.data[0].uri).to.equals('/favicon.ico');
318318
});
319319
});
320-
it('[Endpoint-0012] should return one entry with localadr 1.1.1.1', () => {
321-
return requestAsync({
320+
it('[Endpoint-0012] should return one entry with localadr 1.1.1.1', async () => {
321+
return await requestAsync({
322322
method: 'GET',
323323
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=localAddr&value=1.1.1.1`,
324324
headers: {
@@ -335,8 +335,8 @@ describe('Endpoints', function () {
335335
expect(body.data[0].uri).to.equals('/healthcheck');
336336
});
337337
});
338-
it('[Endpoint-0013] should return one entry with remoteName (remoteHost) TestHost', () => {
339-
return requestAsync({
338+
it('[Endpoint-0013] should return one entry with remoteName (remoteHost) TestHost', async () => {
339+
return await requestAsync({
340340
method: 'GET',
341341
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=remoteName&value=TestHost`,
342342
headers: {
@@ -353,8 +353,8 @@ describe('Endpoints', function () {
353353
expect(body.data[0].uri).to.equals('/healthcheck');
354354
});
355355
});
356-
it('[Endpoint-0014] should return one entry with remotePort 59641', () => {
357-
return requestAsync({
356+
it('[Endpoint-0014] should return one entry with remotePort 59641', async () => {
357+
return await requestAsync({
358358
method: 'GET',
359359
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=remotePort&value=59641`,
360360
headers: {
@@ -371,8 +371,8 @@ describe('Endpoints', function () {
371371
expect(body.data[0].uri).to.equals('/favicon.ico');
372372
});
373373
});
374-
it('[Endpoint-0015] should return one entry with service name Petstore HTTP', () => {
375-
return requestAsync({
374+
it('[Endpoint-0015] should return one entry with service name Petstore HTTP', async () => {
375+
return await requestAsync({
376376
method: 'GET',
377377
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=serviceName&value=Petstore%20HTTP`,
378378
headers: {
@@ -390,8 +390,8 @@ describe('Endpoints', function () {
390390
expect(body.data[1].uri).to.equals('/petstore/v2/pet/findByStatus');
391391
});
392392
});
393-
it('[Endpoint-0016] should return one entry WAF-Status 1', () => {
394-
return requestAsync({
393+
it('[Endpoint-0016] should return one entry WAF-Status 1', async () => {
394+
return await requestAsync({
395395
method: 'GET',
396396
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=wafStatus&value=1`,
397397
headers: {
@@ -408,8 +408,8 @@ describe('Endpoints', function () {
408408
expect(body.data[0].uri).to.equals('/favicon.ico');
409409
});
410410
});
411-
it('[Endpoint-0017] should return one entry with the given correlation id', () => {
412-
return requestAsync({
411+
it('[Endpoint-0017] should return one entry with the given correlation id', async () => {
412+
return await requestAsync({
413413
method: 'GET',
414414
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=correlationId&value=682c0f5fbe23dc8e1d80efe2`,
415415
headers: {
@@ -426,8 +426,8 @@ describe('Endpoints', function () {
426426
expect(body.data[0].serviceName).to.equals('Petstore');
427427
});
428428
});
429-
it('[Endpoint-0018] should return one entry with final status Error', () => {
430-
return requestAsync({
429+
it('[Endpoint-0018] should return one entry with final status Error', async () => {
430+
return await requestAsync({
431431
method: 'GET',
432432
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=finalStatus&value=Error`,
433433
headers: {
@@ -443,8 +443,8 @@ describe('Endpoints', function () {
443443
expect(body.data[0].uri).to.equals('/healthcheck');
444444
});
445445
});
446-
it('[Endpoint-0019] should return results with a wildcard path.', () => {
447-
return requestAsync({
446+
it('[Endpoint-0019] should return results with a wildcard path.', async () => {
447+
return await requestAsync({
448448
method: 'GET',
449449
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=uri&value=%2Fv2%2Fpet`,
450450
headers: {
@@ -461,8 +461,8 @@ describe('Endpoints', function () {
461461
expect(body.data[1].uri).to.equals('/petstore/v2/pet/findByStatus');
462462
});
463463
});
464-
it('[Endpoint-0020] Should return 1 entry in the last 10 minutes (ago=10m)', () => {
465-
return requestAsync({
464+
it('[Endpoint-0020] Should return 1 entry in the last 10 minutes (ago=10m)', async () => {
465+
return await requestAsync({
466466
method: 'GET',
467467
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?ago=10m`,
468468
headers: {
@@ -478,8 +478,8 @@ describe('Endpoints', function () {
478478
expect(body.data[0].uri).to.equals('/petstore/v2/pet/findByTag');
479479
});
480480
});
481-
it('[Endpoint-0021] Should return 2 entries in the last 30 minutes (ago=30m)', () => {
482-
return requestAsync({
481+
it('[Endpoint-0021] Should return 2 entries in the last 30 minutes (ago=30m)', async () => {
482+
return await requestAsync({
483483
method: 'GET',
484484
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?ago=30m`,
485485
headers: {
@@ -495,8 +495,8 @@ describe('Endpoints', function () {
495495
expect(body.data[0].uri).to.equals('/petstore/v2/pet/findByTag');
496496
});
497497
});
498-
it('[Endpoint-0022] Should return 4 entries in the last 2 hours (ago=120h)', () => {
499-
return requestAsync({
498+
it('[Endpoint-0022] Should return 4 entries in the last 2 hours (ago=120h)', async () => {
499+
return await requestAsync({
500500
method: 'GET',
501501
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?ago=2h`,
502502
headers: {
@@ -512,8 +512,8 @@ describe('Endpoints', function () {
512512
expect(body.data[0].uri).to.equals('/petstore/v2/pet/findByTag');
513513
});
514514
});
515-
it('[Endpoint-0023] Should include the V-Host value', () => {
516-
return requestAsync({
515+
it('[Endpoint-0023] Should include the V-Host value', async () => {
516+
return await requestAsync({
517517
method: 'GET',
518518
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=correlationId&value=7a240f5f0e21555d2d343482`,
519519
headers: {
@@ -527,8 +527,8 @@ describe('Endpoints', function () {
527527
expect(body.data[0].vhost).to.equal('api.customer.com:443', 'V-Host is not part of the result');
528528
});
529529
});
530-
it('[Endpoint-0024] Should not return anything when using the wrong request protocol.', () => {
531-
return requestAsync({
530+
it('[Endpoint-0024] Should not return anything when using the wrong request protocol.', async () => {
531+
return await requestAsync({
532532
method: 'GET',
533533
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?protocol=filetransfer`,
534534
headers: {
@@ -543,8 +543,8 @@ describe('Endpoints', function () {
543543
expect(body.data).to.have.lengthOf(0);
544544
});
545545
});
546-
it('[Endpoint-0025] Should return the OPTIONS request including the URI', () => {
547-
return requestAsync({
546+
it('[Endpoint-0025] Should return the OPTIONS request including the URI', async () => {
547+
return await requestAsync({
548548
method: 'GET',
549549
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-2/ops/search?protocol=http&field=method&value=OPTIONS`,
550550
headers: {
@@ -562,8 +562,8 @@ describe('Endpoints', function () {
562562
});
563563

564564
// See issue #52
565-
it('[Endpoint-0026] With query on v2/pet/findByTag should return only ONE API.', () => {
566-
return requestAsync({
565+
it('[Endpoint-0026] With query on v2/pet/findByTag should return only ONE API.', async () => {
566+
return await requestAsync({
567567
method: 'GET',
568568
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=uri&value=%2Fpetstore%2Fv2%2Fpet%2FfindByTag&field=method&value=GET`,
569569
headers: {
@@ -581,8 +581,8 @@ describe('Endpoints', function () {
581581
});
582582
});
583583

584-
it('[Endpoint-0027] Should ignore the region if null', () => {
585-
return requestAsync({
584+
it('[Endpoint-0027] Should ignore the region if null', async () => {
585+
return await requestAsync({
586586
method: 'GET',
587587
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/router/service/instance-1/ops/search?field=uri&value=%2Fpetstore%2Fv2%2Fpet%2FfindByTag&field=method&value=GET`,
588588
headers: {

0 commit comments

Comments
 (0)