Skip to content

Commit

Permalink
Fix AnomalyDetectorRestApiIT.testUpdateAnomalyDetectorNameToNew test …
Browse files Browse the repository at this point in the history
…logic

Previously, the test checked if the new detector and the parsed new detector had different last update times. This was not the intended behavior. The correct check should be between the old and new detector's last update time. This discrepancy was mostly masked by serialization and deserialization differences, but surfaced in JDK 8 on Windows where the timestamps matched.

Changes:
- Updated test to compare old vs. new detector's last update time.

Testing:
- Ran `gradle build`.

Signed-off-by: Kaituo Li <[email protected]>
  • Loading branch information
kaituo committed Sep 13, 2023
1 parent ee741d5 commit 76a6db7
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,7 @@ public void testUpdateAnomalyDetectorNameToNew() throws Exception {
AnomalyDetector resultDetector = getAnomalyDetector(detectorWithNewName.getDetectorId(), client());
assertEquals("Detector name updating failed", detectorWithNewName.getName(), resultDetector.getName());
assertEquals("Updated anomaly detector id doesn't match", detectorWithNewName.getDetectorId(), resultDetector.getDetectorId());
assertNotEquals(
"Anomaly detector last update time not changed",
detectorWithNewName.getLastUpdateTime(),
resultDetector.getLastUpdateTime()
);
assertNotEquals("Anomaly detector last update time not changed", detector.getLastUpdateTime(), resultDetector.getLastUpdateTime());
}

public void testUpdateAnomalyDetectorWithNotExistingIndex() throws Exception {
Expand Down

0 comments on commit 76a6db7

Please sign in to comment.