Skip to content

Run folder tests in temporary directories #5110

Closed

Description

@imsodin

TestRecvOnlyRevertNeeds (among others) is extremely flaky, especially on the windows builder.
https://build.syncthing.net/project.html?tab=testDetails&testNameId=8662697608653222476&projectId=Syncthing&buildTypeId=Syncthing_BuildWindows

The error is

[TestRecvOnlyRevertNeeds] folder_recvonly_test.go:206: mkdir _recvonly: Access is denied.

which happens in a utility function generating files for testing in _recvonly/knownDir. Multiple tests use that dir, so the failures may be due to interference between tests. If every test used its own temporary dir, this could be ruled out as a cause.

Activity

  1. added
    build
    on Aug 11, 2018
  2. calmh commented on Aug 11, 2018

    @calmh
    Member

    There is something interesting going on that we should narrow down though, because there is no known way (to me) that that dir should get bad permissions, even if a test borks in the middle, and the tests run one after the other...

  3. imsodin commented on Aug 11, 2018

    @imsodin
    MemberAuthor

    Sure, but frankly not interesting enough for me to want to spend time on (apart from that, I'd have no clue where to start looking). I initially wanted to just propose skipping it, then I saw that tests use the same directory, which in the past did mess with tests, so I figured I'd give that a shot first. And I was really frustrated by the red cross on the other PR even after multiple reruns.

  4. calmh commented on Aug 11, 2018

    @calmh
    Member

    Sure. So what appears to be happening here is that we now by default use file watching on folders, and when stopping that doesn't get shut down in time for the deferred os.Remove, and on Windows you cannot remove a folder that is being watched because It's open, or you cannot mkdir it again with the same name, or some such nonsense.

    (Which makes me wonder how this works when pulling with the file watcher running...)

  5. imsodin commented on Aug 11, 2018

    @imsodin
    MemberAuthor

    That sounds weird indeed, but shouldn't be a problem for pulling: Windows watcher (readdcw) is "natively recursive", so we only watch the folder root.

    I don't have any idea how to wait for watching to be shut down before removing the test dir (except for stupidly retrying to remove until it works or times out).

  6. calmh commented on Aug 11, 2018

    @calmh
    Member

    Ah, that explains it. Then only the folder root is "locked" in this way. Disabling the watcher on the flaky tests seems to have solved them (it's passed 10 times or so now, with your changes merged as well as those apparently tickled it somehow a little extra)

  7. added a commit that references this issue on Aug 11, 2018
    f77fae7
  8. added this to the v0.14.51 milestone on Aug 15, 2018
  9. added
    frozen-due-to-age
    on Aug 12, 2019
  10. locked and limited conversation to collaborators on Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions