From e1207aff36bc0944d6505fb57c43c327fc2a2266 Mon Sep 17 00:00:00 2001 From: Diger Date: Mon, 29 Jul 2024 11:22:50 +0900 Subject: [PATCH] refact: Test Environment Property --- .../kotlin/com/piikii/bootstrap/secret/SecretProcessor.kt | 2 +- .../kotlin/com/piikii/bootstrap/annotation/AcceptanceTest.kt | 2 +- piikii-bootstrap/src/test/resources/application-dev.yml | 4 ---- piikii-bootstrap/src/test/resources/application.yml | 3 ++- .../main/kotlin/com/piikii/input/http/web/config/WebConfig.kt | 2 +- .../{application-dev.yml => application-test.yml} | 2 +- 6 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 piikii-bootstrap/src/test/resources/application-dev.yml rename piikii-output-persistence/postgresql/src/main/resources/database-config/{application-dev.yml => application-test.yml} (96%) diff --git a/piikii-bootstrap/src/main/kotlin/com/piikii/bootstrap/secret/SecretProcessor.kt b/piikii-bootstrap/src/main/kotlin/com/piikii/bootstrap/secret/SecretProcessor.kt index 549064b4..f0481f0c 100644 --- a/piikii-bootstrap/src/main/kotlin/com/piikii/bootstrap/secret/SecretProcessor.kt +++ b/piikii-bootstrap/src/main/kotlin/com/piikii/bootstrap/secret/SecretProcessor.kt @@ -62,7 +62,7 @@ class SecretProcessor : EnvironmentPostProcessor { const val BEARER_TOKEN_PREFIX = "Bearer" const val SECRET_MANAGER_URL = "https://app.infisical.com/api/v3" - val SUPPORT_PROFILES = setOf("local", "dev", "prod") + val SUPPORT_PROFILES = setOf("local", "test", "prod") } } diff --git a/piikii-bootstrap/src/test/kotlin/com/piikii/bootstrap/annotation/AcceptanceTest.kt b/piikii-bootstrap/src/test/kotlin/com/piikii/bootstrap/annotation/AcceptanceTest.kt index 3f5fe2b8..01cce166 100644 --- a/piikii-bootstrap/src/test/kotlin/com/piikii/bootstrap/annotation/AcceptanceTest.kt +++ b/piikii-bootstrap/src/test/kotlin/com/piikii/bootstrap/annotation/AcceptanceTest.kt @@ -15,5 +15,5 @@ import org.springframework.test.context.ContextConfiguration @AutoConfigureMockMvc @EnableAutoConfiguration @ContextConfiguration(classes = [TestConfiguration::class]) -@ActiveProfiles("dev") +@ActiveProfiles("test") annotation class AcceptanceTest diff --git a/piikii-bootstrap/src/test/resources/application-dev.yml b/piikii-bootstrap/src/test/resources/application-dev.yml deleted file mode 100644 index cfbfb9ab..00000000 --- a/piikii-bootstrap/src/test/resources/application-dev.yml +++ /dev/null @@ -1,4 +0,0 @@ -spring: - config: - activate: - on-profile: dev diff --git a/piikii-bootstrap/src/test/resources/application.yml b/piikii-bootstrap/src/test/resources/application.yml index b768fadf..b600f366 100644 --- a/piikii-bootstrap/src/test/resources/application.yml +++ b/piikii-bootstrap/src/test/resources/application.yml @@ -5,12 +5,13 @@ spring: - classpath:storage-config/application.yml - classpath:lemon-config/application.yml - classpath:avocado-config/application.yml - - classpath:database-config/application-dev.yml + - classpath:database-config/application-test.yml application: name: "piikii" messages: encoding: UTF-8 + secret: token: ${SECRET_MANAGER_TOKEN} workspaceId: ${SECRET_MANAGER_WORKSPACE} diff --git a/piikii-input-http/src/main/kotlin/com/piikii/input/http/web/config/WebConfig.kt b/piikii-input-http/src/main/kotlin/com/piikii/input/http/web/config/WebConfig.kt index 5ea1b413..f6ceb677 100644 --- a/piikii-input-http/src/main/kotlin/com/piikii/input/http/web/config/WebConfig.kt +++ b/piikii-input-http/src/main/kotlin/com/piikii/input/http/web/config/WebConfig.kt @@ -11,7 +11,7 @@ class WebConfig : WebMvcConfigurer { .allowedOrigins("*") .allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS") .allowedHeaders("*") - .allowCredentials(true) + .allowCredentials(false) .maxAge(3600) } } diff --git a/piikii-output-persistence/postgresql/src/main/resources/database-config/application-dev.yml b/piikii-output-persistence/postgresql/src/main/resources/database-config/application-test.yml similarity index 96% rename from piikii-output-persistence/postgresql/src/main/resources/database-config/application-dev.yml rename to piikii-output-persistence/postgresql/src/main/resources/database-config/application-test.yml index 086d5779..ebd41cba 100644 --- a/piikii-output-persistence/postgresql/src/main/resources/database-config/application-dev.yml +++ b/piikii-output-persistence/postgresql/src/main/resources/database-config/application-test.yml @@ -1,7 +1,7 @@ spring: config: activate: - on-profile: dev + on-profile: test datasource: driver-class-name: org.postgresql.Driver