@@ -25,7 +25,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
2525 'user.username,user.id,host.ip,user_agent.name,kubernetes.pod.uuid,url.domain,container.id,service.node.name' ;
2626
2727 // Failing: See https://github.com/elastic/kibana/issues/81264
28- describe . skip ( 'Slow durations' , ( ) => {
28+ describe ( 'Slow durations' , ( ) => {
2929 const url = format ( {
3030 pathname : `/api/apm/correlations/slow_durations` ,
3131 query : { start, end, durationPercentile, fieldNames } ,
@@ -40,21 +40,21 @@ export default function ApiTest({ getService }: FtrProviderContext) {
4040 } ) ;
4141 } ) ;
4242
43- describe ( 'with default scoring' , ( ) => {
44- let response : PromiseReturnType < typeof supertest . get > ;
45- before ( async ( ) => {
46- await esArchiver . load ( archiveName ) ;
47- response = await supertest . get ( url ) ;
48- } ) ;
49-
43+ describe ( 'when data is loaded' , ( ) => {
44+ before ( ( ) => esArchiver . load ( archiveName ) ) ;
5045 after ( ( ) => esArchiver . unload ( archiveName ) ) ;
5146
52- it ( 'returns successfully' , ( ) => {
53- expect ( response . status ) . to . eql ( 200 ) ;
54- } ) ;
47+ describe ( 'making request with default args' , ( ) => {
48+ let response : PromiseReturnType < typeof supertest . get > ;
49+ before ( async ( ) => {
50+ response = await supertest . get ( url ) ;
51+
52+ it ( 'returns successfully' , ( ) => {
53+ expect ( response . status ) . to . eql ( 200 ) ;
54+ } ) ;
5555
56- it ( 'returns fields in response' , ( ) => {
57- expectSnapshot ( Object . keys ( response . body . response ) ) . toMatchInline ( `
56+ it ( 'returns fields in response' , ( ) => {
57+ expectSnapshot ( Object . keys ( response . body . response ) ) . toMatchInline ( `
5858 Array [
5959 "service.node.name",
6060 "host.ip",
@@ -64,14 +64,14 @@ export default function ApiTest({ getService }: FtrProviderContext) {
6464 "url.domain",
6565 ]
6666 ` ) ;
67- } ) ;
67+ } ) ;
6868
69- it ( 'returns cardinality for each field' , ( ) => {
70- const cardinalitys = Object . values ( response . body . response ) . map (
71- ( field : any ) => field . cardinality
72- ) ;
69+ it ( 'returns cardinality for each field' , ( ) => {
70+ const cardinalitys = Object . values ( response . body . response ) . map (
71+ ( field : any ) => field . cardinality
72+ ) ;
7373
74- expectSnapshot ( cardinalitys ) . toMatchInline ( `
74+ expectSnapshot ( cardinalitys ) . toMatchInline ( `
7575 Array [
7676 5,
7777 6,
@@ -81,58 +81,35 @@ export default function ApiTest({ getService }: FtrProviderContext) {
8181 4,
8282 ]
8383 ` ) ;
84- } ) ;
84+ } ) ;
8585
86- it ( 'returns buckets' , ( ) => {
87- const { buckets } = response . body . response [ 'user.id' ] . value ;
88- expectSnapshot ( buckets [ 0 ] ) . toMatchInline ( `
86+ it ( 'returns buckets' , ( ) => {
87+ const { buckets } = response . body . response [ 'user.id' ] . value ;
88+ expectSnapshot ( buckets [ 0 ] ) . toMatchInline ( `
8989 Object {
9090 "bg_count": 32,
9191 "doc_count": 6,
9292 "key": "2",
9393 "score": 0.1875,
9494 }
9595 ` ) ;
96+ } ) ;
97+ } ) ;
9698 } ) ;
97- } ) ;
9899
99- describe ( 'with different scoring' , ( ) => {
100- before ( async ( ) => esArchiver . load ( archiveName ) ) ;
101- after ( ( ) => esArchiver . unload ( archiveName ) ) ;
102-
103- it ( `returns buckets for each score` , async ( ) => {
104- const promises = [ 'percentage' , 'jlh' , 'chi_square' , 'gnd' ] . map ( async ( scoring ) => {
105- const response = await supertest . get (
106- format ( {
107- pathname : `/api/apm/correlations/slow_durations` ,
108- query : { start, end, durationPercentile, fieldNames, scoring } ,
109- } )
110- ) ;
111-
112- return { name : scoring , value : response . body . response [ 'user.id' ] . value . buckets [ 0 ] . score } ;
100+ describe ( 'making a request for each "scoring"' , ( ) => {
101+ [ 'percentage' , 'jlh' , 'chi_square' , 'gnd' ] . map ( async ( scoring ) => {
102+ it ( `returns response for scoring "${ scoring } "` , async ( ) => {
103+ const response = await supertest . get (
104+ format ( {
105+ pathname : `/api/apm/correlations/slow_durations` ,
106+ query : { start, end, durationPercentile, fieldNames, scoring } ,
107+ } )
108+ ) ;
109+
110+ expect ( response . status ) . to . be ( 200 ) ;
111+ } ) ;
113112 } ) ;
114-
115- const res = await Promise . all ( promises ) ;
116- expectSnapshot ( res ) . toMatchInline ( `
117- Array [
118- Object {
119- "name": "percentage",
120- "value": 0.1875,
121- },
122- Object {
123- "name": "jlh",
124- "value": 3.33506905769659,
125- },
126- Object {
127- "name": "chi_square",
128- "value": 219.192006524483,
129- },
130- Object {
131- "name": "gnd",
132- "value": 0.671406580688819,
133- },
134- ]
135- ` ) ;
136113 } ) ;
137114 } ) ;
138115 } ) ;
0 commit comments