Skip to content

Commit

Permalink
w
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenWeatherford committed Jan 24, 2025
1 parent 8d3b174 commit af65f40
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Bicep.Core.UnitTests.Assertions;
using Bicep.Core.UnitTests.Utils;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using static Bicep.Core.UnitTests.Utils.RegistryTestHelper;
using static Bicep.Core.UnitTests.Utils.RegistryHelper;

namespace Bicep.Core.IntegrationTests.Extensibility;

Expand All @@ -16,7 +16,7 @@ public class RadiusCompatibilityTests
{
private static ServiceBuilder GetServiceBuilder(IFileSystem fileSystem, string registryHost, string repositoryPath)
{
var clientFactory = RegistryTestHelper.CreateMockRegistryClient(new RepoDescriptor(registryHost, repositoryPath, ["tag"]));
var clientFactory = RegistryHelper.CreateMockRegistryClient(new RepoDescriptor(registryHost, repositoryPath, ["tag"]));

return new ServiceBuilder()
.WithFeatureOverrides(new(ExtensibilityEnabled: true))
Expand All @@ -32,7 +32,7 @@ private static async Task<ServiceBuilder> GetServicesWithPrepublishedTypes()
var services = GetServiceBuilder(new MockFileSystem(), registry, repository);

var tgzData = ThirdPartyTypeHelper.GetMockRadiusTypesTgz();
await RegistryTestHelper.PublishExtensionToRegistryAsync(services.Build(), $"br:{registry}/{repository}:1.0.0", tgzData);
await RegistryHelper.PublishExtensionToRegistryAsync(services.Build(), $"br:{registry}/{repository}:1.0.0", tgzData);

return services;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Bicep.Core.IntegrationTests/ExtensionRegistryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public async Task Extensions_published_to_a_registry_can_be_compiled()

var services = ExtensionTestHelper.GetServiceBuilder(fileSystem, registry, repository, AllFeaturesEnabled);

await RegistryTestHelper.PublishExtensionToRegistryAsync(services.Build(), "/types/index.json", $"br:{registry}/{repository}:1.2.3");
await RegistryHelper.PublishExtensionToRegistryAsync(services.Build(), "/types/index.json", $"br:{registry}/{repository}:1.2.3");

var result = await CompilationHelper.RestoreAndCompile(services, """
extension 'br:example.azurecr.io/test/extension/http:1.2.3'
Expand Down Expand Up @@ -86,7 +86,7 @@ public async Task Extensions_published_to_filesystem_can_be_compiled()
Directory.CreateDirectory(tempDirectory);

var extensionPath = Path.Combine(tempDirectory, "extension.tgz");
await RegistryTestHelper.PublishExtensionToRegistryAsync(services.Build(), Path.Combine(tempDirectory, extensionPath), typesTgz);
await RegistryHelper.PublishExtensionToRegistryAsync(services.Build(), Path.Combine(tempDirectory, extensionPath), typesTgz);

var bicepPath = Path.Combine(tempDirectory, "main.bicep");
await File.WriteAllTextAsync(bicepPath, """
Expand Down Expand Up @@ -256,7 +256,7 @@ public async Task Third_party_namespace_errors_with_configuration()

var services = ExtensionTestHelper.GetServiceBuilder(fileSystem, registry, repository, AllFeaturesEnabled);

await RegistryTestHelper.PublishExtensionToRegistryAsync(services.Build(), "/types/index.json", $"br:{registry}/{repository}:1.2.3");
await RegistryHelper.PublishExtensionToRegistryAsync(services.Build(), "/types/index.json", $"br:{registry}/{repository}:1.2.3");

var result = await CompilationHelper.RestoreAndCompile(services, """
extension 'br:example.azurecr.io/test/extension/http:1.2.3' with {}
Expand Down Expand Up @@ -337,7 +337,7 @@ public async Task Third_party_imports_are_enabled_when_feature_is_enabled()

var services = ExtensionTestHelper.GetServiceBuilder(fileSystem, registry, repository, AllFeaturesEnabled);

await RegistryTestHelper.PublishExtensionToRegistryAsync(services.Build(), "/types/index.json", $"br:{registry}/{repository}:1.2.3");
await RegistryHelper.PublishExtensionToRegistryAsync(services.Build(), "/types/index.json", $"br:{registry}/{repository}:1.2.3");

var result = await CompilationHelper.RestoreAndCompile(services, @$"
extension 'br:example.azurecr.io/test/extension/http:1.2.3'
Expand Down
4 changes: 2 additions & 2 deletions src/Bicep.Core.IntegrationTests/ProviderImportTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ private async Task<ServiceBuilder> GetServices()

var services = new ServiceBuilder()
.WithFeatureOverrides(new(ExtensibilityEnabled: true))
.WithContainerRegistryClientFactory(RegistryTestHelper.CreateOciClientForAzExtension())
.WithContainerRegistryClientFactory(RegistryHelper.CreateOciClientForAzExtension())
.WithMockFileSystem(fileSystem)
.WithAzResourceTypeLoader(azTypeLoaderLazy.Value);

await RegistryTestHelper.PublishAzExtension(services.Build(), "/types/index.json");
await RegistryHelper.PublishAzExtension(services.Build(), "/types/index.json");

return services;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public class PrivateAcrModuleMetadataProviderTests //asdfg2
public async Task TryGetModulesAsync()
{
FakeContainerRegistryClient containerRegistryClient = new();
var clientFactory = await RegistryTestHelper.CreateMockRegistryClientWithPublishedModulesAsync(
var clientFactory = await RegistryHelper.CreateMockRegistryClientWithPublishedModulesAsync(
new MockFileSystem(),
containerRegistryClient,
[
Expand All @@ -252,7 +252,7 @@ public async Task TryGetModulesAsync()
public async Task GetCachedModules()
{
var containerClient = new FakeContainerRegistryClient();
var clientFactory = await RegistryTestHelper.CreateMockRegistryClientWithPublishedModulesAsync(
var clientFactory = await RegistryHelper.CreateMockRegistryClientWithPublishedModulesAsync(
new MockFileSystem(),
containerClient,
[
Expand All @@ -279,7 +279,7 @@ public async Task GetCachedModules()
public async Task TryGetModulesAsync_ShouldCacheResult()
{
var containerClient = new FakeContainerRegistryClient();
var clientFactory = await RegistryTestHelper.CreateMockRegistryClientWithPublishedModulesAsync(
var clientFactory = await RegistryHelper.CreateMockRegistryClientWithPublishedModulesAsync(
new MockFileSystem(),
containerClient,
[
Expand All @@ -305,7 +305,7 @@ public async Task TryGetModulesAsync_ShouldCacheResult()
public async Task GetDetails()
{
var containerClient = new FakeContainerRegistryClient();
var clientFactory = await RegistryTestHelper.CreateMockRegistryClientWithPublishedModulesAsync(
var clientFactory = await RegistryHelper.CreateMockRegistryClientWithPublishedModulesAsync(
new MockFileSystem(),
containerClient,
[
Expand Down
4 changes: 2 additions & 2 deletions src/Bicep.Core.UnitTests/Utils/ExtensionTestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static ServiceBuilder GetServiceBuilder(
string repositoryPath,
FeatureProviderOverrides featureOverrides)
{
var clientFactory = RegistryTestHelper.CreateMockRegistryClient(new(registryHost, repositoryPath, ["tag"]));
var clientFactory = RegistryHelper.CreateMockRegistryClient(new(registryHost, repositoryPath, ["tag"]));

return new ServiceBuilder()
.WithFeatureOverrides(featureOverrides)
Expand All @@ -36,7 +36,7 @@ public static async Task<ServiceBuilder> GetServiceBuilderWithPublishedExtension
fileSystem ??= new MockFileSystem();
var services = GetServiceBuilder(fileSystem, reference.Registry, reference.Repository, features);

await RegistryTestHelper.PublishExtensionToRegistryAsync(services.Build(), reference.FullyQualifiedReference, tgzData);
await RegistryHelper.PublishExtensionToRegistryAsync(services.Build(), reference.FullyQualifiedReference, tgzData);

return services;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

namespace Bicep.Core.UnitTests.Utils;

public static class RegistryTestHelper //asdfg turn into an instance class?
public static class RegistryHelper
{
public record class RepoDescriptor(
string Registry, // e.g. "registry.contoso.io"
Expand Down

0 comments on commit af65f40

Please sign in to comment.