[Bug]: Intermittent failure in PathUtilsTests.testNewDirectoryIsExcludedAndExistingChoiceIsKept

Aperta Adatta ai principianti
#2,474 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
swift
Ambito
testing

Direzione di ricerca

Leggi PathUtilsTests.swift intorno all’aspettativa che fallisce alla riga 99 e controlla le letture e le scritture del valore della risorsa del test. Esegui ripetutamente swift test --filter testNewDirectoryIsExcludedAndExistingChoiceIsKept, poi confronta con esecuzioni ripetute di make test per indagare il comportamento intermittente segnalato. L’obiettivo è che il test verifichi in modo affidabile che la scelta di backup della directory esistente rimanga inclusa.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Swift
Stelle
51k
Fork
1.8k
Merge medio
2g 10h
PR unite (30g)
39

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apple/container

Tutte le issue di apple/container

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.