[Bug]: Intermittent failure in PathUtilsTests.testNewDirectoryIsExcludedAndExistingChoiceIsKept

オープン 初心者向け
#2,474 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
swift
領域
testing

調査の方向性

PathUtilsTests.swift の99行目にある失敗する期待値の周辺を読み、テストのリソース値の読み取りと書き込みを調べてください。swift test --filter testNewDirectoryIsExcludedAndExistingChoiceIsKept を繰り返し実行し、その後、報告された断続的な動作を調査するために make test の実行結果を繰り返し比較してください。完了条件は、既存ディレクトリのバックアップ選択肢が引き続き含まれることをテストが確実に検証することです。

索引モデルが issue の本文から書いたものです。

説明

I have done the following
  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project
Steps to reproduce

Run make test repeatedly. The failure is intermittent, and I have no reliable way to trigger it.

I saw 1 failure across about 12 test runs on working branches. PathUtils.swift and PathUtilsTests.swift are unchanged from main on that branch. The test then passed 5 times when run alone with swift test --filter testNewDirectoryIsExcludedAndExistingChoiceIsKept, and passed in the next 2 full runs.

Problem description

PathUtilsTests.testNewDirectoryIsExcludedAndExistingChoiceIsKept intermittently fails on its last expectation, which checks that an existing directory's choice to be included in backups is kept:

◇ Test testNewDirectoryIsExcludedAndExistingChoiceIsKept() started.
✘ Test testNewDirectoryIsExcludedAndExistingChoiceIsKept() recorded an issue at PathUtilsTests.swift:99:9: Expectation failed: try !Self.isExcludedFromBackup(snapshots)
↳ try !Self.isExcludedFromBackup(snapshots) → <not evaluated>
✘ Test testNewDirectoryIsExcludedAndExistingChoiceIsKept() failed after 0.015 seconds with 1 issue.
✘ Suite PathUtilsTests failed after 0.016 seconds with 1 issue.

The test reads isExcludedFromBackup as true, sets it to false through a copy of the URL, calls createDirectoryExcludingFromBackup again, and expects to read false.

A possible cause, which I have not confirmed: URL caches resource values, so the last read through snapshots could return the earlier value. If so, the fault is in the test rather than in createDirectoryExcludingFromBackup, and calling removeAllCachedResourceValues() before the read may fix it.

Environment
- OS: macOS 27.2
- Xcode: Swift 6.4 (swiftlang-6.4.0.34.1 clang-2100.3.34.1)
- Container: working branch based on main at ec82253e
- Temporary directory: on the boot volume (APFS)
Code of Conduct
  • I agree to follow this project's Code of Conduct
主要言語
Swift
スター
51k
フォーク
1.8k
平均マージ
2日 9時間
マージ済み PR(30日)
35

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apple/container のほかの issue

apple/container の issue をすべて見る

似ている issue

Swift の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。