From 8a1c3e5fba37379312c14084d3e8be47c7e01ad8 Mon Sep 17 00:00:00 2001 From: yujamint Date: Sat, 1 Jun 2024 21:09:27 +0900 Subject: [PATCH 1/4] =?UTF-8?q?chore:=20github=20actions=20test=20workflow?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yaml | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..da535e8 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,38 @@ +name: run test + +on: + pull_request: + branches: [main, dev] + types: [opened, synchronize, reopened] + +permissions: + checks: write + pull-requests: write + +jobs: + test: + + runs-on: ubuntu-latest + + steps: + - name: 체크아웃 + uses: actions/checkout@v4 + + - name: JDK 11 설치 + uses: actions/setup-java@v4 + with: + distribution: 'corretto' + java-version: '11' + cache: 'gradle' + + - name: Gradle에 실행 권한 부여 + run: chmod +x gradlew + + - name: Test 실행 + run: ./gradlew test + + - name: Test 결과를 PR에 코멘트로 등록 + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + files: '**/build/test-results/test/TEST-*.xml' From 8712e9187ba43eec7ad67dc52394d3a55af4bc1c Mon Sep 17 00:00:00 2001 From: yujamint Date: Sat, 1 Jun 2024 21:14:38 +0900 Subject: [PATCH 2/4] =?UTF-8?q?test:=20=EC=8B=A4=ED=8C=A8=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=9E=84=EC=8B=9C=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/app/gpt/GPTResponseFormatTest.java | 440 +++++++++--------- 1 file changed, 220 insertions(+), 220 deletions(-) diff --git a/src/test/java/com/app/gpt/GPTResponseFormatTest.java b/src/test/java/com/app/gpt/GPTResponseFormatTest.java index 2451e79..bdb6bd3 100644 --- a/src/test/java/com/app/gpt/GPTResponseFormatTest.java +++ b/src/test/java/com/app/gpt/GPTResponseFormatTest.java @@ -1,220 +1,220 @@ -package com.app.gpt; - -import com.app.domain.problem.aigeneratedproblem.service.ProblemFileService; -import com.app.gpt.dto.ProblemSchema; -import com.app.gpt.dto.SummarySchema; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.module.jsonSchema.jakarta.JsonSchema; -import com.fasterxml.jackson.module.jsonSchema.jakarta.factories.SchemaFactoryWrapper; -import com.knuddels.jtokkit.Encodings; -import com.knuddels.jtokkit.api.Encoding; -import com.knuddels.jtokkit.api.ModelType; -import com.theokanning.openai.completion.chat.ChatCompletionRequest; -import com.theokanning.openai.completion.chat.ChatCompletionRequest.ChatCompletionRequestFunctionCall; -import com.theokanning.openai.completion.chat.ChatFunction; -import com.theokanning.openai.completion.chat.ChatMessage; -import com.theokanning.openai.completion.chat.ChatMessageRole; -import com.theokanning.openai.service.FunctionExecutor; -import com.theokanning.openai.service.OpenAiService; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayNameGeneration; -import org.junit.jupiter.api.DisplayNameGenerator; -import org.junit.jupiter.api.Test; -import org.springframework.mock.web.MockMultipartFile; -import org.springframework.web.multipart.MultipartFile; -import org.yaml.snakeyaml.Yaml; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import static com.app.gpt.dto.ProblemSchema.ProblemChoices; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - -@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) -@SuppressWarnings("NonAsciiCharacters") -public class GPTResponseFormatTest { - private static final Encoding ENCODING = Encodings.newDefaultEncodingRegistry().getEncodingForModel(ModelType.GPT_3_5_TURBO); - private static final String GPT_3_5_TURBO_0125 = "gpt-3.5-turbo-0125"; - private static final String APPLICATION_LOCAL_YML = "src/main/resources/application-local.yml"; - - private static final FunctionExecutor PROBLEM_FUNCTION_EXECUTOR = new FunctionExecutor(List.of(ChatFunction.builder() - .name("get_new_quiz") - .description("요청한 내용을 기반으로 객관식 문제 만들어줘 빈칸이 있으면 안돼") - .executor(ProblemSchema.class, parameter -> parameter) - .build())); - - private static final String DIFFICULTY = "어려운"; - private static final int MAX_TOKEN_COUNT = 550; - - private static final String TEST_PDF_FILE_PATH = "src/test/resources/pdf/"; - private static final String TEST_TEXT_FILE_PATH = "src/test/resources/text/"; - - private OpenAiService openAiService; - private ObjectMapper objectMapper; - - @BeforeEach - void setUp() throws FileNotFoundException { - Map properties = new Yaml().load(new FileReader(APPLICATION_LOCAL_YML)); - String openAiApiToken = properties.get("openai-api-token"); - openAiService = new OpenAiService(openAiApiToken); - - objectMapper = new ObjectMapper(); - } - -// @RepeatedTest(5) - @Test - void 텍스트_기반_AI_문제_생성() throws IOException { - String testFileName = "text1.text"; - String text = Files.readString(Paths.get(TEST_TEXT_FILE_PATH + testFileName)); - List messages = new ArrayList<>(); - messages.add(new ChatMessage(ChatMessageRole.SYSTEM.value(), "당신이 시험 문제 출제자가 됐다고 가정하겠습니다.")); - - List textChunks = splitToken(text); - for (String textChunk : textChunks) { - String prompt = String.format("%s의 내용을 기반으로 %s 객관식 문제 만들어줘\"", textChunk, DIFFICULTY); - messages.add(new ChatMessage(ChatMessageRole.USER.value(), prompt)); - - ChatMessage responseMessage = createChatCompletion(PROBLEM_FUNCTION_EXECUTOR, messages); - JsonNode arguments = responseMessage.getFunctionCall().getArguments(); - - System.out.println(arguments.toPrettyString()); - assertProblemSchema(arguments); - } - } - -// @RepeatedTest(5) - @Test - void PDF_기반_AI_문제_생성() throws IOException { - String testFileName = "pdf1.pdf"; - String text = readPdfFile(testFileName); - List messages = new ArrayList<>(); - messages.add(new ChatMessage(ChatMessageRole.SYSTEM.value(), "당신이 시험 문제 출제자가 됐다고 가정하겠습니다.")); - - List textChunks = splitToken(text); - for (String textChunk : textChunks) { - String prompt = String.format("%s의 내용을 기반으로 %s 객관식 문제 만들어줘", textChunk, DIFFICULTY); - messages.add(new ChatMessage(ChatMessageRole.USER.value(), prompt)); - - ChatMessage responseMessage = createChatCompletion(PROBLEM_FUNCTION_EXECUTOR, messages); - JsonNode arguments = responseMessage.getFunctionCall().getArguments(); - - System.out.println(arguments.toPrettyString()); - assertProblemSchema(arguments); - } - } - - private List splitToken(String text) { - List tokens = new ArrayList<>(); - - StringBuilder currentText = new StringBuilder(); - for (char character : text.toCharArray()) { - currentText.append(character); - if (ENCODING.countTokens(currentText.toString()) >= MAX_TOKEN_COUNT) { - tokens.add(currentText.toString()); - currentText.setLength(0); - } - } - tokens.add(currentText.toString()); - return tokens; - } - - private void assertProblemSchema(JsonNode arguments) throws JsonProcessingException { - assertDoesNotThrow(() -> objectMapper.treeToValue(arguments, ProblemSchema.class), "예상치 못한 값이 Json 데이터에 포함되어 있습니다."); - ProblemSchema problemSchema = objectMapper.treeToValue(arguments, ProblemSchema.class); - ProblemChoices problemChoices = problemSchema.getProblemChoices(); - assertAll( - () -> assertThat(problemSchema.getProblemName()).isNotNull(), - () -> assertThat(problemChoices.getOne()).isNotNull(), - () -> assertThat(problemChoices.getTwo()).isNotNull(), - () -> assertThat(problemChoices.getThree()).isNotNull(), - () -> assertThat(problemChoices.getFour()).isNotNull(), - () -> assertThat(problemSchema.getProblemAnswer()).isNotNull(), - () -> assertThat(problemSchema.getProblemCommentary()).isNotNull() - ); - } - -// @RepeatedTest(5) - @Test - void PDF_기반_AI_요약정리_생성() throws IOException { - FunctionExecutor functionExecutor = new FunctionExecutor(List.of(ChatFunction.builder() - .name("get_new_summary") - .description("요청한 내용을 기반으로 요점 정리해줘") - .executor(SummarySchema.class, parameter -> parameter) - .build())); - - String testFileName = "pdf1.pdf"; - String text = readPdfFile(testFileName); - List messages = new ArrayList<>(); - messages.add(new ChatMessage(ChatMessageRole.SYSTEM.value(), "당신은 강의 자료의 핵심 정보를 요약해주는 역할입니다.")); - - List textChunks = splitToken(text); - for (String textChunk : textChunks) { - String prompt = String.format("%s의 내용을 기반으로 요점 정리 해줘", textChunk); - messages.add(new ChatMessage(ChatMessageRole.USER.value(), prompt)); - - ChatMessage responseMessage = createChatCompletion(functionExecutor, messages); - JsonNode arguments = responseMessage.getFunctionCall().getArguments(); - - System.out.println(arguments.toPrettyString()); - assertDoesNotThrow(() -> objectMapper.treeToValue(arguments, SummarySchema.class), "예상치 못한 값이 Json 데이터에 포함되어 있습니다."); - SummarySchema summarySchema = objectMapper.treeToValue(arguments, SummarySchema.class); - assertThat(summarySchema).isNotNull(); - } - } - - private String readPdfFile(String testFileName) throws IOException { - MultipartFile multipartFile = new MockMultipartFile("test.pdf", new FileInputStream(TEST_PDF_FILE_PATH + testFileName)); - return ProblemFileService.convertFileToString(multipartFile); - } - - private ChatMessage createChatCompletion(FunctionExecutor functionExecutor, List messages) { - ChatCompletionRequest chatCompletionRequest = ChatCompletionRequest.builder() - .model(GPT_3_5_TURBO_0125) - .messages(messages) - .functions(functionExecutor.getFunctions()) - .functionCall(ChatCompletionRequestFunctionCall.of("auto")) - .maxTokens(1_024) - .build(); - - return openAiService.createChatCompletion(chatCompletionRequest).getChoices().get(0).getMessage(); - } - - @Test - void 스키마를_JSON으로_변환하여_출력한다() throws JsonProcessingException { - // 메타데이터가 포함되지 않은 JSON 출력 - ProblemSchema fp = new ProblemSchema( - "문제명", - new ProblemChoices( - "1번 선지", - "2번 선지", - "3번 선지", - "4번 선지" - ), - "문제의 답", - "문제 해설" - ); - String normal = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(fp); - System.out.println(normal); - - System.out.println("-----------"); - // 메타데이터가 포함된 JSON 출력 - SchemaFactoryWrapper visitor = new SchemaFactoryWrapper(); - objectMapper.acceptJsonFormatVisitor(ProblemSchema.class, visitor); - JsonSchema jsonSchema = visitor.finalSchema(); - ObjectWriter objectWriter = objectMapper.writerWithDefaultPrettyPrinter(); - String json = objectWriter.writeValueAsString(jsonSchema); - System.out.println(json); - } -} +//package com.app.gpt; +// +//import com.app.domain.problem.aigeneratedproblem.service.ProblemFileService; +//import com.app.gpt.dto.ProblemSchema; +//import com.app.gpt.dto.SummarySchema; +//import com.fasterxml.jackson.core.JsonProcessingException; +//import com.fasterxml.jackson.databind.JsonNode; +//import com.fasterxml.jackson.databind.ObjectMapper; +//import com.fasterxml.jackson.databind.ObjectWriter; +//import com.fasterxml.jackson.module.jsonSchema.jakarta.JsonSchema; +//import com.fasterxml.jackson.module.jsonSchema.jakarta.factories.SchemaFactoryWrapper; +//import com.knuddels.jtokkit.Encodings; +//import com.knuddels.jtokkit.api.Encoding; +//import com.knuddels.jtokkit.api.ModelType; +//import com.theokanning.openai.completion.chat.ChatCompletionRequest; +//import com.theokanning.openai.completion.chat.ChatCompletionRequest.ChatCompletionRequestFunctionCall; +//import com.theokanning.openai.completion.chat.ChatFunction; +//import com.theokanning.openai.completion.chat.ChatMessage; +//import com.theokanning.openai.completion.chat.ChatMessageRole; +//import com.theokanning.openai.service.FunctionExecutor; +//import com.theokanning.openai.service.OpenAiService; +//import org.junit.jupiter.api.BeforeEach; +//import org.junit.jupiter.api.DisplayNameGeneration; +//import org.junit.jupiter.api.DisplayNameGenerator; +//import org.junit.jupiter.api.Test; +//import org.springframework.mock.web.MockMultipartFile; +//import org.springframework.web.multipart.MultipartFile; +//import org.yaml.snakeyaml.Yaml; +// +//import java.io.FileInputStream; +//import java.io.FileNotFoundException; +//import java.io.FileReader; +//import java.io.IOException; +//import java.nio.file.Files; +//import java.nio.file.Paths; +//import java.util.ArrayList; +//import java.util.List; +//import java.util.Map; +// +//import static com.app.gpt.dto.ProblemSchema.ProblemChoices; +//import static org.assertj.core.api.Assertions.assertThat; +//import static org.junit.jupiter.api.Assertions.assertAll; +//import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +// +//@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) +//@SuppressWarnings("NonAsciiCharacters") +//public class GPTResponseFormatTest { +// private static final Encoding ENCODING = Encodings.newDefaultEncodingRegistry().getEncodingForModel(ModelType.GPT_3_5_TURBO); +// private static final String GPT_3_5_TURBO_0125 = "gpt-3.5-turbo-0125"; +// private static final String APPLICATION_LOCAL_YML = "src/main/resources/application-local.yml"; +// +// private static final FunctionExecutor PROBLEM_FUNCTION_EXECUTOR = new FunctionExecutor(List.of(ChatFunction.builder() +// .name("get_new_quiz") +// .description("요청한 내용을 기반으로 객관식 문제 만들어줘 빈칸이 있으면 안돼") +// .executor(ProblemSchema.class, parameter -> parameter) +// .build())); +// +// private static final String DIFFICULTY = "어려운"; +// private static final int MAX_TOKEN_COUNT = 550; +// +// private static final String TEST_PDF_FILE_PATH = "src/test/resources/pdf/"; +// private static final String TEST_TEXT_FILE_PATH = "src/test/resources/text/"; +// +// private OpenAiService openAiService; +// private ObjectMapper objectMapper; +// +// @BeforeEach +// void setUp() throws FileNotFoundException { +// Map properties = new Yaml().load(new FileReader(APPLICATION_LOCAL_YML)); +// String openAiApiToken = properties.get("openai-api-token"); +// openAiService = new OpenAiService(openAiApiToken); +// +// objectMapper = new ObjectMapper(); +// } +// +//// @RepeatedTest(5) +// @Test +// void 텍스트_기반_AI_문제_생성() throws IOException { +// String testFileName = "text1.text"; +// String text = Files.readString(Paths.get(TEST_TEXT_FILE_PATH + testFileName)); +// List messages = new ArrayList<>(); +// messages.add(new ChatMessage(ChatMessageRole.SYSTEM.value(), "당신이 시험 문제 출제자가 됐다고 가정하겠습니다.")); +// +// List textChunks = splitToken(text); +// for (String textChunk : textChunks) { +// String prompt = String.format("%s의 내용을 기반으로 %s 객관식 문제 만들어줘\"", textChunk, DIFFICULTY); +// messages.add(new ChatMessage(ChatMessageRole.USER.value(), prompt)); +// +// ChatMessage responseMessage = createChatCompletion(PROBLEM_FUNCTION_EXECUTOR, messages); +// JsonNode arguments = responseMessage.getFunctionCall().getArguments(); +// +// System.out.println(arguments.toPrettyString()); +// assertProblemSchema(arguments); +// } +// } +// +//// @RepeatedTest(5) +// @Test +// void PDF_기반_AI_문제_생성() throws IOException { +// String testFileName = "pdf1.pdf"; +// String text = readPdfFile(testFileName); +// List messages = new ArrayList<>(); +// messages.add(new ChatMessage(ChatMessageRole.SYSTEM.value(), "당신이 시험 문제 출제자가 됐다고 가정하겠습니다.")); +// +// List textChunks = splitToken(text); +// for (String textChunk : textChunks) { +// String prompt = String.format("%s의 내용을 기반으로 %s 객관식 문제 만들어줘", textChunk, DIFFICULTY); +// messages.add(new ChatMessage(ChatMessageRole.USER.value(), prompt)); +// +// ChatMessage responseMessage = createChatCompletion(PROBLEM_FUNCTION_EXECUTOR, messages); +// JsonNode arguments = responseMessage.getFunctionCall().getArguments(); +// +// System.out.println(arguments.toPrettyString()); +// assertProblemSchema(arguments); +// } +// } +// +// private List splitToken(String text) { +// List tokens = new ArrayList<>(); +// +// StringBuilder currentText = new StringBuilder(); +// for (char character : text.toCharArray()) { +// currentText.append(character); +// if (ENCODING.countTokens(currentText.toString()) >= MAX_TOKEN_COUNT) { +// tokens.add(currentText.toString()); +// currentText.setLength(0); +// } +// } +// tokens.add(currentText.toString()); +// return tokens; +// } +// +// private void assertProblemSchema(JsonNode arguments) throws JsonProcessingException { +// assertDoesNotThrow(() -> objectMapper.treeToValue(arguments, ProblemSchema.class), "예상치 못한 값이 Json 데이터에 포함되어 있습니다."); +// ProblemSchema problemSchema = objectMapper.treeToValue(arguments, ProblemSchema.class); +// ProblemChoices problemChoices = problemSchema.getProblemChoices(); +// assertAll( +// () -> assertThat(problemSchema.getProblemName()).isNotNull(), +// () -> assertThat(problemChoices.getOne()).isNotNull(), +// () -> assertThat(problemChoices.getTwo()).isNotNull(), +// () -> assertThat(problemChoices.getThree()).isNotNull(), +// () -> assertThat(problemChoices.getFour()).isNotNull(), +// () -> assertThat(problemSchema.getProblemAnswer()).isNotNull(), +// () -> assertThat(problemSchema.getProblemCommentary()).isNotNull() +// ); +// } +// +//// @RepeatedTest(5) +// @Test +// void PDF_기반_AI_요약정리_생성() throws IOException { +// FunctionExecutor functionExecutor = new FunctionExecutor(List.of(ChatFunction.builder() +// .name("get_new_summary") +// .description("요청한 내용을 기반으로 요점 정리해줘") +// .executor(SummarySchema.class, parameter -> parameter) +// .build())); +// +// String testFileName = "pdf1.pdf"; +// String text = readPdfFile(testFileName); +// List messages = new ArrayList<>(); +// messages.add(new ChatMessage(ChatMessageRole.SYSTEM.value(), "당신은 강의 자료의 핵심 정보를 요약해주는 역할입니다.")); +// +// List textChunks = splitToken(text); +// for (String textChunk : textChunks) { +// String prompt = String.format("%s의 내용을 기반으로 요점 정리 해줘", textChunk); +// messages.add(new ChatMessage(ChatMessageRole.USER.value(), prompt)); +// +// ChatMessage responseMessage = createChatCompletion(functionExecutor, messages); +// JsonNode arguments = responseMessage.getFunctionCall().getArguments(); +// +// System.out.println(arguments.toPrettyString()); +// assertDoesNotThrow(() -> objectMapper.treeToValue(arguments, SummarySchema.class), "예상치 못한 값이 Json 데이터에 포함되어 있습니다."); +// SummarySchema summarySchema = objectMapper.treeToValue(arguments, SummarySchema.class); +// assertThat(summarySchema).isNotNull(); +// } +// } +// +// private String readPdfFile(String testFileName) throws IOException { +// MultipartFile multipartFile = new MockMultipartFile("test.pdf", new FileInputStream(TEST_PDF_FILE_PATH + testFileName)); +// return ProblemFileService.convertFileToString(multipartFile); +// } +// +// private ChatMessage createChatCompletion(FunctionExecutor functionExecutor, List messages) { +// ChatCompletionRequest chatCompletionRequest = ChatCompletionRequest.builder() +// .model(GPT_3_5_TURBO_0125) +// .messages(messages) +// .functions(functionExecutor.getFunctions()) +// .functionCall(ChatCompletionRequestFunctionCall.of("auto")) +// .maxTokens(1_024) +// .build(); +// +// return openAiService.createChatCompletion(chatCompletionRequest).getChoices().get(0).getMessage(); +// } +// +// @Test +// void 스키마를_JSON으로_변환하여_출력한다() throws JsonProcessingException { +// // 메타데이터가 포함되지 않은 JSON 출력 +// ProblemSchema fp = new ProblemSchema( +// "문제명", +// new ProblemChoices( +// "1번 선지", +// "2번 선지", +// "3번 선지", +// "4번 선지" +// ), +// "문제의 답", +// "문제 해설" +// ); +// String normal = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(fp); +// System.out.println(normal); +// +// System.out.println("-----------"); +// // 메타데이터가 포함된 JSON 출력 +// SchemaFactoryWrapper visitor = new SchemaFactoryWrapper(); +// objectMapper.acceptJsonFormatVisitor(ProblemSchema.class, visitor); +// JsonSchema jsonSchema = visitor.finalSchema(); +// ObjectWriter objectWriter = objectMapper.writerWithDefaultPrettyPrinter(); +// String json = objectWriter.writeValueAsString(jsonSchema); +// System.out.println(json); +// } +//} From ed52fd33322371385ef5cfe9a00a76680bb8c23d Mon Sep 17 00:00:00 2001 From: Jae Min Yu Date: Sat, 1 Jun 2024 21:21:05 +0900 Subject: [PATCH 3/4] Update test.yaml --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index da535e8..72b3537 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -29,7 +29,7 @@ jobs: run: chmod +x gradlew - name: Test 실행 - run: ./gradlew test + run: ./gradlew clean test - name: Test 결과를 PR에 코멘트로 등록 uses: EnricoMi/publish-unit-test-result-action@v2 From d8959ec81dec0d0c46579050cf293f225374188a Mon Sep 17 00:00:00 2001 From: yujamint Date: Sat, 1 Jun 2024 21:36:15 +0900 Subject: [PATCH 4/4] =?UTF-8?q?chore:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=ED=99=98=EA=B2=BD=EC=97=90=EC=84=9C=EC=9D=98=20=ED=99=98?= =?UTF-8?q?=EA=B2=BD=20=EB=B3=80=EC=88=98=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Github Actions 서버 환경에서 환경 변수가 존재하지 않아 테스트에 실패하는 문제 해결을 위해 설정 --- src/test/resources/application.yml | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/test/resources/application.yml diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml new file mode 100644 index 0000000..8995815 --- /dev/null +++ b/src/test/resources/application.yml @@ -0,0 +1,34 @@ +spring: + datasource: + url: jdbc:h2:mem:test + username: sa + password: + driver-class-name: org.h2.Driver + +jpa: + hibernate: + ddl-auto: create + show-sql: true + properties: + hibernate: + format_sql: true + +token: + secret: 123456789 + access-token-expiration-time: 900000 # 15? 1000(ms) x 60(s) x 15(m) + refresh-token-expiration-time: 1209600000 # 2? 1000(ms) x 60 (s) x 60(m) x 24(h) x 14(d) + +cloud: + aws: #AWS S3 ?? + credentials: + accessKey: 123456789 + secretKey: 123456789 + region: + static: 123456789 + s3: + bucket: 123456789 + +kakao: + client: + id: 123456789 + secret: 123456789