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

Fix tests on Windows #2266

Merged
merged 5 commits into from May 5, 2019
Merged

Fix tests on Windows #2266

merged 5 commits into from May 5, 2019

Conversation

fd0
Copy link
Member

@fd0 fd0 commented May 5, 2019

What is the purpose of this change? What does it change?

It corrects some assumptions on Windows, so the tests will pass again. Probably the biggest change is that we're now using LastWriteTime as ctime (instead of CreationTime, which isn't updated). For older releases of restic this was not relevant since we weren't using the ctime at all, we only recently integrated checking the ctime in #2212.

If you want to follow along, please read the individual commits instead of the whole diff.

Was the change discussed in an issue or in the forum before?

#2257 (comment)

Checklist

  • I have read the Contribution Guidelines
  • I have added tests for all changes in this PR
  • I have added documentation for the changes (in the manual)
  • There's a new file in changelog/unreleased/ that describes the changes for our users (template here)
  • I have run gofmt on the code in all commits
  • All commit messages are formatted in the same style as the other commits in the repo
  • I'm done, this Pull Request is ready for review

Since I could not remember what the value for `Check` means this commit
renames it to `SameFile`: when set to true, the test should make sure
that `FileChanged` should return false (=file is unmodified).
fd0 added 3 commits May 5, 2019 14:02
Move all Archiver tests back into `archiver_test.go` and add some tiny
helpers to mock what `lstat` returns (for Windows and Unix separately).
Windows does not have a concept of a `change time` in the sense as Unix
has it: the field `CreationTime` of the `Win32FileAttributeData` struct
is not updated when attributes or content is changed. So from now on
we're using the `LastWriteTime` as the `change time` on Windows.
@codecov-io
Copy link

codecov-io commented May 5, 2019

Codecov Report

Merging #2266 into master will increase coverage by 0.12%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2266      +/-   ##
=========================================
+ Coverage   50.88%     51%   +0.12%     
=========================================
  Files         178     178              
  Lines       14536   14536              
=========================================
+ Hits         7396    7414      +18     
+ Misses       6073    6051      -22     
- Partials     1067    1071       +4
Impacted Files Coverage Δ
internal/archiver/file_saver.go 84.21% <0%> (-4.39%) ⬇️
internal/backend/b2/b2.go 80.68% <0%> (+1.13%) ⬆️
internal/checker/checker.go 70.25% <0%> (+3.66%) ⬆️
internal/archiver/blob_saver.go 100% <0%> (+4.93%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7dcd296...920d458. Read the comment docs.

@fd0 fd0 merged commit 920d458 into master May 5, 2019
fd0 added a commit that referenced this pull request May 5, 2019
@fd0 fd0 deleted the fix-windows-tests branch May 5, 2019 19:34
@fd0 fd0 mentioned this pull request May 6, 2019
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants