Skip to content

Commit

Permalink
Development: Fix flaky ParticipantScoreIntegrationTest (#7321)
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikRemo authored Oct 7, 2023
1 parent 17b1f6b commit f8658f6
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;

import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.Optional;
import java.util.Set;

import org.junit.jupiter.api.AfterEach;
Expand All @@ -13,6 +15,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.util.ReflectionTestUtils;

import de.tum.in.www1.artemis.AbstractSpringIntegrationLocalCILocalVCTest;
import de.tum.in.www1.artemis.competency.CompetencyUtilService;
Expand Down Expand Up @@ -97,7 +100,10 @@ class ParticipantScoreIntegrationTest extends AbstractSpringIntegrationLocalCILo

@BeforeEach
void setupTestScenario() {
ParticipantScoreScheduleService.DEFAULT_WAITING_TIME_FOR_SCHEDULED_TASKS = 50;
// Prevents the ParticipantScoreScheduleService from scheduling tasks related to prior results
ReflectionTestUtils.setField(participantScoreScheduleService, "lastScheduledRun", Optional.of(Instant.now()));

ParticipantScoreScheduleService.DEFAULT_WAITING_TIME_FOR_SCHEDULED_TASKS = 200;
participantScoreScheduleService.activate();
ZonedDateTime pastTimestamp = ZonedDateTime.now().minusDays(5);
// creating the users student1, tutor1 and instructors1
Expand Down

0 comments on commit f8658f6

Please sign in to comment.