From 86f9671413dd5449fef09eb71549ff351d17c5b8 Mon Sep 17 00:00:00 2001 From: Ethan Date: Mon, 20 May 2024 18:06:40 +0900 Subject: [PATCH 1/5] =?UTF-8?q?test:=20=EC=8B=A4=ED=8C=A8=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../macbook/service/MacbookServiceTest.kt | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/test/kotlin/backend/itracker/crawl/macbook/service/MacbookServiceTest.kt b/src/test/kotlin/backend/itracker/crawl/macbook/service/MacbookServiceTest.kt index 52356b9..f806561 100644 --- a/src/test/kotlin/backend/itracker/crawl/macbook/service/MacbookServiceTest.kt +++ b/src/test/kotlin/backend/itracker/crawl/macbook/service/MacbookServiceTest.kt @@ -5,28 +5,13 @@ import backend.itracker.crawl.macbook.domain.MacbookPrice import backend.itracker.crawl.macbook.domain.MacbookRepository import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import java.math.BigDecimal import java.time.LocalDateTime -private val macbook = Macbook( - company = "Apple", - name = "Apple 2024 맥북 에어 13 M3, 미드나이트, M3 8코어, 10코어 GPU, 1TB, 16GB, 35W 듀얼, 한글", - type = "맥북 에어", - cpu = "M3 8코어", - gpu = "10코어 GPU", - storage = "1TB", - memory = "16GB", - language = "한글", - color = "미드나이트", - size = 13, - releaseYear = 2024, - productLink = "https://www.coupang.com/vp/products/7975088162?itemId=22505523317&vendorItemId=89547640201&sourceType=cmgoms&omsPageId=84871&omsPageUrl=84871", - thumbnail = "https://thumbnail10.coupangcdn.com/thumbnails/remote/230x230ex/image/retail/images/15943638430632-244768e7-86d1-4484-b772-013d185666b8.jpg", - isOutOfStock = false -) @SpringBootTest class MacbookServiceTest { @@ -37,6 +22,28 @@ class MacbookServiceTest { @Autowired lateinit var macbookRepository: MacbookRepository + private lateinit var macbook: Macbook + + @BeforeEach + fun setUp() { + macbook = Macbook( + company = "Apple", + name = "Apple 2024 맥북 에어 13 M3, 미드나이트, M3 8코어, 10코어 GPU, 1TB, 16GB, 35W 듀얼, 한글", + type = "맥북 에어", + cpu = "M3 8코어", + gpu = "10코어 GPU", + storage = "1TB", + memory = "16GB", + language = "한글", + color = "미드나이트", + size = 13, + releaseYear = 2024, + productLink = "https://www.coupang.com/vp/products/7975088162?itemId=22505523317&vendorItemId=89547640201&sourceType=cmgoms&omsPageId=84871&omsPageUrl=84871", + thumbnail = "https://thumbnail10.coupangcdn.com/thumbnails/remote/230x230ex/image/retail/images/15943638430632-244768e7-86d1-4484-b772-013d185666b8.jpg", + isOutOfStock = false + ) + } + @Test fun `전체 저장 테스트`() { // given From b0fb0706074f7c49d9cb48d54c5facd7fa01a6bf Mon Sep 17 00:00:00 2001 From: Ethan Date: Mon, 20 May 2024 19:01:31 +0900 Subject: [PATCH 2/5] =?UTF-8?q?docs:=20ci=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pull-request-open.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull-request-open.yml b/.github/workflows/pull-request-open.yml index 3c8f929..4daa627 100644 --- a/.github/workflows/pull-request-open.yml +++ b/.github/workflows/pull-request-open.yml @@ -3,14 +3,13 @@ name: Pull Request Open on: pull_request: branches: [ "dev" ] - types: [ created ] jobs: build: runs-on: ubuntu-22.04 permissions: contents: read - packages: write + pull-requests: write steps: - uses: actions/checkout@v4 @@ -26,8 +25,15 @@ jobs: - name: Build with Gradle run: ./gradlew build - - name: Publish Unit Test Results + - name: Publish Test Result uses: EnricoMi/publish-unit-test-result-action@v1 - if: ${{ always() }} + if: always() with: - files: backend/build/test-results/**/*.xml + files: '**/build/test-results/test/TEST-*.xml' + + - name: Comment Fail Test + uses: mikepenz/action-junit-report@v3 + if: always() + with: + report_paths: '**/build/test-results/test/TEST-*.xml' + token: ${{ github.token }} From 51904fc2e0d4bbe32b3f668ee3ebead3209855fb Mon Sep 17 00:00:00 2001 From: Ethan Date: Mon, 20 May 2024 19:05:14 +0900 Subject: [PATCH 3/5] =?UTF-8?q?docs:=20ci=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pull-request-open.yml | 51 +++++++++++-------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/.github/workflows/pull-request-open.yml b/.github/workflows/pull-request-open.yml index 4daa627..381c7ca 100644 --- a/.github/workflows/pull-request-open.yml +++ b/.github/workflows/pull-request-open.yml @@ -1,39 +1,34 @@ name: Pull Request Open - on: pull_request: - branches: [ "dev" ] - + branches: ["dev"] jobs: build: runs-on: ubuntu-22.04 + permissions: contents: read pull-requests: write steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'corretto' - - - name: Run tests - run: ./gradlew test - - - name: Build with Gradle - run: ./gradlew build - - - name: Publish Test Result - uses: EnricoMi/publish-unit-test-result-action@v1 - if: always() - with: - files: '**/build/test-results/test/TEST-*.xml' - - - name: Comment Fail Test - uses: mikepenz/action-junit-report@v3 - if: always() - with: - report_paths: '**/build/test-results/test/TEST-*.xml' - token: ${{ github.token }} + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: "17" + distribution: "corretto" + - name: Run tests + run: ./gradlew test + - name: Build with Gradle + run: ./gradlew build + - name: Publish Test Result + uses: EnricoMi/publish-unit-test-result-action@v1 + if: always() + with: + files: "**/build/test-results/test/TEST-*.xml" + - name: Comment Fail Test + uses: mikepenz/action-junit-report@v3 + if: always() + with: + report_paths: "**/build/test-results/test/TEST-*.xml" + token: ${{ github.token }} From 3ee77802f0702b6845bc0a4d2d3de735913494de Mon Sep 17 00:00:00 2001 From: Ethan Date: Mon, 20 May 2024 19:09:22 +0900 Subject: [PATCH 4/5] =?UTF-8?q?refactor:=20CI=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pull-request-open.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request-open.yml b/.github/workflows/pull-request-open.yml index db9cd3b..6fa3500 100644 --- a/.github/workflows/pull-request-open.yml +++ b/.github/workflows/pull-request-open.yml @@ -7,8 +7,9 @@ jobs: runs-on: ubuntu-22.04 permissions: - contents: read + contents: write pull-requests: write + repository-projects: write steps: - uses: actions/checkout@v4 @@ -36,4 +37,4 @@ jobs: if: always() with: report_paths: "**/build/test-results/test/TEST-*.xml" - token: ${{ github.token }} \ No newline at end of file + token: ${{ github.token }} From a3345e299683562d9cd6fda69f2d9720e2fc2de5 Mon Sep 17 00:00:00 2001 From: Ethan Date: Mon, 20 May 2024 19:11:22 +0900 Subject: [PATCH 5/5] =?UTF-8?q?refactor:=20CI=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pull-request-open.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/pull-request-open.yml b/.github/workflows/pull-request-open.yml index 6fa3500..5061101 100644 --- a/.github/workflows/pull-request-open.yml +++ b/.github/workflows/pull-request-open.yml @@ -6,10 +6,7 @@ jobs: build: runs-on: ubuntu-22.04 - permissions: - contents: write - pull-requests: write - repository-projects: write + permissions: write-all steps: - uses: actions/checkout@v4