Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<ScalarAspNetCoreVersion>2.9.*</ScalarAspNetCoreVersion>
<SwashbuckleVersion>9.*-*</SwashbuckleVersion>
<SystemTextJsonVersion>9.0.*</SystemTextJsonVersion>
<TestSdkVersion>17.14.*</TestSdkVersion>
<TestSdkVersion>18.0.*</TestSdkVersion>
<XunitVersion>2.9.*</XunitVersion>
<XunitVisualStudioVersion>3.1.*</XunitVisualStudioVersion>
</PropertyGroup>
Expand Down
25 changes: 20 additions & 5 deletions test/OpenApiTests/OpenApiTestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,25 @@ private static JsonElement ParseSwaggerDocument(string content)

private static async Task WriteToDiskAsync(string path, JsonElement jsonElement)
{
string directory = Path.GetDirectoryName(path)!;
Directory.CreateDirectory(directory);

string contents = jsonElement.ToString();
await File.WriteAllTextAsync(path, contents);
while (true)
{
try
{
string directory = Path.GetDirectoryName(path)!;
Directory.CreateDirectory(directory);

string contents = jsonElement.ToString();
await File.WriteAllTextAsync(path, contents);

return;
}
catch (IOException)
{
// This sometimes happens when running tests locally.
// Multi-targeted projects should not use the same output path.

await Task.Delay(TimeSpan.FromMilliseconds(50));
}
}
}
}
2 changes: 1 addition & 1 deletion tests.runsettings
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<DataCollector friendlyName="XPlat Code Coverage">
<Configuration>
<ExcludeByFile>**/test/**/*.*</ExcludeByFile>
<Exclude>[*]JsonApiDotNetCore.OpenApi.JsonApiObjects.*</Exclude>
<Exclude>[*]JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiObjects.*</Exclude>
<ExcludeByAttribute>ObsoleteAttribute,GeneratedCodeAttribute,TestSDKAutoGeneratedCode</ExcludeByAttribute>
<DeterministicReport>true</DeterministicReport>
</Configuration>
Expand Down