diff --git a/.github/workflows/frontend-app-test.yml b/.github/workflows/frontend-app-test.yml index 570893aca..320e93214 100644 --- a/.github/workflows/frontend-app-test.yml +++ b/.github/workflows/frontend-app-test.yml @@ -8,6 +8,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history to ensure all commits are accessible - uses: rwjblue/setup-volta@v1 - uses: H1D/actions-ember-testing@8ca8da615c2db5889b7fbd3834e4093706754435 - name: Install dependencies @@ -31,11 +33,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history to ensure all commits are accessible - uses: rwjblue/setup-volta@v1 - uses: H1D/actions-ember-testing@8ca8da615c2db5889b7fbd3834e4093706754435 - name: Install dependencies working-directory: ./frontend - run: yarn install + run: | + for i in {1..3}; do + yarn install && break || sleep 5; + done - uses: mydea/ember-cli-code-coverage-action@e4130abc6c57d272d9d123870c26b8c284128adc with: working-directory: ./frontend diff --git a/build.gradle.kts b/build.gradle.kts index 6bf2a44a6..4a0a22c02 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -79,7 +79,6 @@ dependencies { testImplementation("org.springframework.boot:spring-boot-starter-webflux") testImplementation("org.springframework.cloud:spring-cloud-contract-wiremock:$springCloudContractWiremockVersion") - testImplementation("org.amshove.kluent:kluent:1.68") // should be deleted after kotest move all of it testImplementation("org.jetbrains.kotlin:kotlin-test:1.3.72") // should be deleted after kotest move all of it testImplementation("io.kotest:kotest-assertions-core:$kotestAssertionsVersion") diff --git a/src/main/kotlin/com/epam/brn/service/ContributorServiceImpl.kt b/src/main/kotlin/com/epam/brn/service/ContributorServiceImpl.kt index 8ad7faf92..6008a9346 100644 --- a/src/main/kotlin/com/epam/brn/service/ContributorServiceImpl.kt +++ b/src/main/kotlin/com/epam/brn/service/ContributorServiceImpl.kt @@ -8,6 +8,7 @@ import com.epam.brn.model.Contact import com.epam.brn.model.Contributor import com.epam.brn.model.GitHubUser import com.epam.brn.repo.ContributorRepository +import org.springframework.data.repository.findByIdOrNull import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional @@ -43,8 +44,8 @@ class ContributorServiceImpl( ): ContributorResponse { val contributor = contributorRepository - .findById(id) - .orElseThrow { EntityNotFoundException("Contributor with id=$id was not found") } + .findByIdOrNull(id) + ?: throw EntityNotFoundException("Contributor with id=$id was not found") contributor.name = contributorRequest.name contributor.nameEn = contributorRequest.nameEn contributor.description = contributorRequest.description diff --git a/src/main/kotlin/com/epam/brn/service/ResourceService.kt b/src/main/kotlin/com/epam/brn/service/ResourceService.kt index 8c8dcffd6..d9538e984 100644 --- a/src/main/kotlin/com/epam/brn/service/ResourceService.kt +++ b/src/main/kotlin/com/epam/brn/service/ResourceService.kt @@ -28,7 +28,7 @@ class ResourceService( .orElse(null) fun save(resource: Resource): Resource = resourceRepository.save(resource) - + val resource = resourceRepository fun findAll(): List = resourceRepository .findAll() .iterator() diff --git a/src/main/kotlin/com/epam/brn/service/impl/RoleServiceImpl.kt b/src/main/kotlin/com/epam/brn/service/impl/RoleServiceImpl.kt index 044bdf56e..218ae4078 100644 --- a/src/main/kotlin/com/epam/brn/service/impl/RoleServiceImpl.kt +++ b/src/main/kotlin/com/epam/brn/service/impl/RoleServiceImpl.kt @@ -6,6 +6,7 @@ import com.epam.brn.exception.EntityNotFoundException import com.epam.brn.model.Role import com.epam.brn.repo.RoleRepository import com.epam.brn.service.RoleService +import org.springframework.data.repository.findByIdOrNull import org.springframework.stereotype.Service import org.springframework.web.context.request.RequestContextHolder import org.springframework.web.context.request.ServletRequestAttributes @@ -15,9 +16,8 @@ class RoleServiceImpl( private val roleRepository: RoleRepository, ) : RoleService { override fun findById(id: Long): Role = roleRepository - .findById(id) - .orElseThrow { EntityNotFoundException("Role with id = $id is not found") } - + .findByIdOrNull(id) + ?: throw EntityNotFoundException("Role with id = $id is not found") override fun findByName(name: String): Role = roleRepository .findByName(name) ?: throw EntityNotFoundException("Role with name = $name is not found") diff --git a/src/test/kotlin/com/epam/brn/integration/BaseIT.kt b/src/test/kotlin/com/epam/brn/integration/BaseIT.kt index ccec18e5a..ee79b708c 100644 --- a/src/test/kotlin/com/epam/brn/integration/BaseIT.kt +++ b/src/test/kotlin/com/epam/brn/integration/BaseIT.kt @@ -17,7 +17,6 @@ import com.epam.brn.repo.SubGroupRepository import com.epam.brn.repo.TaskRepository import com.epam.brn.repo.UserAccountRepository import com.fasterxml.jackson.databind.ObjectMapper -import org.amshove.kluent.internal.platformClassName import org.junit.jupiter.api.Tag import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc @@ -67,6 +66,8 @@ abstract class BaseIT { protected val dateFormat = DateTimeFormatter.ISO_DATE_TIME + fun platformClassName(): String = this::class.simpleName ?: "Unknown" + /** * Should delete data from repositories. * Deleting order is matter diff --git a/src/test/kotlin/com/epam/brn/service/ResourceServiceTest.kt b/src/test/kotlin/com/epam/brn/service/ResourceServiceTest.kt index 6157607d6..aaf0ef92c 100644 --- a/src/test/kotlin/com/epam/brn/service/ResourceServiceTest.kt +++ b/src/test/kotlin/com/epam/brn/service/ResourceServiceTest.kt @@ -137,7 +137,9 @@ internal class ResourceServiceTest { } // THEN - expectedErrorMessage shouldBe exception.message + exception.message shouldBe expectedErrorMessage + + // Verifica que el repositorio haya sido llamado una sola vez verify(exactly = 1) { resourceRepositoryMock.findByIdOrNull(id) } } }