Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ jobs:
run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V

- name: Run tests
run: mvn test -Dtest="SimpleTest"
run: |
echo "Setting test environment profile..."
export SPRING_PROFILES_ACTIVE=test
mvn test

- name: Test Results Summary
if: always()
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ jobs:

- name: Run all tests
run: |
echo "🧪 Running all tests..."
echo "🧪 Running all tests with test profile..."
export SPRING_PROFILES_ACTIVE=test
mvn test
echo "✅ All tests passed!"

Expand Down
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@
<scope>test</scope>
</dependency>

<!-- Solo usamos PostgreSQL para todos los entornos -->
<!-- H2 Database for tests only -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/merca/merca/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.authorizeHttpRequests(authz -> authz
// Recursos públicos
.requestMatchers("/css/**", "/js/**", "/images/**", "/webjars/**").permitAll()
.requestMatchers("/login", "/error", "/favicon.ico", "/h2-console/**").permitAll()
.requestMatchers("/login", "/error", "/favicon.ico").permitAll()

// Rutas de administrador
.requestMatchers("/admin/**").hasRole("ADMIN")
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/application-test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=

# Configuración JPA para tests - IMPORTANTE: Anular configuración de PostgreSQL
# Configuración JPA para tests - IMPORTANTE: Usar H2 solo para tests
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=create-drop
Expand Down