generated from life-librarians/life-bookshelf-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated CI configuration, improved AWS S3 client for environment prof…
…iles, and Test data setup This update streamlines the CI workflow by enabling tests during build for 'prod' profile. AWS S3 client now uses the same bean for all profiles, simplifying its configuration. Multiple enhancements were made to tests, resulting in more comprehensive test coverage. In test improvements, additional unit tests were added and some existing tests were commented out using @disabled annotation. A new dummy bean was created to ignore external S3 connections during tests. Also, small changes were made to test resources to match updates in configuration. These changes improve the stability and maintainability of our CI pipeline and production environment, while ensuring this doesn't affect the local development environment and also improves the performance and reliability of our tests.
- Loading branch information
Showing
8 changed files
with
256 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package utils.bean; | ||
|
||
import com.lifelibrarians.lifebookshelf.image.domain.ObjectResourceManager; | ||
import org.springframework.boot.test.context.TestConfiguration; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
@TestConfiguration | ||
public class ExternalDependenciesIgnore { | ||
|
||
@Bean | ||
public ObjectResourceManager objectResourceManager() { | ||
return new ObjectResourceManager() { | ||
@Override | ||
public void upload(MultipartFile multipartFile, String key) { | ||
} | ||
|
||
@Override | ||
public void delete(String key) { | ||
} | ||
|
||
@Override | ||
public String getPreSignedUrl(String key) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getObjectUrl(String key) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean doesObjectExist(String key) { | ||
return true; | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/test/java/utils/testdouble/interview/TestInterviewConversationCreateRequestDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package utils.testdouble.interview; | ||
|
||
import com.lifelibrarians.lifebookshelf.interview.domain.ConversationType; | ||
import com.lifelibrarians.lifebookshelf.interview.dto.request.InterviewConversationCreateRequestDto; | ||
import com.lifelibrarians.lifebookshelf.interview.dto.request.InterviewConversationDto; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.IntStream; | ||
|
||
public class TestInterviewConversationCreateRequestDto { | ||
|
||
public static InterviewConversationCreateRequestDto createValidInterviewConversationCreateRequestDto() { | ||
return InterviewConversationCreateRequestDto.builder() | ||
.conversations(TestInterviewConversationCreateRequestDto.createValidConversations()) | ||
.build(); | ||
} | ||
|
||
public static InterviewConversationCreateRequestDto createTooManyConversationsInterviewConversationCreateRequestDto() { | ||
return InterviewConversationCreateRequestDto.builder() | ||
.conversations( | ||
TestInterviewConversationCreateRequestDto.createTooManyConversations()) | ||
.build(); | ||
} | ||
|
||
public static InterviewConversationCreateRequestDto createTooLongContentInterviewConversationCreateRequestDto() { | ||
return InterviewConversationCreateRequestDto.builder() | ||
.conversations( | ||
TestInterviewConversationCreateRequestDto.createTooLongContentConversations()) | ||
.build(); | ||
} | ||
|
||
public static List<InterviewConversationDto> createTooManyConversations() { | ||
return IntStream.range(0, 21) | ||
.mapToObj(i -> InterviewConversationDto.builder() | ||
.content("Content " + i) | ||
.conversationType(i % 2 == 0 ? ConversationType.BOT : ConversationType.HUMAN) | ||
.build()) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
public static List<InterviewConversationDto> createValidConversations() { | ||
return List.of( | ||
InterviewConversationDto.builder() | ||
.content("What is your hometown?") | ||
.conversationType(ConversationType.BOT) | ||
.build(), | ||
InterviewConversationDto.builder() | ||
.content("I was born in Seoul.") | ||
.conversationType(ConversationType.HUMAN) | ||
.build() | ||
); | ||
} | ||
|
||
|
||
public static List<InterviewConversationDto> createTooLongContentConversations() { | ||
return List.of( | ||
InterviewConversationDto.builder() | ||
.content("What is your hometown?") | ||
.conversationType(ConversationType.BOT) | ||
.build(), | ||
InterviewConversationDto.builder() | ||
.content("a".repeat(513)) | ||
.conversationType(ConversationType.HUMAN) | ||
.build() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters