Correction du worflow release : on ne fait plus les tests (évite le doublons de test avec le ci.yml).
Some checks failed
Tests unitaires / Brain (Python · pytest + couverture) (push) Successful in 21s
Tests unitaires / Web (Angular · vitest + couverture) (push) Successful in 30s
Tests unitaires / Core (Java · mvn test + JaCoCo) (push) Successful in 2m22s
Build & Push Images / build (brain) (push) Successful in 1m16s
E2E Tests / e2e (push) Failing after 5m24s
Build & Push Images / build (core) (push) Successful in 3m5s
Build & Push Images / build-switcher (push) Successful in 50s
Build & Push Images / build (web) (push) Successful in 1m56s
Some checks failed
Tests unitaires / Brain (Python · pytest + couverture) (push) Successful in 21s
Tests unitaires / Web (Angular · vitest + couverture) (push) Successful in 30s
Tests unitaires / Core (Java · mvn test + JaCoCo) (push) Successful in 2m22s
Build & Push Images / build (brain) (push) Successful in 1m16s
E2E Tests / e2e (push) Failing after 5m24s
Build & Push Images / build (core) (push) Successful in 3m5s
Build & Push Images / build-switcher (push) Successful in 50s
Build & Push Images / build (web) (push) Successful in 1m56s
Correction de tests coté java + config Suppression de classes inutilisées coté Angular
This commit is contained in:
41
core/pom.xml
41
core/pom.xml
@@ -14,7 +14,7 @@
|
||||
|
||||
<groupId>com.loremind</groupId>
|
||||
<artifactId>loremind-core</artifactId>
|
||||
<version>0.16.2</version>
|
||||
<version>0.16.3</version>
|
||||
<name>LoreMind Core</name>
|
||||
<description>Backend Core - Architecture Hexagonale</description>
|
||||
|
||||
@@ -152,6 +152,45 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Declare EXPLICITEMENT le processor d'annotations Lombok : sinon javac
|
||||
avertit que l'annotation processing implicite (processeur trouve sur le
|
||||
classpath sans etre declare) sera desactivee dans un futur JDK. -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Expose le chemin du jar mockito-core dans la propriete
|
||||
${org.mockito:mockito-core:jar}, consommee par surefire ci-dessous. -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>properties</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Charge Mockito comme un VRAI -javaagent (au lieu de l'auto-attachement
|
||||
dynamique de byte-buddy, qui imprime un avertissement et sera interdit
|
||||
dans un futur JDK). `@{argLine}` preserve l'argLine pose par JaCoCo. -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>@{argLine} -javaagent:${org.mockito:mockito-core:jar} -Xshare:off</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
|
||||
@@ -225,7 +225,7 @@ public class BrainRulesImportClient implements RulesPdfImporter {
|
||||
private Map<String, String> toStringMap(JsonNode object) {
|
||||
Map<String, String> out = new LinkedHashMap<>();
|
||||
if (object != null && object.isObject()) {
|
||||
object.fields().forEachRemaining(e -> out.put(e.getKey(), e.getValue().asText()));
|
||||
object.properties().forEach(e -> out.put(e.getKey(), e.getValue().asText()));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ public class RestTemplateConfig {
|
||||
@Value("${brain.timeout-seconds}") long timeoutSeconds,
|
||||
@Value("${brain.internal-secret}") String internalSecret) {
|
||||
return builder
|
||||
.setConnectTimeout(Duration.ofSeconds(10))
|
||||
.setReadTimeout(Duration.ofSeconds(timeoutSeconds))
|
||||
.connectTimeout(Duration.ofSeconds(10))
|
||||
.readTimeout(Duration.ofSeconds(timeoutSeconds))
|
||||
.additionalInterceptors((request, body, execution) -> {
|
||||
if (internalSecret != null && !internalSecret.isBlank()) {
|
||||
request.getHeaders().set(INTERNAL_SECRET_HEADER, internalSecret);
|
||||
@@ -61,8 +61,8 @@ public class RestTemplateConfig {
|
||||
@Value("${brain.import-timeout-seconds:600}") long importTimeoutSeconds,
|
||||
@Value("${brain.internal-secret}") String internalSecret) {
|
||||
return builder
|
||||
.setConnectTimeout(Duration.ofSeconds(10))
|
||||
.setReadTimeout(Duration.ofSeconds(importTimeoutSeconds))
|
||||
.connectTimeout(Duration.ofSeconds(10))
|
||||
.readTimeout(Duration.ofSeconds(importTimeoutSeconds))
|
||||
.additionalInterceptors((request, body, execution) -> {
|
||||
if (internalSecret != null && !internalSecret.isBlank()) {
|
||||
request.getHeaders().set(INTERNAL_SECRET_HEADER, internalSecret);
|
||||
|
||||
@@ -50,8 +50,8 @@ public class DesktopUpdateService {
|
||||
@Value("${desktop.update.releases-api-url:https://api.github.com/repos/IGMLcreation/LoreMind/releases/latest}") String releasesApiUrl,
|
||||
@Nullable BuildProperties buildProperties) {
|
||||
this.http = builder
|
||||
.setConnectTimeout(Duration.ofSeconds(5))
|
||||
.setReadTimeout(Duration.ofSeconds(10))
|
||||
.connectTimeout(Duration.ofSeconds(5))
|
||||
.readTimeout(Duration.ofSeconds(10))
|
||||
.build();
|
||||
this.enabled = enabled;
|
||||
this.releasesApiUrl = releasesApiUrl;
|
||||
|
||||
@@ -40,8 +40,8 @@ public class HttpLicenseRelay implements LicenseRelay {
|
||||
RestTemplateBuilder builder,
|
||||
@Value("${licensing.relay.base-url:}") String baseUrl) {
|
||||
this.http = builder
|
||||
.setConnectTimeout(Duration.ofSeconds(5))
|
||||
.setReadTimeout(Duration.ofSeconds(15))
|
||||
.connectTimeout(Duration.ofSeconds(5))
|
||||
.readTimeout(Duration.ofSeconds(15))
|
||||
.build();
|
||||
this.baseUrl = stripTrailingSlash(baseUrl);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.loremind.domain.licensing.RegistryCredentials;
|
||||
import com.loremind.domain.licensing.ports.DockerConfigWriter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -25,6 +26,8 @@ import java.util.Optional;
|
||||
* la plupart du temps.
|
||||
*/
|
||||
@Component
|
||||
// Desactivable (ex: tests) : sans cette propriete (prod), le daemon tourne.
|
||||
@ConditionalOnProperty(name = "licensing.refresh.enabled", matchIfMissing = true)
|
||||
public class LicenseRefreshDaemon {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(LicenseRefreshDaemon.class);
|
||||
|
||||
@@ -4,6 +4,8 @@ import io.minio.BucketExistsArgs;
|
||||
import io.minio.MakeBucketArgs;
|
||||
import io.minio.MinioClient;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -24,6 +26,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ConditionalOnProperty(name = "storage.backend", havingValue = "minio", matchIfMissing = true)
|
||||
public class MinioConfig {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MinioConfig.class);
|
||||
|
||||
@Value("${minio.endpoint}")
|
||||
private String endpoint;
|
||||
|
||||
@@ -66,12 +70,11 @@ public class MinioConfig {
|
||||
boolean exists = client.bucketExists(BucketExistsArgs.builder().bucket(bucket).build());
|
||||
if (!exists) {
|
||||
client.makeBucket(MakeBucketArgs.builder().bucket(bucket).build());
|
||||
System.out.println("[MinIO] Bucket '" + bucket + "' cree.");
|
||||
log.info("[MinIO] Bucket '{}' cree.", bucket);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("[MinIO] Initialisation impossible (endpoint=" + endpoint
|
||||
+ "). Les uploads d'images echoueront tant que MinIO n'est pas joignable. "
|
||||
+ "Cause : " + e.getMessage());
|
||||
log.warn("[MinIO] Initialisation impossible (endpoint={}). Les uploads d'images "
|
||||
+ "echoueront tant que MinIO n'est pas joignable. Cause : {}", endpoint, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,8 +74,8 @@ public class UpdateCheckService {
|
||||
LicenseService licenseService,
|
||||
@Nullable BuildProperties buildProperties) {
|
||||
this.http = builder
|
||||
.setConnectTimeout(Duration.ofSeconds(5))
|
||||
.setReadTimeout(Duration.ofSeconds(15))
|
||||
.connectTimeout(Duration.ofSeconds(5))
|
||||
.readTimeout(Duration.ofSeconds(15))
|
||||
.build();
|
||||
this.registry = normalizeRegistry(registry);
|
||||
this.images = parseImages(imagesCsv);
|
||||
|
||||
@@ -29,6 +29,9 @@ spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
|
||||
spring.jpa.hibernate.ddl-auto=validate
|
||||
spring.jpa.show-sql=true
|
||||
spring.jpa.properties.hibernate.format_sql=true
|
||||
# Fixe explicitement open-in-view (defaut Spring = true) : meme comportement,
|
||||
# mais supprime l'avertissement "spring.jpa.open-in-view is enabled by default".
|
||||
spring.jpa.open-in-view=true
|
||||
|
||||
# ============================================================================
|
||||
# Flyway : migrations de schema versionnees (src/main/resources/db/migration).
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
@@ -53,10 +53,10 @@ class AiChatControllerTest {
|
||||
@Autowired private MockMvc mockMvc;
|
||||
@Autowired private ObjectMapper objectMapper;
|
||||
|
||||
@MockBean private StreamChatForLoreUseCase loreUseCase;
|
||||
@MockBean private StreamChatForCampaignUseCase campaignUseCase;
|
||||
@MockBean private StreamChatForSessionUseCase sessionUseCase;
|
||||
@MockBean(name = "applicationTaskExecutor") private TaskExecutor taskExecutor;
|
||||
@MockitoBean private StreamChatForLoreUseCase loreUseCase;
|
||||
@MockitoBean private StreamChatForCampaignUseCase campaignUseCase;
|
||||
@MockitoBean private StreamChatForSessionUseCase sessionUseCase;
|
||||
@MockitoBean(name = "applicationTaskExecutor") private TaskExecutor taskExecutor;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
@@ -42,8 +42,8 @@ class CampaignAdaptControllerTest {
|
||||
|
||||
@Autowired private MockMvc mockMvc;
|
||||
|
||||
@MockBean private CampaignAdaptService campaignAdaptService;
|
||||
@MockBean(name = "applicationTaskExecutor") private TaskExecutor taskExecutor;
|
||||
@MockitoBean private CampaignAdaptService campaignAdaptService;
|
||||
@MockitoBean(name = "applicationTaskExecutor") private TaskExecutor taskExecutor;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
@@ -58,8 +58,8 @@ class CampaignImportControllerTest {
|
||||
@Autowired private MockMvc mockMvc;
|
||||
@Autowired private ObjectMapper objectMapper;
|
||||
|
||||
@MockBean private CampaignImportService campaignImportService;
|
||||
@MockBean(name = "applicationTaskExecutor") private TaskExecutor taskExecutor;
|
||||
@MockitoBean private CampaignImportService campaignImportService;
|
||||
@MockitoBean(name = "applicationTaskExecutor") private TaskExecutor taskExecutor;
|
||||
|
||||
private static final String CAMPAIGN_ID = "camp-1";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -25,7 +25,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
class ConfigControllerTest {
|
||||
|
||||
@Autowired private MockMvc mockMvc;
|
||||
@MockBean private UpdateCheckService updates;
|
||||
@MockitoBean private UpdateCheckService updates;
|
||||
|
||||
@Test
|
||||
void getPublicConfig_returns200_updateCheckEnabledTrue() throws Exception {
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -41,7 +41,7 @@ class ConversationControllerTest {
|
||||
@Autowired private ObjectMapper objectMapper;
|
||||
@Autowired private ConversationRepository conversationRepository;
|
||||
|
||||
@MockBean private ConversationTitleGenerator titleGenerator;
|
||||
@MockitoBean private ConversationTitleGenerator titleGenerator;
|
||||
|
||||
@Test
|
||||
void create_withLoreAnchor_returns200() throws Exception {
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
@@ -52,8 +52,8 @@ class GameSystemControllerTest {
|
||||
@Autowired private MockMvc mockMvc;
|
||||
@Autowired private ObjectMapper objectMapper;
|
||||
|
||||
@MockBean private RulesPdfImporter rulesPdfImporter;
|
||||
@MockBean(name = "applicationTaskExecutor") private TaskExecutor taskExecutor;
|
||||
@MockitoBean private RulesPdfImporter rulesPdfImporter;
|
||||
@MockitoBean(name = "applicationTaskExecutor") private TaskExecutor taskExecutor;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
@@ -42,7 +42,7 @@ class ImageControllerTest {
|
||||
|
||||
@Autowired private MockMvc mockMvc;
|
||||
|
||||
@MockBean private ImageService imageService;
|
||||
@MockitoBean private ImageService imageService;
|
||||
|
||||
private Image sampleImage() {
|
||||
return Image.builder()
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -49,7 +49,7 @@ class ItemCatalogControllerTest {
|
||||
@Autowired private ItemCatalogRepository catalogRepository;
|
||||
@Autowired private CampaignRepository campaignRepository;
|
||||
|
||||
@MockBean private ItemCatalogGenerator generator;
|
||||
@MockitoBean private ItemCatalogGenerator generator;
|
||||
|
||||
private String campaignId;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
@@ -54,8 +54,8 @@ class LicenseControllerTest {
|
||||
|
||||
@Autowired private MockMvc mockMvc;
|
||||
|
||||
@MockBean private LicenseService licenseService;
|
||||
@MockBean private ChannelSwitcherService channelSwitcher;
|
||||
@MockitoBean private LicenseService licenseService;
|
||||
@MockitoBean private ChannelSwitcherService channelSwitcher;
|
||||
|
||||
private LicenseSnapshot validSnapshot() {
|
||||
return new LicenseSnapshot(
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
@@ -59,9 +59,9 @@ class NotebookControllerTest {
|
||||
@Autowired private NotebookRepository notebookRepository;
|
||||
@Autowired private CampaignRepository campaignRepository;
|
||||
|
||||
@MockBean private NotebookIndexer indexer;
|
||||
@MockBean private NotebookChatStreamer chatStreamer;
|
||||
@MockBean(name = "applicationTaskExecutor") private TaskExecutor taskExecutor;
|
||||
@MockitoBean private NotebookIndexer indexer;
|
||||
@MockitoBean private NotebookChatStreamer chatStreamer;
|
||||
@MockitoBean(name = "applicationTaskExecutor") private TaskExecutor taskExecutor;
|
||||
|
||||
private String campaignId;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -36,7 +36,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
class PageGenerationControllerTest {
|
||||
|
||||
@Autowired private MockMvc mockMvc;
|
||||
@MockBean private GeneratePageValuesUseCase generatePageValuesUseCase;
|
||||
@MockitoBean private GeneratePageValuesUseCase generatePageValuesUseCase;
|
||||
|
||||
@Test
|
||||
void generate_returns200_withSuggestions() throws Exception {
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -50,7 +50,7 @@ class RandomTableControllerTest {
|
||||
@Autowired private RandomTableRepository tableRepository;
|
||||
@Autowired private CampaignRepository campaignRepository;
|
||||
|
||||
@MockBean private RandomTableGenerator generator;
|
||||
@MockitoBean private RandomTableGenerator generator;
|
||||
|
||||
private String campaignId;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
@@ -36,7 +36,7 @@ class UpdatesControllerDemoModeTest {
|
||||
.encodeToString("test-admin:test-admin-password".getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
@Autowired private MockMvc mockMvc;
|
||||
@MockBean private UpdateCheckService updates;
|
||||
@MockitoBean private UpdateCheckService updates;
|
||||
|
||||
@Test
|
||||
void check_returns403_inDemoMode() throws Exception {
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
@@ -42,7 +42,7 @@ class UpdatesControllerTest {
|
||||
.encodeToString("test-admin:test-admin-password".getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
@Autowired private MockMvc mockMvc;
|
||||
@MockBean private UpdateCheckService updates;
|
||||
@MockitoBean private UpdateCheckService updates;
|
||||
|
||||
private UpdateStatus sampleUpdate() {
|
||||
return new UpdateStatus(true, true, false, "1.0.0",
|
||||
|
||||
@@ -10,7 +10,6 @@ spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:loremind_test}
|
||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||
|
||||
# Configuration JPA pour les tests : schema recree a chaque run, pas de logs SQL.
|
||||
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
|
||||
spring.jpa.hibernate.ddl-auto=create-drop
|
||||
spring.jpa.show-sql=false
|
||||
|
||||
@@ -19,7 +18,7 @@ spring.jpa.show-sql=false
|
||||
spring.flyway.enabled=false
|
||||
|
||||
# Pool Hikari volontairement minuscule en test : la suite cree de nombreux
|
||||
# contextes Spring distincts (combinaisons de @MockBean / @TestPropertySource),
|
||||
# contextes Spring distincts (combinaisons de @MockitoBean / @TestPropertySource),
|
||||
# tous gardes en cache simultanement. Avec le pool par defaut (10), on epuisait
|
||||
# les connexions Postgres ("remaining connection slots are reserved"). 2 par
|
||||
# contexte suffit (tests sequentiels) et borne le total bien sous max_connections.
|
||||
@@ -40,3 +39,27 @@ minio.endpoint=http://localhost:9000
|
||||
minio.access-key=test
|
||||
minio.secret-key=test
|
||||
minio.bucket=test-bucket
|
||||
|
||||
# open-in-view fixe explicitement (defaut true) : supprime l'avertissement au boot.
|
||||
spring.jpa.open-in-view=true
|
||||
|
||||
# Le daemon de refresh de licence (@Scheduled) n'a rien a faire pendant les tests :
|
||||
# son tick echouait en arriere-plan (table licenses droppee par le create-drop
|
||||
# partage entre contextes) => stacktraces parasites. On le desactive ici.
|
||||
licensing.refresh.enabled=false
|
||||
|
||||
# --- Sortie de test LISIBLE ---------------------------------------------------
|
||||
# Pas de banniere Spring (repetee a chaque contexte), et seuls les WARN/ERROR
|
||||
# remontent : la masse d'INFO de demarrage (Spring/Hibernate/Hikari, "Started
|
||||
# XxxTest", seeder...) n'apporte rien et noyait les vrais signaux.
|
||||
spring.main.banner-mode=off
|
||||
logging.level.root=WARN
|
||||
# Tests de CHEMIN D'ERREUR : les controleurs loggent VOLONTAIREMENT l'echec (ex:
|
||||
# Watchtower injoignable -> 502, Brain down -> 502) AVANT de renvoyer le bon statut
|
||||
# HTTP teste. L'exception est attrapee, jamais propagee : ce sont des logs attendus.
|
||||
logging.level.com.loremind.infrastructure.web.controller=OFF
|
||||
# WARN attendus sur des tests de robustesse (registry injoignable, suppression best-effort).
|
||||
logging.level.com.loremind.infrastructure.updates.UpdateCheckService=ERROR
|
||||
logging.level.com.loremind.infrastructure.ai.BrainNotebookIndexClient=ERROR
|
||||
# Le warning MinIO au @PostConstruct (serveur absent en test) est ATTENDU.
|
||||
logging.level.com.loremind.infrastructure.storage=ERROR
|
||||
|
||||
Reference in New Issue
Block a user