Skip to content

Commit

Permalink
Try to fix restore conflict in integration tests (#16110)
Browse files Browse the repository at this point in the history
A shot in the dark to try and fix:

```
Failed ValidBicep_TemplateEmiterShouldProduceExpectedTemplate_Registry_LF [423 ms]
  Error Message:
   Expected AssertionExtensions to be empty, but found at least one item {"[BCP190 (Error)] The artifact with reference "br:mock-registry-one.invalid/demo/plan:v2" has not been restored."}.
  Stack Trace:
     at FluentAssertions.Execution.LateBoundTestFramework.Throw(String message)
   at FluentAssertions.Execution.TestFrameworkProvider.Throw(String message)
   at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
   at FluentAssertions.Execution.AssertionScope.FailWith(Func`1 failReasonFunc)
   at FluentAssertions.Execution.GivenSelector`1.FailWith(String message, Object[] args)
   at FluentAssertions.Collections.GenericCollectionAssertions`3.BeEmpty(String because, Object[] becauseArgs)
   at Bicep.Core.UnitTests.Assertions.IDiagnosticCollectionAssertions.NotHaveErrors(String because, Object[] becauseArgs) in C:\__w\1\s\bicep\src\Bicep.Core.UnitTests\Assertions\IDiagnosticCollectionExtensions.cs:line 114
   at Bicep.Core.IntegrationTests.Emit.TemplateEmitterTests.ValidBicep_TemplateEmiterShouldProduceExpectedTemplate(DataSet dataSet) in C:\__w\1\s\bicep\src\Bicep.Core.IntegrationTests\Emit\TemplateEmitterTests.cs:line 64
 ```
  • Loading branch information
anthony-c-martin authored Jan 15, 2025
1 parent 03df2a7 commit 42dbe3e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Bicep.Core.IntegrationTests/Emit/TemplateEmitterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public class TemplateEmitterTests

private async Task<Compilation> GetCompilation(DataSet dataSet, FeatureProviderOverrides features)
{
// Use a unique cache root directory for each test run to avoid conflicts
features = features with { CacheRootDirectory = FileHelper.GetCacheRootDirectory(TestContext) };

var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
var clientFactory = dataSet.CreateMockRegistryClients();
var templateSpecRepositoryFactory = dataSet.CreateMockTemplateSpecRepositoryFactory(TestContext);
Expand Down

0 comments on commit 42dbe3e

Please sign in to comment.