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

Test file copying preserves mtime #335

Closed
wants to merge 3 commits into from

Commits on Oct 15, 2024

  1. Test file copying preserves mtime

    Adds a test to ensure that a file copied via the AppCache feature preserves the file's original mtime. 
    
    
    In #302 I determined that as long as the files copied into the cache dir preserve the original mtime then the FIFO cache cleaning logic that we rely on is valid. This test closes out this comment that asserted we need to verify whether or not the buildpack preserved mtime when copying files #302 (comment).
    
    
    [#close 302]
    schneems committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    77fca26 View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2024

  1. Add test

    Assert that loading from cache does not over-write files.
    schneems committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    f53b4de View commit details
    Browse the repository at this point in the history
  2. Fix mtime not persisting in the cache

    I previously introduced a commit that had a test intended to prove that we were persisting the mtime of files copied into the cache to close out this comment #302 (comment). The test passed locally, but failed on CI.
    
    It appears the behavior of fs-extra with regards to mtime for copying/moving directories is system dependent. To compensate, I switched to `cp_r` which explicitly is designed to preserve mtime https://crates.io/crates/cp_r. It has ~27,000 lifetime downloads and has activity as recently as a 9 days ago. https://docs.rs/cp_r/latest/cp_r/#release-history
    
    Copying and preserving mtime is the primary reason this library exists. From the docs.rs:
    
    > Copy a directory tree, including mtimes and permissions.
    
    It does not have the ability to skip-overwriting existing files which I need, however it has a generic `filter` closure which allows me to assemble this behavior myself.
    schneems committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    527d807 View commit details
    Browse the repository at this point in the history