Skip to content

Add comprehensive unit tests for SMB file client with CI integration#999

Merged
SorrowBlue merged 29 commits intomainfrom
refactor/997-add-unittest-for-smb-server-connection-in-datastoragesmb-module
Dec 28, 2025
Merged

Add comprehensive unit tests for SMB file client with CI integration#999
SorrowBlue merged 29 commits intomainfrom
refactor/997-add-unittest-for-smb-server-connection-in-datastoragesmb-module

Conversation

@SorrowBlue
Copy link
Copy Markdown
Owner

@SorrowBlue SorrowBlue commented Dec 26, 2025

概要

SMB ファイル クライアント操作用のマルチプラットフォーム ユニット テストを実装し、SMB サーバーを CI パイプラインに統合します。

変更点

テスト実装

  • SmbFileClientCommonTest: 接続、ファイル操作、ストリーミングのテスト
    • エラーケースを含む接続検証
    • ファイルの存在、属性、およびリスト
    • バッファリングされたシーク可能な入力ストリーム
  • プラットフォーム固有のテスト実装: 期待/実際のパターンを使用した Android、デスクトップ、iOS バリアント
  • SmbTestGraph: Metro を使用して依存性注入のセットアップをテストする

CIワークフローの再構築

  • 分割テストワークフロー: ユニットテスト (test-unit.yml) とインストルメンテーションテスト (test-instrumentation.yml)を分離
  • SMB サーバー統合: dperson/samba テスト ユーザーと共有を含むサービス コンテナーを追加しました
  • テストデータ生成: 共有フォルダに100個のテストファイルを自動作成
  • ビルドパラメータ: SMB接続プロパティを追加しました(smbHost、、、、)smbPortsmbUsernamesmbPasswordsmbPath

ビルド構成

  • data/storage/smb/build.gradle.kts テスト用BuildConfigフィールドを追加
  • 古いプレースホルダーSmbTest.ktを削除しました

テスト範囲

// Example test validating SMB connection and file listing
@Test
fun testListFiles() = runTest {
    val client = createClient()
    val list = client.listFiles(folder)
    assertTrue(list.isNotEmpty())
    assertTrue(list.any { it.path.contains(BuildTestConfig.smbPath) })
}

テストは、すべてのターゲット プラットフォームにわたる通常パスとエラー パスをカバーします。

@SorrowBlue SorrowBlue linked an issue Dec 26, 2025 that may be closed by this pull request
@github-actions github-actions Bot added the type: ♻️refactor 「コードの内部的な改善(機能変更なし)」[Internal improvements to the code (no feature changes)] label Dec 26, 2025
@SorrowBlue
Copy link
Copy Markdown
Owner Author

@copilot
このPRのタイトルとDescriptionをいい感じにして
タイトルは英語、
Descriptionは日本語で

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 28, 2025

@SorrowBlue I've opened a new pull request, #1001, to work on those changes. Once the pull request is ready, I'll request review from you.

@SorrowBlue SorrowBlue changed the title WIP 🚧 Add unit test for SMB server connection in datastorage… Add comprehensive unit tests for SMB file client with CI integration Dec 28, 2025
@SorrowBlue SorrowBlue merged commit 07e6c44 into main Dec 28, 2025
49 of 51 checks passed
@SorrowBlue SorrowBlue deleted the refactor/997-add-unittest-for-smb-server-connection-in-datastoragesmb-module branch December 28, 2025 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: ♻️refactor 「コードの内部的な改善(機能変更なし)」[Internal improvements to the code (no feature changes)]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add UnitTest for Smb server connection in data:storage:smb module

2 participants