Zipkin sender type is case insensitive; fixes gh-843
This commit is contained in:
@@ -29,7 +29,7 @@ class ZipkinSenderCondition extends SpringBootCondition {
|
||||
|
||||
String senderType = getType(((AnnotationMetadata) md).getClassName());
|
||||
String value = resolver.getProperty("type");
|
||||
if (value.equals(senderType)) {
|
||||
if (value.equalsIgnoreCase(senderType)) {
|
||||
return ConditionOutcome.match(message.because(value + " sender type"));
|
||||
}
|
||||
return ConditionOutcome.noMatch(message.because(value + " sender type"));
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.junit.rules.ExpectedException;
|
||||
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.sleuth.Span;
|
||||
import org.springframework.cloud.sleuth.SpanReporter;
|
||||
@@ -154,6 +153,26 @@ public class ZipkinAutoConfigurationTests {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canOverrideBySenderAndIsCaseInsensitive() throws Exception {
|
||||
context = new AnnotationConfigApplicationContext();
|
||||
addEnvironment(context, "spring.zipkin.sender.type:WEB");
|
||||
context.register(
|
||||
PropertyPlaceholderAutoConfiguration.class,
|
||||
TraceMetricsAutoConfiguration.class,
|
||||
RabbitAutoConfiguration.class,
|
||||
KafkaAutoConfiguration.class,
|
||||
ZipkinAutoConfiguration.class);
|
||||
context.refresh();
|
||||
|
||||
SpanReporter spanReporter = context.getBean(SpanReporter.class);
|
||||
assertThat(spanReporter).extracting("reporter.sender").allSatisfy(
|
||||
s -> assertThat(s.getClass().getSimpleName()).isEqualTo("RestTemplateSender")
|
||||
);
|
||||
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rabbitWinsWhenKafkaPresent() throws Exception {
|
||||
context = new AnnotationConfigApplicationContext();
|
||||
|
||||
Reference in New Issue
Block a user