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

Commit 900b0d7

Browse files
author
Chris Wiechmann
committed
Switched tests to await
1 parent 3b1390f commit 900b0d7

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

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

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('Endpoints', function () {
5353

5454
describe('Search', () => {
5555
it('[Search-0001] Execute a search without a limit including all requests from instance-1', () => {
56-
return requestAsync({
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: {
@@ -79,7 +79,7 @@ describe('Endpoints', function () {
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: {
@@ -101,7 +101,7 @@ describe('Endpoints', function () {
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: {
@@ -124,7 +124,7 @@ describe('Endpoints', function () {
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: {
@@ -145,7 +145,7 @@ describe('Endpoints', function () {
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: {
@@ -167,7 +167,7 @@ describe('Endpoints', function () {
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: {
@@ -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: {
@@ -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: {
@@ -246,7 +246,7 @@ describe('Endpoints', function () {
246246
});
247247
});
248248
it('[Endpoint-0009] should return two entries with localport 8080', () => {
249-
return requestAsync({
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: {
@@ -264,7 +264,7 @@ describe('Endpoints', function () {
264264
});
265265

266266
it('[Endpoint-0010A] should return one entry with localport 8080 and given subject-id', () => {
267-
return requestAsync({
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.only('[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', () => {
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: {
@@ -300,7 +300,7 @@ describe('Endpoints', function () {
300300
});
301301
});
302302
it('[Endpoint-0011] should return one entry with localport 8080 and given subject-id', () => {
303-
return requestAsync({
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: {
@@ -318,7 +318,7 @@ describe('Endpoints', function () {
318318
});
319319
});
320320
it('[Endpoint-0012] should return one entry with localadr 1.1.1.1', () => {
321-
return requestAsync({
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: {
@@ -336,7 +336,7 @@ describe('Endpoints', function () {
336336
});
337337
});
338338
it('[Endpoint-0013] should return one entry with remoteName (remoteHost) TestHost', () => {
339-
return requestAsync({
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: {
@@ -354,7 +354,7 @@ describe('Endpoints', function () {
354354
});
355355
});
356356
it('[Endpoint-0014] should return one entry with remotePort 59641', () => {
357-
return requestAsync({
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: {
@@ -372,7 +372,7 @@ describe('Endpoints', function () {
372372
});
373373
});
374374
it('[Endpoint-0015] should return one entry with service name Petstore HTTP', () => {
375-
return requestAsync({
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: {
@@ -391,7 +391,7 @@ describe('Endpoints', function () {
391391
});
392392
});
393393
it('[Endpoint-0016] should return one entry WAF-Status 1', () => {
394-
return requestAsync({
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: {
@@ -409,7 +409,7 @@ describe('Endpoints', function () {
409409
});
410410
});
411411
it('[Endpoint-0017] should return one entry with the given correlation id', () => {
412-
return requestAsync({
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: {
@@ -427,7 +427,7 @@ describe('Endpoints', function () {
427427
});
428428
});
429429
it('[Endpoint-0018] should return one entry with final status Error', () => {
430-
return requestAsync({
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: {
@@ -444,7 +444,7 @@ describe('Endpoints', function () {
444444
});
445445
});
446446
it('[Endpoint-0019] should return results with a wildcard path.', () => {
447-
return requestAsync({
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: {
@@ -462,7 +462,7 @@ describe('Endpoints', function () {
462462
});
463463
});
464464
it('[Endpoint-0020] Should return 1 entry in the last 10 minutes (ago=10m)', () => {
465-
return requestAsync({
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: {
@@ -479,7 +479,7 @@ describe('Endpoints', function () {
479479
});
480480
});
481481
it('[Endpoint-0021] Should return 2 entries in the last 30 minutes (ago=30m)', () => {
482-
return requestAsync({
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: {
@@ -496,7 +496,7 @@ describe('Endpoints', function () {
496496
});
497497
});
498498
it('[Endpoint-0022] Should return 4 entries in the last 2 hours (ago=120h)', () => {
499-
return requestAsync({
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: {
@@ -513,7 +513,7 @@ describe('Endpoints', function () {
513513
});
514514
});
515515
it('[Endpoint-0023] Should include the V-Host value', () => {
516-
return requestAsync({
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: {
@@ -528,7 +528,7 @@ describe('Endpoints', function () {
528528
});
529529
});
530530
it('[Endpoint-0024] Should not return anything when using the wrong request protocol.', () => {
531-
return requestAsync({
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: {
@@ -544,7 +544,7 @@ describe('Endpoints', function () {
544544
});
545545
});
546546
it('[Endpoint-0025] Should return the OPTIONS request including the URI', () => {
547-
return requestAsync({
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: {
@@ -563,7 +563,7 @@ describe('Endpoints', function () {
563563

564564
// See issue #52
565565
it('[Endpoint-0026] With query on v2/pet/findByTag should return only ONE API.', () => {
566-
return requestAsync({
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: {
@@ -582,7 +582,7 @@ describe('Endpoints', function () {
582582
});
583583

584584
it('[Endpoint-0027] Should ignore the region if null', () => {
585-
return requestAsync({
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)