From 65dc3dfcb7715e748cb3dbac85882d87a1c5e025 Mon Sep 17 00:00:00 2001 From: jae9104 Date: Tue, 5 May 2026 13:44:00 +0200 Subject: [PATCH 1/4] Feat(19)-Updated cluster to 1.35 --- iac/terraform/adb.tf | 1 + iac/terraform/conv.py | 67 ----------------------------------------- iac/terraform/images.tf | 4 +-- iac/terraform/oke.tf | 4 +-- 4 files changed, 5 insertions(+), 71 deletions(-) delete mode 100644 iac/terraform/conv.py diff --git a/iac/terraform/adb.tf b/iac/terraform/adb.tf index 35340ac..8f0af25 100644 --- a/iac/terraform/adb.tf +++ b/iac/terraform/adb.tf @@ -43,6 +43,7 @@ resource "oci_database_autonomous_database" "main" { lifecycle { prevent_destroy = true + ignore_changes = all } } diff --git a/iac/terraform/conv.py b/iac/terraform/conv.py deleted file mode 100644 index a11241e..0000000 --- a/iac/terraform/conv.py +++ /dev/null @@ -1,67 +0,0 @@ -content = b"""#!/bin/bash -# ============================================================================== -# Script de inicializacion para MySQL en Oracle Linux ARM64 -# ============================================================================== - -set -e - -# 1. Deshabilitar Firewall y SELinux inmediatamente -systemctl stop firewalld || true -systemctl disable firewalld || true -setenforce 0 || true -if [ -f /etc/selinux/config ]; then - sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config -fi - -# Flush iptables -iptables -F || true -iptables -X || true -iptables -t nat -F || true -iptables -t nat -X || true -iptables -P INPUT ACCEPT || true -iptables -P FORWARD ACCEPT || true -iptables -P OUTPUT ACCEPT || true - -# 2. Instalar MySQL -if ! rpm -q mysql-server; then - dnf install -y mysql-server -fi - -# 3. Configurar MySQL -mkdir -p /etc/my.cnf.d - -cat > /etc/my.cnf.d/z-remote.cnf <<-EOF -[mysqld] -bind-address = 0.0.0.0 -mysqlx-bind-address = 0.0.0.0 -port = 3306 -skip-networking = 0 -EOF - -# 4. Iniciar servicio -systemctl enable mysqld -systemctl start mysqld - -# 5. Esperar disponibilidad -echo 'Esperando a MySQL...' -RETRIES=0 -until mysqladmin ping -h localhost --silent; do - echo 'Waiting for MySQL...' - sleep 2 - RETRIES=$((RETRIES+1)) - if [ $RETRIES -gt 30 ]; then exit 1; fi -done - -# 6. Crear usuarios -mysql -u root <<-MYSQL_SCRIPT - CREATE DATABASE IF NOT EXISTS spiritblade; - CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY 'SpiritBlade2024!'; - GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; - FLUSH PRIVILEGES; -MYSQL_SCRIPT - -echo 'DONE' -""" - -with open('d:\\tfg\\2025-SPIRITBLADE\\iac\\terraform\\mysql-init.sh', 'wb') as f: - f.write(content) diff --git a/iac/terraform/images.tf b/iac/terraform/images.tf index afed6e2..828be7c 100644 --- a/iac/terraform/images.tf +++ b/iac/terraform/images.tf @@ -10,10 +10,10 @@ data "oci_containerengine_node_pool_option" "oke_options" { # Buscar imágenes OKE que soporten ARM64 y K8s v1.31.1 locals { - # Filtrar imágenes OKE compatibles con ARM y v1.31.1 + # Filtrar imágenes OKE compatibles con ARM y la versión del cluster oke_arm_images = [ for source in data.oci_containerengine_node_pool_option.oke_options.sources : - source if can(regex("Oracle-Linux.*aarch64.*OKE-1\\.31\\.1", source.source_name)) + source if can(regex(format("Oracle-Linux.*aarch64.*OKE-%s", replace(oci_containerengine_cluster.k8s_cluster.kubernetes_version, "v", "")), source.source_name)) ] # Seleccionar la imagen más reciente diff --git a/iac/terraform/oke.tf b/iac/terraform/oke.tf index 48e2884..b8e114e 100644 --- a/iac/terraform/oke.tf +++ b/iac/terraform/oke.tf @@ -4,7 +4,7 @@ resource "oci_containerengine_cluster" "k8s_cluster" { compartment_id = var.compartment_ocid - kubernetes_version = "v1.31.1" # Versión soportada en eu-madrid-1 + kubernetes_version = "v1.34.1" # Versión soportada en eu-madrid-1 name = "${var.project_name}-cluster" vcn_id = oci_core_vcn.main.id @@ -33,7 +33,7 @@ resource "oci_containerengine_cluster" "k8s_cluster" { resource "oci_containerengine_node_pool" "node_pool" { cluster_id = oci_containerengine_cluster.k8s_cluster.id compartment_id = var.compartment_ocid - kubernetes_version = "v1.31.1" + kubernetes_version = "v1.35.2" name = "${var.project_name}-node-pool" # VM.Standard.A1.Flex es ARM Ampere (Free Tier: 4 OCPUs y 24GB RAM total) From 481095d738fb691cfbe278f11decdc40c052e9c0 Mon Sep 17 00:00:00 2001 From: jae9104 Date: Tue, 5 May 2026 17:45:44 +0200 Subject: [PATCH 2/4] Feat(19)-Fix cluster --- iac/terraform/oke.tf | 2 +- k8s/prod/backend-deployment.yaml | 4 ++-- k8s/prod/frontend-deployment.yaml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iac/terraform/oke.tf b/iac/terraform/oke.tf index b8e114e..65fdc3f 100644 --- a/iac/terraform/oke.tf +++ b/iac/terraform/oke.tf @@ -4,7 +4,7 @@ resource "oci_containerengine_cluster" "k8s_cluster" { compartment_id = var.compartment_ocid - kubernetes_version = "v1.34.1" # Versión soportada en eu-madrid-1 + kubernetes_version = "v1.35.2" # Actualizado a la última name = "${var.project_name}-cluster" vcn_id = oci_core_vcn.main.id diff --git a/k8s/prod/backend-deployment.yaml b/k8s/prod/backend-deployment.yaml index 8f22362..a2cfea0 100644 --- a/k8s/prod/backend-deployment.yaml +++ b/k8s/prod/backend-deployment.yaml @@ -21,13 +21,13 @@ spec: containers: - name: app # Multi-arch backend-only image supporting linux/amd64 and linux/arm64 - image: jae9104/spiritblade-backend:latest + image: docker.io/jae9104/spiritblade-backend:latest ports: - containerPort: 443 resources: requests: memory: "300Mi" - cpu: "250m" + cpu: "100m" limits: memory: "600Mi" cpu: "600m" diff --git a/k8s/prod/frontend-deployment.yaml b/k8s/prod/frontend-deployment.yaml index 6df1a22..5e814a2 100644 --- a/k8s/prod/frontend-deployment.yaml +++ b/k8s/prod/frontend-deployment.yaml @@ -19,13 +19,13 @@ spec: containers: - name: web # Multi-arch frontend-only image (Angular + nginx) supporting linux/amd64 and linux/arm64 - image: jae9104/spiritblade-frontend:latest + image: docker.io/jae9104/spiritblade-frontend:latest ports: - containerPort: 443 resources: requests: memory: "256Mi" - cpu: "150m" + cpu: "50m" limits: memory: "512Mi" cpu: "500m" From a2102a67782586cce4ec74bafe5eb733932f293b Mon Sep 17 00:00:00 2001 From: jae9104 Date: Tue, 5 May 2026 18:03:58 +0200 Subject: [PATCH 3/4] Feat(19)-Fix cluster --- .../src/main/resources/application.properties | 4 ++-- backend/src/main/resources/keystore.jks | Bin 2256 -> 0 bytes k8s/dev/secrets.yaml | 19 ------------------ 3 files changed, 2 insertions(+), 21 deletions(-) delete mode 100644 backend/src/main/resources/keystore.jks delete mode 100644 k8s/dev/secrets.yaml diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index caefdf6..dfaba74 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -42,12 +42,12 @@ jwt.expiration=${JWT_EXPIRATION:86400000} # ============================================ # Riot API Configuration # ============================================ -riot.api.key=${RIOT_API_KEY:RGAPI-7863c35a-a05f-4d60-a638-32376f1189ac} +riot.api.key=${RIOT_API_KEY:REPLACE_WITH_YOUR_RIOT_API_KEY} # ============================================ # Google AI Configuration (Gemini) # ============================================ -google.ai.api.key=${GOOGLE_AI_API_KEY:AIzaSyAambK9U6ps0QX41--9G3tC-xKN2Xk6Wiw} +google.ai.api.key=${GOOGLE_AI_API_KEY:REPLACE_WITH_YOUR_GOOGLE_AI_API_KEY} # ============================================ # Actuator Configuration diff --git a/backend/src/main/resources/keystore.jks b/backend/src/main/resources/keystore.jks deleted file mode 100644 index 1d904a91ec091e355cca5f68b8bc432f8a128be2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2256 zcmchX`8yN}7sqF_%rF=RMTCe3%?!qNWeG*HOt#4u#uC}G7899>A{m5Kni!;VZIwb9 z*TmS8Y$HXoHMWWdVa%)h-1mL%U-15Le)xXQ_lNU*&w0+y(#{e9008Y4@b40eiU^7f ziuMih@$=thMLD{EumA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)|I%caV}|AFF0JA6h!mXXAAqjhz0K&TVP@y6n{g!qcq}S}bgjYYR50 zmB*ylmj+{K#sl=uFGz)g_?mb`U0C}t7B7B%^w(LxIb)#}K)&hGkWO0-7_ZbjuWHBa z`bueCP$C6?hfO%*DKJsbLoYia*OebSvQmbvFnQtkmV#kI~J*G!3P-KP;i!Ak8| z=o^K5416i%()K-1Nl7|fSyFq1EPE!deTZWFd0{9p1E`uo=(Ypz!4DAnBRG@jFz?jx zewT!%AcvTQ1P~Yq0G29Z_G9FBmnkO#k%Ay|9Xq$Aho4CTT3y@*k{q_Nxj8Za4srLg zc0&XL(#Kbtr5yT5<^`dhl|l4Rf8KuKN=~ywLFp&>LZn=yGjXWNzQwmjgVRl)$4LVPw8+v;8o@kS#mjrHnhD(+u z`|9|XMhKV(wiLzV4SlArhB-QWt+w%Z-y<_u&jCi``hZYPlL@X$RKA>i_@% diff --git a/k8s/dev/secrets.yaml b/k8s/dev/secrets.yaml deleted file mode 100644 index 645f348..0000000 --- a/k8s/dev/secrets.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: spiritblade-secrets -type: Opaque -stringData: - # MySQL - mysql-root-password: "root" - mysql-database: "spiritblade" - - # MinIO - minio-access-key: "minioadmin" - minio-secret-key: "minioadmin" - - # App - jwt-secret: "my-super-secret-jwt-key-change-me-in-prod-1234567890" - riot-api-key: "RGAPI-PLACEHOLDER" - google-ai-api-key: "GOOGLE-AI-PLACEHOLDER" - ssl-password: "changeit" From bf40040723fca3e03b9b250d6a2b12645c216be1 Mon Sep 17 00:00:00 2001 From: jae9104 Date: Tue, 5 May 2026 21:02:44 +0200 Subject: [PATCH 4/4] Feat(19)-Deleted leak --- backend/pom.xml | 7 +++++ .../java/com/tfg/tfg/TfgApplicationTests.java | 2 ++ .../java/com/tfg/tfg/e2e/AdminE2ETest.java | 2 ++ .../com/tfg/tfg/e2e/DashboardE2ETest.java | 2 ++ .../tfg/tfg/e2e/HomeNavigationE2ETest.java | 2 ++ .../java/com/tfg/tfg/e2e/LoginE2ETest.java | 2 ++ .../AdminControllerIntegrationTest.java | 2 ++ .../DashboardControllerIntegrationTest.java | 2 ++ .../FileControllerIntegrationTest.java | 2 ++ .../RiotServiceIntegrationTest.java | 2 ++ .../SummonerControllerIntegrationTest.java | 2 ++ .../UserControllerIntegrationTest.java | 2 ++ .../com/tfg/tfg/system/AdminSystemTest.java | 2 ++ .../com/tfg/tfg/system/AuthSystemTest.java | 2 ++ .../tfg/tfg/system/DashboardSystemTest.java | 2 ++ .../com/tfg/tfg/system/SearchSystemTest.java | 2 ++ .../tfg/tfg/system/UserAccountSystemTest.java | 2 ++ .../resources/application-test.properties | 26 ++++++++++++++++++ backend/src/test/resources/keystore.jks | Bin 0 -> 2243 bytes 19 files changed, 65 insertions(+) create mode 100644 backend/src/test/resources/application-test.properties create mode 100644 backend/src/test/resources/keystore.jks diff --git a/backend/pom.xml b/backend/pom.xml index 77c7634..39a922b 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -179,6 +179,13 @@ 1.12.772 + + + com.h2database + h2 + test + + diff --git a/backend/src/test/java/com/tfg/tfg/TfgApplicationTests.java b/backend/src/test/java/com/tfg/tfg/TfgApplicationTests.java index 50a6614..52e35e8 100644 --- a/backend/src/test/java/com/tfg/tfg/TfgApplicationTests.java +++ b/backend/src/test/java/com/tfg/tfg/TfgApplicationTests.java @@ -2,7 +2,9 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +@ActiveProfiles("test") @SpringBootTest class TfgApplicationTests { diff --git a/backend/src/test/java/com/tfg/tfg/e2e/AdminE2ETest.java b/backend/src/test/java/com/tfg/tfg/e2e/AdminE2ETest.java index a0cb2ef..7de6c2b 100644 --- a/backend/src/test/java/com/tfg/tfg/e2e/AdminE2ETest.java +++ b/backend/src/test/java/com/tfg/tfg/e2e/AdminE2ETest.java @@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import java.time.Duration; @@ -26,6 +27,7 @@ /** * End-to-end tests for the admin interface and API endpoints. */ +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @TestPropertySource(properties = { "jwt.secret=mySecretKeyForTesting123456789012345678901234567890" diff --git a/backend/src/test/java/com/tfg/tfg/e2e/DashboardE2ETest.java b/backend/src/test/java/com/tfg/tfg/e2e/DashboardE2ETest.java index d398243..d009053 100644 --- a/backend/src/test/java/com/tfg/tfg/e2e/DashboardE2ETest.java +++ b/backend/src/test/java/com/tfg/tfg/e2e/DashboardE2ETest.java @@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import java.time.Duration; @@ -26,6 +27,7 @@ /** * End-to-end tests for the dashboard interface and API endpoints. */ +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @TestPropertySource(properties = { "jwt.secret=mySecretKeyForTesting123456789012345678901234567890" diff --git a/backend/src/test/java/com/tfg/tfg/e2e/HomeNavigationE2ETest.java b/backend/src/test/java/com/tfg/tfg/e2e/HomeNavigationE2ETest.java index 8681d3e..d320ee2 100644 --- a/backend/src/test/java/com/tfg/tfg/e2e/HomeNavigationE2ETest.java +++ b/backend/src/test/java/com/tfg/tfg/e2e/HomeNavigationE2ETest.java @@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import java.time.Duration; @@ -26,6 +27,7 @@ /** * End-to-end tests for the home navigation and main page. */ +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @TestPropertySource(properties = { "jwt.secret=mySecretKeyForTesting123456789012345678901234567890" diff --git a/backend/src/test/java/com/tfg/tfg/e2e/LoginE2ETest.java b/backend/src/test/java/com/tfg/tfg/e2e/LoginE2ETest.java index 9003e12..221ecb1 100644 --- a/backend/src/test/java/com/tfg/tfg/e2e/LoginE2ETest.java +++ b/backend/src/test/java/com/tfg/tfg/e2e/LoginE2ETest.java @@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import java.time.Duration; @@ -26,6 +27,7 @@ /** * End-to-end tests for the login interface and API endpoints. */ +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @TestPropertySource(properties = { "jwt.secret=mySecretKeyForTesting123456789012345678901234567890" diff --git a/backend/src/test/java/com/tfg/tfg/integration/AdminControllerIntegrationTest.java b/backend/src/test/java/com/tfg/tfg/integration/AdminControllerIntegrationTest.java index 7dd0318..615be8e 100644 --- a/backend/src/test/java/com/tfg/tfg/integration/AdminControllerIntegrationTest.java +++ b/backend/src/test/java/com/tfg/tfg/integration/AdminControllerIntegrationTest.java @@ -9,6 +9,7 @@ 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.test.context.ActiveProfiles; import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.http.MediaType; import org.springframework.security.test.context.support.WithMockUser; @@ -25,6 +26,7 @@ * Integration tests for AdminController * Tests admin-specific operations with real database interactions */ +@ActiveProfiles("test") @SpringBootTest @AutoConfigureMockMvc @Transactional diff --git a/backend/src/test/java/com/tfg/tfg/integration/DashboardControllerIntegrationTest.java b/backend/src/test/java/com/tfg/tfg/integration/DashboardControllerIntegrationTest.java index baef946..148a44f 100644 --- a/backend/src/test/java/com/tfg/tfg/integration/DashboardControllerIntegrationTest.java +++ b/backend/src/test/java/com/tfg/tfg/integration/DashboardControllerIntegrationTest.java @@ -13,6 +13,7 @@ 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.test.context.ActiveProfiles; import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.web.servlet.MockMvc; @@ -40,6 +41,7 @@ * Strategy: Use real database with @Transactional, mock only external API * (RiotService) */ +@ActiveProfiles("test") @SpringBootTest @AutoConfigureMockMvc @Transactional diff --git a/backend/src/test/java/com/tfg/tfg/integration/FileControllerIntegrationTest.java b/backend/src/test/java/com/tfg/tfg/integration/FileControllerIntegrationTest.java index 86508f6..e631d4a 100644 --- a/backend/src/test/java/com/tfg/tfg/integration/FileControllerIntegrationTest.java +++ b/backend/src/test/java/com/tfg/tfg/integration/FileControllerIntegrationTest.java @@ -11,6 +11,7 @@ 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.test.context.ActiveProfiles; import org.springframework.mock.web.MockMultipartFile; import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; @@ -27,6 +28,7 @@ * Integration tests for FileController * Tests file upload, download, and delete operations */ +@ActiveProfiles("test") @SpringBootTest @AutoConfigureMockMvc @Transactional diff --git a/backend/src/test/java/com/tfg/tfg/integration/RiotServiceIntegrationTest.java b/backend/src/test/java/com/tfg/tfg/integration/RiotServiceIntegrationTest.java index 7e79345..a1cee46 100644 --- a/backend/src/test/java/com/tfg/tfg/integration/RiotServiceIntegrationTest.java +++ b/backend/src/test/java/com/tfg/tfg/integration/RiotServiceIntegrationTest.java @@ -9,6 +9,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.transaction.annotation.Transactional; @@ -20,6 +21,7 @@ /** * Integration tests for RiotService and related repositories. */ +@ActiveProfiles("test") @SpringBootTest @Transactional class RiotServiceIntegrationTest { diff --git a/backend/src/test/java/com/tfg/tfg/integration/SummonerControllerIntegrationTest.java b/backend/src/test/java/com/tfg/tfg/integration/SummonerControllerIntegrationTest.java index 1a6a4e2..1a0c871 100644 --- a/backend/src/test/java/com/tfg/tfg/integration/SummonerControllerIntegrationTest.java +++ b/backend/src/test/java/com/tfg/tfg/integration/SummonerControllerIntegrationTest.java @@ -14,6 +14,7 @@ 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.test.context.ActiveProfiles; import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.web.servlet.MockMvc; @@ -34,6 +35,7 @@ * Strategic Integration Tests for SummonerController * */ +@ActiveProfiles("test") @SpringBootTest @AutoConfigureMockMvc @Transactional diff --git a/backend/src/test/java/com/tfg/tfg/integration/UserControllerIntegrationTest.java b/backend/src/test/java/com/tfg/tfg/integration/UserControllerIntegrationTest.java index 0f58674..e0ac5a1 100644 --- a/backend/src/test/java/com/tfg/tfg/integration/UserControllerIntegrationTest.java +++ b/backend/src/test/java/com/tfg/tfg/integration/UserControllerIntegrationTest.java @@ -9,6 +9,7 @@ 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.test.context.ActiveProfiles; import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.http.MediaType; import org.springframework.security.test.context.support.WithMockUser; @@ -25,6 +26,7 @@ * Integration tests for UserController * Tests real database interactions and full request/response cycles */ +@ActiveProfiles("test") @SpringBootTest @AutoConfigureMockMvc @Transactional diff --git a/backend/src/test/java/com/tfg/tfg/system/AdminSystemTest.java b/backend/src/test/java/com/tfg/tfg/system/AdminSystemTest.java index b50dd77..68c68d1 100644 --- a/backend/src/test/java/com/tfg/tfg/system/AdminSystemTest.java +++ b/backend/src/test/java/com/tfg/tfg/system/AdminSystemTest.java @@ -11,6 +11,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.test.context.ActiveProfiles; import static io.restassured.RestAssured.*; import static org.hamcrest.Matchers.*; @@ -18,6 +19,7 @@ /** * Comprehensive system tests for admin functionalities, including user management and access control. */ +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class AdminSystemTest { diff --git a/backend/src/test/java/com/tfg/tfg/system/AuthSystemTest.java b/backend/src/test/java/com/tfg/tfg/system/AuthSystemTest.java index 8edabf5..dd86ed2 100644 --- a/backend/src/test/java/com/tfg/tfg/system/AuthSystemTest.java +++ b/backend/src/test/java/com/tfg/tfg/system/AuthSystemTest.java @@ -11,6 +11,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.test.context.ActiveProfiles; import static io.restassured.RestAssured.*; import static org.hamcrest.Matchers.*; @@ -18,6 +19,7 @@ /** * Comprehensive system tests for authentication and session management. */ +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class AuthSystemTest { diff --git a/backend/src/test/java/com/tfg/tfg/system/DashboardSystemTest.java b/backend/src/test/java/com/tfg/tfg/system/DashboardSystemTest.java index 5e914c5..a9c84f4 100644 --- a/backend/src/test/java/com/tfg/tfg/system/DashboardSystemTest.java +++ b/backend/src/test/java/com/tfg/tfg/system/DashboardSystemTest.java @@ -11,6 +11,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.test.context.ActiveProfiles; import static io.restassured.RestAssured.*; import static org.hamcrest.Matchers.*; @@ -18,6 +19,7 @@ /** * Testing system for dashboard functionalities, including recent summoner activity and match history display. */ +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class DashboardSystemTest { diff --git a/backend/src/test/java/com/tfg/tfg/system/SearchSystemTest.java b/backend/src/test/java/com/tfg/tfg/system/SearchSystemTest.java index fe0e0fd..9e7f981 100644 --- a/backend/src/test/java/com/tfg/tfg/system/SearchSystemTest.java +++ b/backend/src/test/java/com/tfg/tfg/system/SearchSystemTest.java @@ -12,6 +12,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.security.crypto.password.PasswordEncoder; @@ -23,6 +24,7 @@ /** * Testing system for search functionalities, including summoner search and match history retrieval. */ +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class SearchSystemTest { diff --git a/backend/src/test/java/com/tfg/tfg/system/UserAccountSystemTest.java b/backend/src/test/java/com/tfg/tfg/system/UserAccountSystemTest.java index 0b1e378..004d6fd 100644 --- a/backend/src/test/java/com/tfg/tfg/system/UserAccountSystemTest.java +++ b/backend/src/test/java/com/tfg/tfg/system/UserAccountSystemTest.java @@ -11,6 +11,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.test.context.ActiveProfiles; import static io.restassured.RestAssured.*; import static org.hamcrest.Matchers.*; @@ -18,6 +19,7 @@ /** * Comprehensive system tests for user account functionalities, including profile management and summoner linking. */ +@ActiveProfiles("test") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class UserAccountSystemTest { diff --git a/backend/src/test/resources/application-test.properties b/backend/src/test/resources/application-test.properties new file mode 100644 index 0000000..562cc69 --- /dev/null +++ b/backend/src/test/resources/application-test.properties @@ -0,0 +1,26 @@ +# ============================================ +# SPIRITBLADE - Test Configuration +# ============================================ + +# SSL Configuration for Tests +server.ssl.key-store=classpath:keystore.jks +server.ssl.key-store-password=spiritblade +server.ssl.key-password=spiritblade +server.ssl.key-alias=spiritblade + +# JWT Configuration for Tests +jwt.secret=mySecretKeyForTesting123456789012345678901234567890 + +# Database Configuration for Tests (H2 in-memory) +spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;MODE=Oracle +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect +spring.jpa.hibernate.ddl-auto=create-drop + +# Riot API Configuration for Tests (Mocked) +riot.api.key=RGAPI-MOCK-KEY-FOR-TESTING + +# Google AI Configuration for Tests (Mocked) +google.ai.api.key=GEMINI-MOCK-KEY-FOR-TESTING diff --git a/backend/src/test/resources/keystore.jks b/backend/src/test/resources/keystore.jks new file mode 100644 index 0000000000000000000000000000000000000000..1efc0bb447bc8ad777fc23ea41510dbed6059f3f GIT binary patch literal 2243 zcmcgtX*(MT7fmE$jV)>&t+Z;Z5=;=qSQ}d`MJZalqSO*X4aOR!sfvA%EvmIvIwfjv z%+OL*yN(j+sH%NQi;B@c@B2RU3*Has!#VeUxX-!wIhVD@S_1$8Y$pKz01r0AKg>Ve zGtk4^=R_;r4=k?(0N4SDMDRBRFNFI71PBHyvIzo#;6(6>;#}LfW4ABzjm$Yy=ses_ zWPzi1UwSg9v6c6XmbKQ=BH?^Us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