@@ -147,10 +147,10 @@ void shouldCreateClientSpans() {
147
147
String serverTraceId = null ;
148
148
String clientSpanId = null ;
149
149
150
- Awaitility .await ().atMost (Duration .ofMinutes ( 2 ))
151
- .until (() -> getServerSpans ("POST /call-hello-client-trace" , "/call-hello-client-trace" ).size () > 0 );
150
+ Awaitility .await ().atMost (Duration .ofSeconds ( 30 ))
151
+ .until (() -> getServerSpansFromPath ("POST /call-hello-client-trace" , "/call-hello-client-trace" ).size () > 0 );
152
152
153
- List <Map <String , Object >> spans = getServerSpans ("POST /call-hello-client-trace" , "/call-hello-client-trace" );
153
+ List <Map <String , Object >> spans = getServerSpansFromPath ("POST /call-hello-client-trace" , "/call-hello-client-trace" );
154
154
Assertions .assertEquals (1 , spans .size ());
155
155
156
156
final Map <String , Object > initialServerSpan = spans .get (0 );
@@ -177,7 +177,10 @@ void shouldCreateClientSpans() {
177
177
Assertions .assertNotNull (initialServerSpan .get ("attr_client.address" ));
178
178
Assertions .assertNotNull (initialServerSpan .get ("attr_user_agent.original" ));
179
179
180
- spans = getClientSpans ("POST" , "http://localhost:8081/hello?count=3" );
180
+ Awaitility .await ().atMost (Duration .ofSeconds (30 ))
181
+ .until (() -> getClientSpansFromFullUrl ("POST" , "http://localhost:8081/hello?count=3" ).size () > 0 );
182
+
183
+ spans = getClientSpansFromFullUrl ("POST" , "http://localhost:8081/hello?count=3" );
181
184
Assertions .assertEquals (1 , spans .size ());
182
185
183
186
final Map <String , Object > clientSpan = spans .get (0 );
@@ -205,7 +208,9 @@ void shouldCreateClientSpans() {
205
208
206
209
clientSpanId = (String ) clientSpan .get ("spanId" );
207
210
208
- spans = getServerSpans ("POST /hello" , "/hello?count=3" );
211
+ Awaitility .await ().atMost (Duration .ofSeconds (30 ))
212
+ .until (() -> getServerSpansFromPath ("POST /hello" , "/hello" ).size () > 0 );
213
+ spans = getServerSpansFromPath ("POST /hello" , "/hello" );
209
214
Assertions .assertEquals (1 , spans .size ());
210
215
211
216
final Map <String , Object > serverSpanClientSide = spans .get (0 );
@@ -242,16 +247,16 @@ public void shouldConvertParamFirstToOneUsingCustomConverter() {
242
247
.body (equalTo ("1" ));
243
248
}
244
249
245
- private List <Map <String , Object >> getServerSpans (final String spanName , final String httpTarget ) {
250
+ private List <Map <String , Object >> getServerSpansFromPath (final String spanName , final String urlPath ) {
246
251
return get ("/export" ).body ().as (new TypeRef <List <Map <String , Object >>>() {
247
252
}).stream ()
248
253
.filter (stringObjectMap -> spanName .equals (stringObjectMap .get ("name" )) &&
249
254
"SERVER" .equals (stringObjectMap .get ("kind" )) &&
250
- ((String ) stringObjectMap .get ("attr_url.path" )).startsWith (httpTarget ))
255
+ ((String ) stringObjectMap .get ("attr_url.path" )).startsWith (urlPath ))
251
256
.collect (Collectors .toList ());
252
257
}
253
258
254
- private List <Map <String , Object >> getClientSpans (final String spanName , final String httpUrl ) {
259
+ private List <Map <String , Object >> getClientSpansFromFullUrl (final String spanName , final String httpUrl ) {
255
260
return get ("/export" ).body ().as (new TypeRef <List <Map <String , Object >>>() {
256
261
}).stream ()
257
262
.filter (stringObjectMap -> spanName .equals (stringObjectMap .get ("name" )) &&
0 commit comments