Skip to content

Commit

Permalink
Run unit tests serially to avoid threading issues in Firely packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
GinoCanessa committed Sep 5, 2024
1 parent 874cc2e commit 72a47d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Microsoft.Health.Fhir.CodeGen.Tests/GenerationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
using System.IO;
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Nodes;
using FluentAssertions;
using FluentAssertions.Json;
using Hl7.Fhir.Model;
using Microsoft.Health.Fhir.CodeGen.Language;
using Microsoft.Health.Fhir.CodeGen.Language.Firely;
Expand Down Expand Up @@ -90,10 +92,16 @@ internal static void CompareGeneration(
{
JToken expected = JToken.Parse(File.ReadAllText(existingPath));

byte[] msBytes = new byte[currentMS.Length];
currentMS.Read(msBytes).Should().NotBe(0);
// Select the token you want to remove
JToken? tokenToRemove = expected.SelectToken("info.version");
tokenToRemove?.Parent?.Remove();

JToken actual = JToken.Parse(System.Text.Encoding.UTF8.GetString(msBytes));
using StreamReader msReader = new(currentMS);
string currentString = msReader.ReadToEnd();
JToken actual = JToken.Parse(currentString);

tokenToRemove = actual.SelectToken("info.version");
tokenToRemove?.Parent?.Remove();

actual.Should().BeEquivalentTo(expected);

Expand Down
3 changes: 3 additions & 0 deletions src/Microsoft.Health.Fhir.CodeGen.Tests/xunit.runner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parallelizeTestCollections": false
}

0 comments on commit 72a47d8

Please sign in to comment.