Fix TracingSegmentRunner (testing only) (#688)

This commit is contained in:
jiangyuan 2024-05-12 11:37:55 +08:00 committed by GitHub
parent 7dd7914765
commit 0bf535e861
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View File

@ -55,7 +55,7 @@ public class TracingSegmentRunner extends BlockJUnit4ClassRunner {
@Override
protected Statement withAfters(FrameworkMethod method, Object target, final Statement statement) {
return new Statement() {
Statement st = new Statement() {
@Override
public void evaluate() throws Throwable {
if (field != null) {
@ -89,5 +89,7 @@ public class TracingSegmentRunner extends BlockJUnit4ClassRunner {
}
}
};
return super.withAfters(method, target, st);
}
}

View File

@ -55,7 +55,7 @@ public class TracingSegmentRunner extends BlockJUnit4ClassRunner {
@Override
protected Statement withAfters(FrameworkMethod method, Object target, final Statement statement) {
return new Statement() {
Statement st = new Statement() {
@Override
public void evaluate() throws Throwable {
if (field != null) {
@ -89,5 +89,7 @@ public class TracingSegmentRunner extends BlockJUnit4ClassRunner {
}
}
};
return super.withAfters(method, target, st);
}
}

View File

@ -92,8 +92,6 @@ public class MicrometerContextSnapshotThreadLocalAccessorInterceptorTest {
@AfterClass
public static void clearAfterAll() {
// test from threadlocalaccessor test x 2 TODO: I have no idea what is going on
ContextManager.stopSpan();
ContextManager.stopSpan();
assertThat(ContextManager.isActive(), is(false));
}
@ -103,6 +101,7 @@ public class MicrometerContextSnapshotThreadLocalAccessorInterceptorTest {
PluginBootService.class);
Assert.assertNotNull(service);
ContextManager.stopSpan();
}
@Test
@ -110,6 +109,7 @@ public class MicrometerContextSnapshotThreadLocalAccessorInterceptorTest {
ContextManagerExtendService service = ServiceManager.INSTANCE.findService(ContextManagerExtendService.class);
Assert.assertTrue(service instanceof ContextManagerExtendOverrideService);
ContextManager.stopSpan();
}
@Test