Skip to content

Commit

Permalink
Move test infrastructure code to sub-dir (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianEdwards authored Apr 27, 2024
1 parent 37fac08 commit a061022
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
using System.Net;
using System.Reflection;
using System.Security.Cryptography;
using Aspire.Hosting.Utils;
using IntegrationTests.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace IntegrationTests;
namespace IntegrationTests.Infrastructure;

public static partial class DistributedApplicationExtensions
{
Expand Down Expand Up @@ -75,7 +75,7 @@ public static TBuilder WithRandomVolumeNames<TBuilder>(this TBuilder builder)
{
// Named volumes that aren't shared across resources should be replaced with anonymous volumes.
// Named volumes shared by mulitple resources need to have their name randomized but kept shared across those resources.

// Find all shared volumes and make a map of their original name to a new randomized name
var allResourceNamedVolumes = builder.Resources.SelectMany(r => r.Annotations
.OfType<ContainerMountAnnotation>()
Expand Down Expand Up @@ -142,7 +142,7 @@ public static HttpClient CreateHttpClient(this DistributedApplication app, strin
.ConfigureHttpClientDefaults(configure)
.BuildServiceProvider();
var httpClientFactory = services.GetRequiredService<IHttpClientFactory>();

var httpClient = httpClientFactory.CreateClient();
httpClient.BaseAddress = app.GetEndpoint(resourceName, endpointName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace IntegrationTests;
namespace IntegrationTests.Infrastructure;

/// <summary>
/// Stores logs from <see cref="ILogger"/> instances created from <see cref="StoredLogsLoggerProvider"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Runtime.CompilerServices;
using System.Security.Cryptography;

namespace Aspire.Hosting.Utils;
namespace IntegrationTests.Infrastructure;

internal static class PasswordGenerator
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace IntegrationTests;
namespace IntegrationTests.Infrastructure;

internal static class ResourceExtensions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Collections.Concurrent;

namespace IntegrationTests;
namespace IntegrationTests.Infrastructure;

public class ResourceLogStore
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace IntegrationTests;
namespace IntegrationTests.Infrastructure;

/// <summary>
/// A background service that watches for resource start/stop notifications and logs resource state changes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Microsoft.Extensions.Logging;

namespace IntegrationTests;
namespace IntegrationTests.Infrastructure;

/// <summary>
/// A logger that stores logs in a <see cref="LoggerLogStore"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Microsoft.Extensions.Logging;

namespace IntegrationTests;
namespace IntegrationTests.Infrastructure;

/// <summary>
/// A logger provider that stores logs in an <see cref="LoggerLogStore"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.Extensions.Logging;
using Xunit.Abstractions;

namespace IntegrationTests;
namespace IntegrationTests.Infrastructure;

internal static partial class DistributedApplicationTestFactory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.Extensions.Logging;
using Xunit.Abstractions;

namespace IntegrationTests;
namespace IntegrationTests.Infrastructure;

/// <summary>
/// An <see cref="ILogger"/> that writes log messages to an <see cref="ITestOutputHelper"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.Extensions.Logging;
using Xunit.Abstractions;

namespace IntegrationTests;
namespace IntegrationTests.Infrastructure;

/// <summary>
/// An <see cref="ILoggerProvider"/> that creates <see cref="ILogger"/> instances that output to the supplied <see cref="ITestOutputHelper"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using Xunit.Abstractions;

namespace IntegrationTests;
namespace IntegrationTests.Infrastructure;

/// <summary>
/// A <see cref="TextWriter"/> that writes to an <see cref="ITestOutputHelper"/>.
Expand Down
1 change: 1 addition & 0 deletions src/IntegrationTests/WebAppTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Net;
using IntegrationTests.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Xunit.Abstractions;

Expand Down

0 comments on commit a061022

Please sign in to comment.