|
20 | 20 | import io.micrometer.core.instrument.Clock;
|
21 | 21 | import io.micrometer.wavefront.WavefrontConfig;
|
22 | 22 | import io.micrometer.wavefront.WavefrontMeterRegistry;
|
23 |
| -import org.junit.jupiter.api.Disabled; |
24 | 23 | import org.junit.jupiter.api.Test;
|
25 | 24 |
|
26 | 25 | import org.springframework.boot.autoconfigure.AutoConfigurations;
|
|
36 | 35 | * Tests for {@link WavefrontMetricsExportAutoConfiguration}.
|
37 | 36 | *
|
38 | 37 | * @author Jon Schneider
|
| 38 | + * @author Stephane Nicoll |
39 | 39 | */
|
40 | 40 | class WavefrontMetricsExportAutoConfigurationTests {
|
41 | 41 |
|
@@ -70,23 +70,36 @@ void allowsConfigToBeCustomized() {
|
70 | 70 | .hasSingleBean(WavefrontSender.class).hasBean("customConfig"));
|
71 | 71 | }
|
72 | 72 |
|
| 73 | + @Test |
| 74 | + void defaultWavefrontSenderSettingsAreConsistent() { |
| 75 | + this.contextRunner.withUserConfiguration(BaseConfiguration.class) |
| 76 | + .withPropertyValues("management.metrics.export.wavefront.api-token=abcde").run((context) -> { |
| 77 | + WavefrontProperties properties = new WavefrontProperties(); |
| 78 | + WavefrontSender sender = context.getBean(WavefrontSender.class); |
| 79 | + assertThat(sender).extracting("metricsBuffer").hasFieldOrPropertyWithValue("capacity", |
| 80 | + properties.getSender().getMaxQueueSize()); |
| 81 | + assertThat(sender).hasFieldOrPropertyWithValue("batchSize", properties.getBatchSize()); |
| 82 | + assertThat(sender).hasFieldOrPropertyWithValue("messageSizeBytes", |
| 83 | + (int) properties.getSender().getMessageSize().toBytes()); |
| 84 | + }); |
| 85 | + } |
| 86 | + |
73 | 87 | @Test
|
74 | 88 | void configureWavefrontSender() {
|
75 | 89 | this.contextRunner.withUserConfiguration(BaseConfiguration.class)
|
76 | 90 | .withPropertyValues("management.metrics.export.wavefront.api-token=abcde",
|
| 91 | + "management.metrics.export.wavefront.batch-size=50", |
77 | 92 | "management.metrics.export.wavefront.sender.max-queue-size=100",
|
78 |
| - "management.metrics.export.wavefront.sender.batch-size=200", |
79 | 93 | "management.metrics.export.wavefront.sender.message-size=1KB")
|
80 | 94 | .run((context) -> {
|
81 | 95 | WavefrontSender sender = context.getBean(WavefrontSender.class);
|
| 96 | + assertThat(sender).hasFieldOrPropertyWithValue("batchSize", 50); |
82 | 97 | assertThat(sender).extracting("metricsBuffer").hasFieldOrPropertyWithValue("capacity", 100);
|
83 |
| - assertThat(sender).hasFieldOrPropertyWithValue("batchSize", 200); |
84 | 98 | assertThat(sender).hasFieldOrPropertyWithValue("messageSizeBytes", 1024);
|
85 | 99 | });
|
86 | 100 | }
|
87 | 101 |
|
88 | 102 | @Test
|
89 |
| - @Disabled("see https://github.com/micrometer-metrics/micrometer/issues/1964") |
90 | 103 | void allowsWavefrontSenderToBeCustomized() {
|
91 | 104 | this.contextRunner.withUserConfiguration(CustomSenderConfiguration.class)
|
92 | 105 | .run((context) -> assertThat(context).hasSingleBean(Clock.class)
|
|
0 commit comments