[Bug]: Intermittent failure in PathUtilsTests.testNewDirectoryIsExcludedAndExistingChoiceIsKept

Abierto Apto para principiantes
#2,474 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
65/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
swift
Área
testing

Línea de trabajo

Lee PathUtilsTests.swift alrededor de la expectativa que falla en la línea 99 e inspecciona las lecturas y escrituras del valor del recurso de la prueba. Ejecuta repetidamente swift test --filter testNewDirectoryIsExcludedAndExistingChoiceIsKept y luego compara con ejecuciones repetidas de make test para investigar el comportamiento intermitente reportado. El objetivo es que la prueba verifique de forma fiable que la opción de copia de seguridad del directorio existente siga incluida.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Swift
Estrellas
51.1k
Forks
1.8k
Merge medio
2 d 10 h
PR fusionados (30 d)
37

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apple/container

Todos los issues de apple/container

Issues similares

Más issues de Swift

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.