Skip to content

Tests in CI fail from time to time #549

@siriak

Description

@siriak

Tests in CI fail from time to time due to randomness in tests.

Logs:
Run dotnet test --no-restore --collect "XPlat Code Coverage"
Utilities -> /home/runner/work/C-Sharp/C-Sharp/Utilities/bin/Debug/net8.0/Utilities.dll
Utilities.Tests -> /home/runner/work/C-Sharp/C-Sharp/Utilities.Tests/bin/Debug/net8.0/Utilities.Tests.dll
Test run for /home/runner/work/C-Sharp/C-Sharp/Utilities.Tests/bin/Debug/net8.0/Utilities.Tests.dll (.NETCoreApp,Version=v8.0)
DataStructures -> /home/runner/work/C-Sharp/C-Sharp/DataStructures/bin/Debug/net8.0/DataStructures.dll
DataStructures.Tests -> /home/runner/work/C-Sharp/C-Sharp/DataStructures.Tests/bin/Debug/net8.0/DataStructures.Tests.dll
Test run for /home/runner/work/C-Sharp/C-Sharp/DataStructures.Tests/bin/Debug/net8.0/DataStructures.Tests.dll (.NETCoreApp,Version=v8.0)
VSTest version 17.14.1 (x64)

VSTest version 17.14.1 (x64)

Starting test execution, please wait...
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
A total of 1 test files matched the specified pattern.

Passed! - Failed: 0, Passed: 35, Skipped: 0, Total: 35, Duration: 227 ms - Utilities.Tests.dll (net8.0)
ArgumentException

ArgumentNullException

Algorithms -> /home/runner/work/C-Sharp/C-Sharp/Algorithms/bin/Debug/net8.0/Algorithms.dll
Algorithms.Tests -> /home/runner/work/C-Sharp/C-Sharp/Algorithms.Tests/bin/Debug/net8.0/Algorithms.Tests.dll
Test run for /home/runner/work/C-Sharp/C-Sharp/Algorithms.Tests/bin/Debug/net8.0/Algorithms.Tests.dll (.NETCoreApp,Version=v8.0)
VSTest version 17.14.1 (x64)

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed! - Failed: 0, Passed: 825, Skipped: 0, Total: 825, Duration: 2 s - DataStructures.Tests.dll (net8.0)
Failed Predict_TieBreaker_ReturnsConsistentLabel [20 ms]
Error Message:
Assert.That(label, Is.EqualTo("A"))
String lengths are both 1. Strings differ at index 0.
Expected: "A"
But was: "B"
-----------^

Stack Trace:
at Algorithms.Tests.MachineLearning.KNearestNeighborsTests.Predict_TieBreaker_ReturnsConsistentLabel() in /home/runner/work/C-Sharp/C-Sharp/Algorithms.Tests/MachineLearning/KNearestNeighborsTests.cs:line 84

  1. at Algorithms.Tests.MachineLearning.KNearestNeighborsTests.Predict_TieBreaker_ReturnsConsistentLabel() in /home/runner/work/C-Sharp/C-Sharp/Algorithms.Tests/MachineLearning/KNearestNeighborsTests.cs:line 84

Failed! - Failed: 1, Passed: 12208, Skipped: 0, Total: 12209, Duration: 2 m 48 s - Algorithms.Tests.dll (net8.0)

Attachments:
/home/runner/work/C-Sharp/C-Sharp/Utilities.Tests/TestResults/992dcb76-e67d-4cd2-92a5-39ce380708f8/coverage.cobertura.xml
/home/runner/work/C-Sharp/C-Sharp/DataStructures.Tests/TestResults/725d98da-661b-4869-8e7d-a4de9466374d/coverage.cobertura.xml
/home/runner/work/C-Sharp/C-Sharp/Algorithms.Tests/TestResults/10535369-7336-4238-b2a9-401511937587/coverage.cobertura.xml
Error: Process completed with exit code 1.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions