Skip to content

Commit

Permalink
Development: Improve server test cleanup to reduce flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
krusche committed Dec 7, 2024
1 parent eb3b2a3 commit 8504af9
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import de.tum.cit.aet.artemis.communication.service.conversation.ConversationService;
import de.tum.cit.aet.artemis.communication.test_repository.ConversationParticipantTestRepository;
import de.tum.cit.aet.artemis.communication.test_repository.ConversationTestRepository;
import de.tum.cit.aet.artemis.communication.test_repository.OneToOneChatTestRepository;
import de.tum.cit.aet.artemis.core.domain.Course;
import de.tum.cit.aet.artemis.core.domain.CourseInformationSharingConfiguration;
import de.tum.cit.aet.artemis.core.domain.User;
Expand Down Expand Up @@ -65,9 +64,6 @@ abstract class AbstractConversationTest extends AbstractSpringIntegrationIndepen
@Autowired
GroupChatRepository groupChatRepository;

@Autowired
OneToOneChatTestRepository oneToOneChatRepository;

@Autowired
ConversationMessageRepository conversationMessageRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Set;
import java.util.stream.Collectors;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
Expand Down Expand Up @@ -47,10 +48,10 @@ class ChannelIntegrationTest extends AbstractConversationTest {
private static final String TEST_PREFIX = "chtest";

@Autowired
TutorialGroupTestRepository tutorialGroupRepository;
private TutorialGroupTestRepository tutorialGroupRepository;

@Autowired
TutorialGroupChannelManagementService tutorialGroupChannelManagementService;
private TutorialGroupChannelManagementService tutorialGroupChannelManagementService;

@Autowired
private TutorialGroupUtilService tutorialGroupUtilService;
Expand Down Expand Up @@ -89,6 +90,13 @@ void setupTestScenario() throws Exception {
}
}

@AfterEach
void tearDown() {
tutorialGroupRepository.deleteAll();
conversationMessageRepository.deleteAll();
conversationRepository.deleteAllByCourseId(exampleCourseId);
}

@Override
String getTestPrefix() {
return TEST_PREFIX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void setupTestScenario() throws Exception {
@AfterEach
void tearDown() {
conversationMessageRepository.deleteAll();
conversationRepository.deleteAll();
conversationRepository.deleteAllByCourseId(exampleCourseId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.connectors;
package de.tum.cit.aet.artemis.lti;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.connectors;
package de.tum.cit.aet.artemis.lti;

import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.Mockito.any;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.connectors;
package de.tum.cit.aet.artemis.lti;

import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.connectors;
package de.tum.cit.aet.artemis.lti;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.modeling;
package de.tum.cit.aet.artemis.modeling.apollon;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.connectors;
package de.tum.cit.aet.artemis.modeling.apollon;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.modeling;
package de.tum.cit.aet.artemis.modeling.apollon;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.connectors;
package de.tum.cit.aet.artemis.modeling.apollon;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.connectors;
package de.tum.cit.aet.artemis.programming.aelous;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.connectors;
package de.tum.cit.aet.artemis.programming.aelous;

import static de.tum.cit.aet.artemis.core.config.Constants.ASSIGNMENT_REPO_NAME;
import static de.tum.cit.aet.artemis.core.config.Constants.SOLUTION_REPO_NAME;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.connectors;
package de.tum.cit.aet.artemis.programming.aelous;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.connectors;
package de.tum.cit.aet.artemis.programming.aelous;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down

0 comments on commit 8504af9

Please sign in to comment.