@@ -119,16 +119,19 @@ void testConnectException() {
119119
120120 @ Test
121121 void testSetCommand () {
122- String res = syncCommands .set ("TESTSETKEY" , "TESTSETVAL" );
122+ String res =
123+ testing ().runWithSpan ("parent" , () -> syncCommands .set ("TESTSETKEY" , "TESTSETVAL" ));
123124 assertThat (res ).isEqualTo ("OK" );
124125
125126 testing ()
126127 .waitAndAssertTraces (
127128 trace ->
128129 trace .hasSpansSatisfyingExactly (
130+ span -> span .hasName ("parent" ).hasKind (SpanKind .INTERNAL ).hasNoParent (),
129131 span ->
130132 span .hasName ("SET" )
131133 .hasKind (SpanKind .CLIENT )
134+ .hasParent (trace .getSpan (0 ))
132135 .hasAttributesSatisfyingExactly (
133136 addExtraAttributes (
134137 equalTo (NETWORK_TYPE , "ipv4" ),
@@ -161,16 +164,18 @@ private static AttributeKey[] toArray(List<AttributeKey<?>> expected) {
161164
162165 @ Test
163166 void testGetCommand () {
164- String res = syncCommands .get ("TESTKEY" );
167+ String res = testing (). runWithSpan ( "parent" , () -> syncCommands .get ("TESTKEY" ) );
165168 assertThat (res ).isEqualTo ("TESTVAL" );
166169
167170 testing ()
168171 .waitAndAssertTraces (
169172 trace ->
170173 trace .hasSpansSatisfyingExactly (
174+ span -> span .hasName ("parent" ).hasKind (SpanKind .INTERNAL ).hasNoParent (),
171175 span ->
172176 span .hasName ("GET" )
173177 .hasKind (SpanKind .CLIENT )
178+ .hasParent (trace .getSpan (0 ))
174179 .hasAttributesSatisfyingExactly (
175180 addExtraAttributes (
176181 equalTo (NETWORK_TYPE , "ipv4" ),
@@ -185,16 +190,18 @@ void testGetCommand() {
185190
186191 @ Test
187192 void testGetNonExistentKeyCommand () {
188- String res = syncCommands .get ("NON_EXISTENT_KEY" );
193+ String res = testing (). runWithSpan ( "parent" , () -> syncCommands .get ("NON_EXISTENT_KEY" ) );
189194 assertThat (res ).isNull ();
190195
191196 testing ()
192197 .waitAndAssertTraces (
193198 trace ->
194199 trace .hasSpansSatisfyingExactly (
200+ span -> span .hasName ("parent" ).hasKind (SpanKind .INTERNAL ).hasNoParent (),
195201 span ->
196202 span .hasName ("GET" )
197203 .hasKind (SpanKind .CLIENT )
204+ .hasParent (trace .getSpan (0 ))
198205 .hasAttributesSatisfyingExactly (
199206 addExtraAttributes (
200207 equalTo (NETWORK_TYPE , "ipv4" ),
@@ -209,16 +216,18 @@ void testGetNonExistentKeyCommand() {
209216
210217 @ Test
211218 void testCommandWithNoArguments () {
212- String res = syncCommands .randomkey ();
219+ String res = testing (). runWithSpan ( "parent" , () -> syncCommands .randomkey () );
213220 assertThat (res ).isNotNull ();
214221
215222 testing ()
216223 .waitAndAssertTraces (
217224 trace ->
218225 trace .hasSpansSatisfyingExactly (
226+ span -> span .hasName ("parent" ).hasKind (SpanKind .INTERNAL ).hasNoParent (),
219227 span ->
220228 span .hasName ("RANDOMKEY" )
221229 .hasKind (SpanKind .CLIENT )
230+ .hasParent (trace .getSpan (0 ))
222231 .hasAttributesSatisfyingExactly (
223232 addExtraAttributes (
224233 equalTo (NETWORK_TYPE , "ipv4" ),
@@ -243,16 +252,19 @@ void testListCommand() {
243252 testing ().clearData ();
244253 }
245254
246- long res = commands .lpush ("TESTLIST" , "TESTLIST ELEMENT" );
255+ long res =
256+ testing ().runWithSpan ("parent" , () -> commands .lpush ("TESTLIST" , "TESTLIST ELEMENT" ));
247257 assertThat (res ).isEqualTo (1 );
248258
249259 testing ()
250260 .waitAndAssertTraces (
251261 trace ->
252262 trace .hasSpansSatisfyingExactly (
263+ span -> span .hasName ("parent" ).hasKind (SpanKind .INTERNAL ).hasNoParent (),
253264 span ->
254265 span .hasName ("LPUSH" )
255266 .hasKind (SpanKind .CLIENT )
267+ .hasParent (trace .getSpan (0 ))
256268 .hasAttributesSatisfyingExactly (
257269 addExtraAttributes (
258270 equalTo (NETWORK_TYPE , "ipv4" ),
@@ -267,16 +279,18 @@ void testListCommand() {
267279
268280 @ Test
269281 void testHashSetCommand () {
270- String res = syncCommands .hmset ("user" , testHashMap );
282+ String res = testing (). runWithSpan ( "parent" , () -> syncCommands .hmset ("user" , testHashMap ) );
271283 assertThat (res ).isEqualTo ("OK" );
272284
273285 testing ()
274286 .waitAndAssertTraces (
275287 trace ->
276288 trace .hasSpansSatisfyingExactly (
289+ span -> span .hasName ("parent" ).hasKind (SpanKind .INTERNAL ).hasNoParent (),
277290 span ->
278291 span .hasName ("HMSET" )
279292 .hasKind (SpanKind .CLIENT )
293+ .hasParent (trace .getSpan (0 ))
280294 .hasAttributesSatisfyingExactly (
281295 addExtraAttributes (
282296 equalTo (NETWORK_TYPE , "ipv4" ),
@@ -293,16 +307,18 @@ void testHashSetCommand() {
293307
294308 @ Test
295309 void testHashGetallCommand () {
296- Map <String , String > res = syncCommands .hgetall ("TESTHM" );
310+ Map <String , String > res = testing (). runWithSpan ( "parent" , () -> syncCommands .hgetall ("TESTHM" ) );
297311 assertThat (res ).isEqualTo (testHashMap );
298312
299313 testing ()
300314 .waitAndAssertTraces (
301315 trace ->
302316 trace .hasSpansSatisfyingExactly (
317+ span -> span .hasName ("parent" ).hasKind (SpanKind .INTERNAL ).hasNoParent (),
303318 span ->
304319 span .hasName ("HGETALL" )
305320 .hasKind (SpanKind .CLIENT )
321+ .hasParent (trace .getSpan (0 ))
306322 .hasAttributesSatisfyingExactly (
307323 addExtraAttributes (
308324 equalTo (NETWORK_TYPE , "ipv4" ),
@@ -321,8 +337,12 @@ void testEvalCommand() {
321337 "redis.call('lpush', KEYS[1], ARGV[1], ARGV[2]); return redis.call('llen', KEYS[1])" ;
322338
323339 Long result =
324- syncCommands .eval (
325- script , ScriptOutputType .INTEGER , new String [] {"TESTLIST" }, "abc" , "def" );
340+ testing ()
341+ .runWithSpan (
342+ "parent" ,
343+ () ->
344+ syncCommands .eval (
345+ script , ScriptOutputType .INTEGER , new String [] {"TESTLIST" }, "abc" , "def" ));
326346 assertThat (result ).isEqualTo (2 );
327347
328348 String b64Script = Base64 .getEncoder ().encodeToString (script .getBytes (UTF_8 ));
@@ -331,9 +351,11 @@ void testEvalCommand() {
331351 .waitAndAssertTraces (
332352 trace ->
333353 trace .hasSpansSatisfyingExactly (
354+ span -> span .hasName ("parent" ).hasKind (SpanKind .INTERNAL ).hasNoParent (),
334355 span ->
335356 span .hasName ("EVAL" )
336357 .hasKind (SpanKind .CLIENT )
358+ .hasParent (trace .getSpan (0 ))
337359 .hasAttributesSatisfyingExactly (
338360 addExtraAttributes (
339361 equalTo (NETWORK_TYPE , "ipv4" ),
0 commit comments