Skip to content

Commit 7a7dbb2

Browse files
author
Cyril de Catheu
committed
improve e2e tests
1 parent e955cde commit 7a7dbb2

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

thirdeye-integration-tests/src/test/java/ai/startree/thirdeye/SchedulerQuotaTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public class SchedulerQuotaTest {
8585
public void beforeClass() throws Exception {
8686
// ensure time is controlled via the TimeProvider CLOCK - ie weaving is working correctly
8787
assertThat(CLOCK.isTimeMockWorking()).isTrue();
88+
// mock time before the support is created to mock time in the ScheduledExecutors
89+
CLOCK.useMockTime(new DateTime(2025, 1, 1, 0, 0, 1, DateTimeZone.UTC).getMillis());
8890

8991
support.setup();
9092
pinotDataSourceApi = support.getPinotDataSourceApi();
@@ -132,7 +134,7 @@ public void testVerifyTaskQuotas() {
132134

133135
@Test(dependsOnMethods = "testVerifyTaskQuotas")
134136
public void testTaskIsCreated() {
135-
CLOCK.useMockTime(new DateTime(2025, 1, 1, 0, 0, 1, DateTimeZone.UTC).getMillis());
137+
// current time is 2025/1/1 00:00:01
136138
// create alert that schedules every 10 seconds
137139
final Response response = client.request("api/alerts")
138140
.post(Entity.json(List.of(ALERT_API)));

thirdeye-integration-tests/src/test/java/ai/startree/thirdeye/SchedulingTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public class SchedulingTest {
9999
public void beforeClass() throws Exception {
100100
// ensure time is controlled via the TimeProvider CLOCK - ie weaving is working correctly
101101
assertThat(CLOCK.isTimeMockWorking()).isTrue();
102+
// mock time before support creation to mock time in ScheduledExecutors
103+
CLOCK.useMockTime(MARCH_24_2020_15H33);
102104

103105
support.setup();
104106
pinotDataSourceApi = support.getPinotDataSourceApi();
@@ -134,8 +136,7 @@ public void setUpData() {
134136

135137
@Test(dependsOnMethods = "setUpData")
136138
public void testCreateAlertLastTimestamp() {
137-
// fix clock : time is now controlled manually
138-
CLOCK.useMockTime(MARCH_24_2020_15H33);
139+
// current time is MARCH_24_2020_15H33
139140

140141
final Response createResponse = client.request("api/alerts")
141142
.post(Entity.json(List.of(ALERT_API)));

thirdeye-integration-tests/src/test/resources/anomalyresolution/config/server.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ scheduler:
7676
detectionPipeline: true
7777
detectionAlert: true
7878

79-
# disable task clean up by making the interval big - FIXME CYRIL introduce special value 0 instead
79+
# disable task clean up
8080
taskCleanUp:
81-
intervalInMinutes: 2147483647
81+
intervalInMinutes: 0
8282

8383
ui:
8484
externalUrl: http://localhost:7004

thirdeye-integration-tests/src/test/resources/scheduling/config/server.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,8 @@ scheduler:
7474

7575
detectionPipeline: true
7676
detectionAlert: true
77+
78+
# disable task clean up
79+
taskCleanUp:
80+
intervalInMinutes: 0
7781

thirdeye-integration-tests/src/test/resources/schedulingquota/config/server.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ scheduler:
7575

7676
detectionPipeline: true
7777
detectionAlert: true
78-
79-
namespaceQuotaCacheDurationSeconds: 0
78+
79+
# disable task clean up
80+
taskCleanUp:
81+
intervalInMinutes: 0
8082

8183
defaultWorkspaceConfiguration:
8284
timeConfiguration:

0 commit comments

Comments
 (0)