|
|
|
|
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
@@ -114,9 +115,9 @@ class DirtyStateCalculatorTest {
|
|
|
|
|
DirtyStateCalculator calc = CALC;
|
|
|
|
|
|
|
|
|
|
ApplicationConfig deployed = new ApplicationConfig();
|
|
|
|
|
deployed.setTracedProcessors(Map.of("proc-1", "DEBUG"));
|
|
|
|
|
deployed.setSensitiveKeys(List.of("password", "token"));
|
|
|
|
|
ApplicationConfig desired = new ApplicationConfig();
|
|
|
|
|
desired.setTracedProcessors(Map.of("proc-1", "TRACE"));
|
|
|
|
|
desired.setSensitiveKeys(List.of("password", "token", "secret"));
|
|
|
|
|
UUID jarId = UUID.randomUUID();
|
|
|
|
|
DeploymentConfigSnapshot snap = new DeploymentConfigSnapshot(jarId, deployed, Map.of(), null);
|
|
|
|
|
|
|
|
|
|
@@ -124,7 +125,29 @@ class DirtyStateCalculatorTest {
|
|
|
|
|
|
|
|
|
|
assertThat(result.dirty()).isTrue();
|
|
|
|
|
assertThat(result.differences()).extracting(DirtyStateResult.Difference::field)
|
|
|
|
|
.contains("agentConfig.tracedProcessors.proc-1");
|
|
|
|
|
.anyMatch(f -> f.startsWith("agentConfig.sensitiveKeys"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void livePushedFields_doNotMarkDirty() {
|
|
|
|
|
// Taps, tracedProcessors, and routeRecording apply via live SSE push (never redeploy),
|
|
|
|
|
// so they must not appear as "pending deploy" when they differ from the last deploy snapshot.
|
|
|
|
|
ApplicationConfig deployed = new ApplicationConfig();
|
|
|
|
|
deployed.setTracedProcessors(Map.of("proc-1", "DEBUG"));
|
|
|
|
|
deployed.setRouteRecording(Map.of("route-a", true));
|
|
|
|
|
deployed.setTapVersion(1);
|
|
|
|
|
|
|
|
|
|
ApplicationConfig desired = new ApplicationConfig();
|
|
|
|
|
desired.setTracedProcessors(Map.of("proc-1", "TRACE", "proc-2", "DEBUG"));
|
|
|
|
|
desired.setRouteRecording(Map.of("route-a", false, "route-b", true));
|
|
|
|
|
desired.setTapVersion(5);
|
|
|
|
|
|
|
|
|
|
UUID jarId = UUID.randomUUID();
|
|
|
|
|
DeploymentConfigSnapshot snap = new DeploymentConfigSnapshot(jarId, deployed, Map.of(), null);
|
|
|
|
|
DirtyStateResult result = CALC.compute(jarId, desired, Map.of(), snap);
|
|
|
|
|
|
|
|
|
|
assertThat(result.dirty()).isFalse();
|
|
|
|
|
assertThat(result.differences()).isEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|