Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#112] FileSystem, Command 모킹 구현 및 executor 테스트 환경 작성 #113

Merged
merged 3 commits into from
Jul 5, 2024

Conversation

myyrakle
Copy link
Owner

@myyrakle myyrakle commented Jul 2, 2024

resolves: #112

설명

executor 수준의 단위테스트 작성을 위한 모킹 구조 추가

@myyrakle myyrakle self-assigned this Jul 2, 2024
@myyrakle myyrakle linked an issue Jul 2, 2024 that may be closed by this pull request
Copy link

github-actions bot commented Jul 2, 2024

Pull reviewers stats

Stats of the last 14 days for rrdb:

User Total reviews Time to review Total comments
myyrakle
🥇
7
▀▀▀▀
5h 10m
1
DPS0340
🥈
4
▀▀
10h 23m
▀▀▀
6
▀▀▀▀▀▀▀▀
boxqkrtm
🥉
3
▀▀
3h 37m
0
wHoIsDReAmer
3
▀▀
3h 11m
1
3QNRpDwD
1
14h 16m
▀▀▀▀
0
⚡️ Pull request stats

@myyrakle
Copy link
Owner Author

myyrakle commented Jul 2, 2024

Total Coverage: 38.14%
🔗 Coverage View (최대 몇분 정도의 지연시간이 발생할 수 있습니다.)

@myyrakle myyrakle marked this pull request as ready for review July 4, 2024 16:05
@myyrakle myyrakle changed the title [#112] FileSystem 모킹 객체 구현 [#112] FileSystem, Command 모킹 구현 및 executor 테스트 환경 작성 Jul 4, 2024
@myyrakle
Copy link
Owner Author

myyrakle commented Jul 4, 2024

Total Coverage: 39.40%
🔗 Coverage View (최대 몇분 정도의 지연시간이 발생할 수 있습니다.)


pub struct Executor {
pub(crate) config: Arc<GlobalConfig>,
pub(crate) file_system: Arc<dyn FileSystem + Send + Sync>,
pub(crate) command_runner: Arc<dyn CommandRunner + Send + Sync>,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

유연한 테스트를 위한 모킹 인터페이스 추가


#[cfg(target_os = "linux")]
#[tokio::test]
async fn test_init_config() {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트코드

@@ -32,7 +32,8 @@ async fn main() -> Result<(), RRDBError> {

let executor = Executor::new(Arc::new(config));

executor.init().await?;
executor.init_config().await?;
executor.init_database().await?;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

쿼리랑 초기화가 좀 섞여있으니까 어지러워서 분리함

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이니셜라이저와 query executor를 분리해서 관리해야하나 하는 생각도...

@myyrakle
Copy link
Owner Author

myyrakle commented Jul 4, 2024

Total Coverage: 39.40%
🔗 Coverage View (최대 몇분 정도의 지연시간이 발생할 수 있습니다.)

Comment on lines +21 to +36

#[cfg(target_os = "linux")]
pub const SYSTEMD_DAEMON_SCRIPT: &str = r#"[Unit]
Description=RRDB

[Service]
Type=simple
Restart=on-failure
ExecStart=/usr/bin/rrdb run
RemainAfterExit=on
User=root
StandardOutput=file:/var/log/rrdb.stdout.log
StandardError=file:/var/log/rrdb.stderr.log

[Install]
WantedBy=multi-user.target"#;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macos도 비슷한 pub const 상수 만드는게 좋을까요?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

나쁘지 않죠

Copy link
Collaborator

@DPS0340 DPS0340 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿뜨

@myyrakle myyrakle merged commit 898e566 into master Jul 5, 2024
4 checks passed
DPS0340 added a commit that referenced this pull request Jul 5, 2024
DPS0340 added a commit that referenced this pull request Jul 5, 2024
DPS0340 added a commit that referenced this pull request Jul 5, 2024
DPS0340 added a commit that referenced this pull request Jul 5, 2024
DPS0340 added a commit that referenced this pull request Jul 5, 2024
DPS0340 added a commit that referenced this pull request Jul 5, 2024
DPS0340 added a commit that referenced this pull request Jul 5, 2024
DPS0340 added a commit that referenced this pull request Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[test] executor를 위한 파일시스템 모킹
2 participants