@@ -86,35 +86,35 @@ class InstrumentedHttpClientTest extends Specification {
8686 }
8787
8888 app. test { httpClient ->
89- " bar" == httpClient. get(" foo" ). body. text
90- }
91-
92- new PollingConditions () . eventually {
93- def spanData = spanExporter. finishedSpanItems. find { it. name == " GET /foo " }
94- def spanClientData = spanExporter. finishedSpanItems. find { it. name == " GET" && it. kind == CLIENT }
95- def spanDataApi = spanExporter . finishedSpanItems . find { it . name == " GET /bar " && it . kind == SERVER }
96-
97- spanData. traceId == spanClientData . traceId
98- spanData . traceId == spanDataApi . traceId
99-
100- spanData . kind == SERVER
101- spanClientData . kind == CLIENT
102- def atts = spanClientData . attributes . asMap()
103- atts[HTTP_ROUTE ] == " /bar "
104- atts[HTTP_METHOD ] == " GET "
105- atts[ HTTP_STATUS_CODE ] == 200L
106-
107- def attributes = spanData . attributes . asMap()
108- attributes[HTTP_ROUTE ] == " /foo"
109- attributes[SemanticAttributes . HTTP_TARGET ] == " /foo "
110- attributes[HTTP_METHOD ] == " GET "
111- attributes[ HTTP_STATUS_CODE ] == 200L
112-
113- def attsApi = spanDataApi . attributes . asMap()
114- attsApi[HTTP_ROUTE ] == " /bar"
115- attsApi[SemanticAttributes . HTTP_TARGET ] == " /bar "
116- attsApi[HTTP_METHOD ] == " GET "
117- attsApi[ HTTP_STATUS_CODE ] == 200L
89+ assert " bar" == httpClient. get(" foo" ). body. text
90+
91+ new PollingConditions () . eventually {
92+ def spanData = spanExporter . finishedSpanItems . find { it . name == " GET /foo " }
93+ def spanClientData = spanExporter. finishedSpanItems. find { it. name == " GET" && it . kind == CLIENT }
94+ def spanDataApi = spanExporter. finishedSpanItems. find { it. name == " GET /bar " && it. kind == SERVER }
95+
96+ spanData . traceId == spanClientData . traceId
97+ spanData. traceId == spanDataApi . traceId
98+
99+ spanData . kind == SERVER
100+ spanClientData . kind == CLIENT
101+ def atts = spanClientData . attributes . asMap()
102+ atts[ HTTP_ROUTE ] == " /bar "
103+ atts[HTTP_METHOD ] == " GET "
104+ atts[HTTP_STATUS_CODE ] == 200L
105+
106+ def attributes = spanData . attributes . asMap()
107+ attributes[ HTTP_ROUTE ] == " /foo "
108+ attributes[SemanticAttributes . HTTP_TARGET ] == " /foo"
109+ attributes[HTTP_METHOD ] == " GET "
110+ attributes[HTTP_STATUS_CODE ] == 200L
111+
112+ def attsApi = spanDataApi . attributes . asMap()
113+ attsApi[ HTTP_ROUTE ] == " /bar "
114+ attsApi[SemanticAttributes . HTTP_TARGET ] == " /bar"
115+ attsApi[HTTP_METHOD ] == " GET "
116+ attsApi[HTTP_STATUS_CODE ] == 200L
117+ }
118118 }
119119 }
120120
@@ -148,38 +148,38 @@ class InstrumentedHttpClientTest extends Specification {
148148 }
149149
150150 app. test { httpClient ->
151- " hello" == httpClient. get(" path-name" ). body. text
151+ assert " hello" == httpClient. get(" path-name" ). body. text
152152 latch. await(1 , TimeUnit . SECONDS )
153- }
154153
155- new PollingConditions (). eventually {
156- spanExporter. finishedSpanItems. size() == 3
157- def spanData = spanExporter. finishedSpanItems. find { spanData -> spanData. name == " GET /path-name" }
158- def spanClientData1 = spanExporter. finishedSpanItems. find { s -> s. name == " GET" && s. attributes. asMap()[HTTP_ROUTE ] == " /foo" }
159- def spanClientData2 = spanExporter. finishedSpanItems. find { s -> s. name == " GET" && s. attributes. asMap()[HTTP_ROUTE ] == " /bar" }
160-
161- spanData. traceId == spanClientData1. traceId
162- spanData. traceId == spanClientData2. traceId
163-
164- spanData. kind == SERVER
165-
166- spanClientData1. kind == CLIENT
167- def atts = spanClientData1. attributes. asMap()
168- atts[HTTP_ROUTE ] == " /foo"
169- atts[HTTP_METHOD ] == " GET"
170- atts[HTTP_STATUS_CODE ] == 200L
171-
172- spanClientData2. kind == CLIENT
173- def atts2 = spanClientData2. attributes. asMap()
174- atts2[HTTP_ROUTE ] == " /bar"
175- atts2[HTTP_METHOD ] == " GET"
176- atts2[HTTP_STATUS_CODE ] == 200L
177-
178- def attributes = spanData. attributes. asMap()
179- attributes[HTTP_ROUTE ] == " /path-name"
180- attributes[SemanticAttributes . HTTP_TARGET ] == " /path-name"
181- attributes[HTTP_METHOD ] == " GET"
182- attributes[HTTP_STATUS_CODE ] == 200L
154+ new PollingConditions (). eventually {
155+ spanExporter. finishedSpanItems. size() == 3
156+ def spanData = spanExporter. finishedSpanItems. find { spanData -> spanData. name == " GET /path-name" }
157+ def spanClientData1 = spanExporter. finishedSpanItems. find { s -> s. name == " GET" && s. attributes. asMap()[HTTP_ROUTE ] == " /foo" }
158+ def spanClientData2 = spanExporter. finishedSpanItems. find { s -> s. name == " GET" && s. attributes. asMap()[HTTP_ROUTE ] == " /bar" }
159+
160+ spanData. traceId == spanClientData1. traceId
161+ spanData. traceId == spanClientData2. traceId
162+
163+ spanData. kind == SERVER
164+
165+ spanClientData1. kind == CLIENT
166+ def atts = spanClientData1. attributes. asMap()
167+ atts[HTTP_ROUTE ] == " /foo"
168+ atts[HTTP_METHOD ] == " GET"
169+ atts[HTTP_STATUS_CODE ] == 200L
170+
171+ spanClientData2. kind == CLIENT
172+ def atts2 = spanClientData2. attributes. asMap()
173+ atts2[HTTP_ROUTE ] == " /bar"
174+ atts2[HTTP_METHOD ] == " GET"
175+ atts2[HTTP_STATUS_CODE ] == 200L
176+
177+ def attributes = spanData. attributes. asMap()
178+ attributes[HTTP_ROUTE ] == " /path-name"
179+ attributes[SemanticAttributes . HTTP_TARGET ] == " /path-name"
180+ attributes[HTTP_METHOD ] == " GET"
181+ attributes[HTTP_STATUS_CODE ] == 200L
182+ }
183183 }
184184 }
185185
@@ -214,28 +214,30 @@ class InstrumentedHttpClientTest extends Specification {
214214 }
215215 }
216216
217- app. test { httpClient -> " error" == httpClient. get(" path-name" ). body. text }
218-
219- new PollingConditions (). eventually {
220- def spanData = spanExporter. finishedSpanItems. find { it. name == " GET /path-name" }
221- def spanClientData = spanExporter. finishedSpanItems. find { it. name == " GET" }
222-
223- spanData. traceId == spanClientData. traceId
224-
225- spanData. kind == SERVER
226- spanClientData. kind == CLIENT
227- def atts = spanClientData. attributes. asMap()
228- atts[HTTP_ROUTE ] == " /foo"
229- atts[HTTP_METHOD ] == " GET"
230- atts[HTTP_STATUS_CODE ] == null
231- spanClientData. status. statusCode == StatusCode . ERROR
232- spanClientData. events. first(). name == " exception"
233-
234- def attributes = spanData. attributes. asMap()
235- attributes[HTTP_ROUTE ] == " /path-name"
236- attributes[SemanticAttributes . HTTP_TARGET ] == " /path-name"
237- attributes[HTTP_METHOD ] == " GET"
238- attributes[HTTP_STATUS_CODE ] == 200L
217+ app. test { httpClient ->
218+ assert " error" == httpClient. get(" path-name" ). body. text
219+
220+ new PollingConditions (). eventually {
221+ def spanData = spanExporter. finishedSpanItems. find { it. name == " GET /path-name" }
222+ def spanClientData = spanExporter. finishedSpanItems. find { it. name == " GET" }
223+
224+ spanData. traceId == spanClientData. traceId
225+
226+ spanData. kind == SERVER
227+ spanClientData. kind == CLIENT
228+ def atts = spanClientData. attributes. asMap()
229+ atts[HTTP_ROUTE ] == " /foo"
230+ atts[HTTP_METHOD ] == " GET"
231+ atts[HTTP_STATUS_CODE ] == null
232+ spanClientData. status. statusCode == StatusCode . ERROR
233+ spanClientData. events. first(). name == " exception"
234+
235+ def attributes = spanData. attributes. asMap()
236+ attributes[HTTP_ROUTE ] == " /path-name"
237+ attributes[SemanticAttributes . HTTP_TARGET ] == " /path-name"
238+ attributes[HTTP_METHOD ] == " GET"
239+ attributes[HTTP_STATUS_CODE ] == 200L
240+ }
239241 }
240242 }
241243
0 commit comments