-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Labels
theme: observabilityIssues related to observabilityIssues related to observabilitytype: bugA general bugA general bug
Milestone
Description
This application
@SpringBootApplication
public class TracertestApplication {
public static void main(String[] args) {
SpringApplication.run(TracertestApplication.class, args);
}
@Bean
CommandLineRunner clr(Tracer tracer) {
return (args) -> System.out.println(tracer);
}
}with this test
@SpringBootTest
class TracertestApplicationTests {
@Test
void contextLoads() {
}
}fails:
Parameter 0 of method clr in com.example.tracertest.TracertestApplication required a bean of type 'io.micrometer.tracing.Tracer' that could not be found.
We disable tracing in tests, which means there is no Tracer bean available. We disable metrics too, but we provide a SimpleMeterRegistry for the MeterRegistry.
Marcin has added a NOOP tracer which we should use as a Tracer in tests when tracing is not enabled. With this change, the test works again.
Metadata
Metadata
Assignees
Labels
theme: observabilityIssues related to observabilityIssues related to observabilitytype: bugA general bugA general bug