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

Some unit tests recently started failing on Linux #784

Closed
JJ11teen opened this issue Mar 5, 2023 · 2 comments
Closed

Some unit tests recently started failing on Linux #784

JJ11teen opened this issue Mar 5, 2023 · 2 comments

Comments

@JJ11teen
Copy link
Contributor

JJ11teen commented Mar 5, 2023

As part of working on #774, I noticed that recently some unit tests unrelated to what I have been working on have started failing, most likely because I am running in a ubuntu container (and I suspect the cicd test suite is on windows?)

The test failure is quite explicit, the issue is that generated exception messages have different new line characters, depending on which OS you are on, but the expected messages check for the windows new line character explicitly (/r/n).

The full test error is:

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:02.44]     RegularObjectWorks [FAIL]
[xUnit.net 00:00:02.44]     InheritedMembersWorks [FAIL]
  Failed RegularObjectWorks [88 ms]
  Error Message:
   Assert.Equal() Failure
                      ↓ (pos 12)
Expected: Prop1: hello\r\nProp2: 1\r\n# A Description\r\nHello: "worl···
Actual:   Prop1: hello\nProp2: 1\n# A Description\nHello: "world"\n···
                      ↑ (pos 12)
  Stack Trace:
     at YamlDotNet.Test.Analyzers.StaticGenerator.ObjectTests.RegularObjectWorks() in <redacted>/YamlDotNet.Test/Analyzers/StaticGenerator/ObjectTests.cs:line 73
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
  Failed InheritedMembersWorks [3 ms]
  Error Message:
   Assert.Equal() Failure
                             ↓ (pos 19)
Expected: NotInherited: hello\r\nInherited: world\r\n
Actual:   NotInherited: hello\nInherited: world\n
                             ↑ (pos 19)
  Stack Trace:
     at YamlDotNet.Test.Analyzers.StaticGenerator.ObjectTests.InheritedMembersWorks() in <redacted>/YamlDotNet.Test/Analyzers/StaticGenerator/ObjectTests.cs:line 40
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)

Failed!  - Failed:     2, Passed:  1649, Skipped:     0, Total:  1651, Duration: 2 s - YamlDotNet.Test.dll (net7.0)
@EdwardCooke
Copy link
Collaborator

I think that is the test that I fixed about a week or 2 ago for the exact same reason. I do my builds for the static code generator package on Linux due to the huge time difference between compiling on Windows vs Linux. Can you try rebasing on master and let me know if its still broken?

Here's the commit that fixed the tests:

96e1988

@JJ11teen
Copy link
Contributor Author

Ah, yes, right you are! I must have just rebased in between those changes coming through (:

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

No branches or pull requests

2 participants