Skip to content

Conversation

@adamsitnik
Copy link
Member

@adamsitnik adamsitnik commented Mar 7, 2022

Let's take a look at the simple test, FileSystemEventArgs_ctor_RelativePathFromCurrentDirectoryInGivenDrive:

it was using C: as directory and foo.txt as file name and expecting, the produced path to be ".\foo.txt", while the path was of course C:\foo.txt:

Assert.Equal() Failure
↓ (pos 0)
Expected: D:\h\w\B0F409C8\w\A4D408D2\e\foo.txt
Actual:   C:\foo.txt
↑ (pos 0)

I believe that these tests are simply invalid. They were failing for me locally I and I have no idea why they were not failing for all CI runs. They were introduced quite recently in #63051

fixes #65042

@adamsitnik adamsitnik added area-System.IO test-bug Problem in test source code (most likely) labels Mar 7, 2022
@adamsitnik adamsitnik requested review from danmoseley and jozkee March 7, 2022 15:02
@ghost ghost assigned adamsitnik Mar 7, 2022
@ghost
Copy link

ghost commented Mar 7, 2022

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Issue Details

Let's take a look at the simple test, FileSystemEventArgs_ctor_RelativePathFromCurrentDirectoryInGivenDrive:

it was using C: as directory and foo.txt as file name and expecting, the produced path to be ".\foo.txt", while the path was of course C:\foo.txt:

Assert.Equal() Failure
↓ (pos 0)
Expected: D:\h\w\B0F409C8\w\A4D408D2\e\foo.txt
Actual:   C:\foo.txt
↑ (pos 0)

I believe that these tests are simply invalid. They were failing for me locally I and I have no idea why they were passing in the CI. They were introduced quite recently in #63051

fixes #65042

Author: adamsitnik
Assignees: -
Labels:

area-System.IO, test-bug

Milestone: -

@adamsitnik adamsitnik merged commit 88c2a66 into dotnet:main Mar 7, 2022
@adamsitnik adamsitnik deleted the issue65042 branch March 7, 2022 17:39
@jozkee
Copy link
Member

jozkee commented Mar 7, 2022

They were failing for me locally I and I have no idea why they were not failing for all CI runs.

The tests were assuming that the current drive will always be C:\, you are using D:\ that's why they fail locally for you and I guess not every CI leg uses a non-C drive.
Optionally to remove the tests we could get the current drive and use that instead.

Anyway, thanks for looking into this, Adam.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.IO test-bug Problem in test source code (most likely)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure System.IO.Tests.RenamedEventArgsTests.RenamedEventArgs_ctor_OldFullPath_DirectoryIsRelativePathFromCurrentDirectoryInGivenDrive

3 participants