Skip to content

Commit f92bd77

Browse files
committed
[tests] ManifestUtils.GetManifestWithBicep: generate in a temporary path
Avoid interfering with other tests by generating the bicep files in per-test temporyary paths. Issue: #5113
1 parent 419437d commit f92bd77

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/Aspire.Hosting.Tests/Utils/ManifestUtils.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,20 @@ public static async Task<JsonNode[]> GetManifests(IResource[] resources)
6767

6868
public static async Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource)
6969
{
70-
var manifestNode = await GetManifest(resource);
70+
string manifestDir = Directory.CreateTempSubdirectory(resource.Name).FullName;
71+
var manifestNode = await GetManifest(resource, manifestDir);
7172

7273
if (!manifestNode.AsObject().TryGetPropertyValue("path", out var pathNode))
7374
{
7475
throw new ArgumentException("Specified resource does not contain a path property.", nameof(resource));
7576
}
7677

77-
if (pathNode?.ToString() is not { } path || !File.Exists(path))
78+
if (pathNode?.ToString() is not { } path || !File.Exists(Path.Combine(manifestDir, path)))
7879
{
7980
throw new ArgumentException("Path node in resource is null, empty, or does not exist.", nameof(resource));
8081
}
8182

82-
var bicepText = await File.ReadAllTextAsync(path);
83+
var bicepText = await File.ReadAllTextAsync(Path.Combine(manifestDir, path));
8384
return (manifestNode, bicepText);
8485
}
8586
}

0 commit comments

Comments
 (0)