fix: reject removed telemetry fields switch
This commit is contained in:
@@ -49,6 +49,13 @@ import java.nio.file.Path;
|
|||||||
@ConditionalOnProperty(prefix = "lingniu.ingest.event-history", name = "enabled", havingValue = "true")
|
@ConditionalOnProperty(prefix = "lingniu.ingest.event-history", name = "enabled", havingValue = "true")
|
||||||
public class EventHistoryAutoConfiguration {
|
public class EventHistoryAutoConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnProperty(prefix = "lingniu.ingest.tdengine-history", name = "telemetry-fields-enabled")
|
||||||
|
public Object rejectedRemovedTelemetryFieldsSwitch() {
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"tdengine-history.telemetry-fields-enabled has been removed; history stores raw_frames and location rows only");
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnBean(TdengineHistoryWriter.class)
|
@ConditionalOnBean(TdengineHistoryWriter.class)
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
|
|||||||
@@ -143,13 +143,17 @@ class EventHistoryAutoConfigurationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void doesNotExposeTelemetryFieldHistoryControllerWhenTelemetryFieldsAreEnabled() {
|
void rejectsRemovedTelemetryFieldsSwitch() {
|
||||||
contextRunner
|
contextRunner
|
||||||
.withPropertyValues(
|
.withPropertyValues(
|
||||||
"lingniu.ingest.event-history.enabled=true",
|
"lingniu.ingest.event-history.enabled=true",
|
||||||
"lingniu.ingest.tdengine-history.telemetry-fields-enabled=true")
|
"lingniu.ingest.tdengine-history.telemetry-fields-enabled=true")
|
||||||
.withBean(TdengineHistoryReader.class, () -> mock(TdengineHistoryReader.class))
|
.withBean(TdengineHistoryReader.class, () -> mock(TdengineHistoryReader.class))
|
||||||
.run(context -> assertThat(context).doesNotHaveBean("telemetryFieldHistoryController"));
|
.run(context -> assertThat(context)
|
||||||
|
.hasFailed()
|
||||||
|
.getFailure()
|
||||||
|
.hasMessageContaining("tdengine-history.telemetry-fields-enabled has been removed")
|
||||||
|
.hasMessageContaining("raw_frames"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user