diff --git a/src/Aspire.Hosting.Azure.CosmosDB/Aspire.Hosting.Azure.CosmosDB.csproj b/src/Aspire.Hosting.Azure.CosmosDB/Aspire.Hosting.Azure.CosmosDB.csproj index 3561f62d29..68eab3d8ea 100644 --- a/src/Aspire.Hosting.Azure.CosmosDB/Aspire.Hosting.Azure.CosmosDB.csproj +++ b/src/Aspire.Hosting.Azure.CosmosDB/Aspire.Hosting.Azure.CosmosDB.csproj @@ -15,7 +15,6 @@ - diff --git a/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs b/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs index 6fbb1067b3..6a8b1c8298 100644 --- a/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs +++ b/src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs @@ -184,7 +184,7 @@ static CosmosClient CreateCosmosClient(string connectionString) /// A builder for the . public static IResourceBuilder WithDataVolume(this IResourceBuilder builder, string? name = null) => builder.WithEnvironment("AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE", "true") - .WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/tmp/cosmos/appdata", isReadOnly: false); + .WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/tmp/cosmos/appdata", isReadOnly: false); /// /// Configures the gateway port for the Azure Cosmos DB emulator. diff --git a/src/Aspire.Hosting.Azure.EventHubs/Aspire.Hosting.Azure.EventHubs.csproj b/src/Aspire.Hosting.Azure.EventHubs/Aspire.Hosting.Azure.EventHubs.csproj index c396206476..852f590fe3 100644 --- a/src/Aspire.Hosting.Azure.EventHubs/Aspire.Hosting.Azure.EventHubs.csproj +++ b/src/Aspire.Hosting.Azure.EventHubs/Aspire.Hosting.Azure.EventHubs.csproj @@ -12,10 +12,6 @@ 14 - - - - diff --git a/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs b/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs index 8cb4934eb1..2cf6549dd2 100644 --- a/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs +++ b/src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs @@ -268,7 +268,7 @@ public static IResourceBuilder WithDataBindMount /// The name of the volume. Defaults to an auto-generated name based on the application and resource names. /// A builder for the . public static IResourceBuilder WithDataVolume(this IResourceBuilder builder, string? name = null) - => builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/data", isReadOnly: false); + => builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/data", isReadOnly: false); /// /// Configures the gateway port for the Azure Event Hubs emulator. diff --git a/src/Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.Storage.csproj b/src/Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.Storage.csproj index b934c144be..2b1c529781 100644 --- a/src/Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.Storage.csproj +++ b/src/Aspire.Hosting.Azure.Storage/Aspire.Hosting.Azure.Storage.csproj @@ -11,11 +11,7 @@ 96 - - - - - + diff --git a/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs b/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs index d34f2f466b..dfef9e7648 100644 --- a/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs +++ b/src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs @@ -167,7 +167,7 @@ public static IResourceBuilder WithDataBindMount(t /// A flag that indicates if this is a read-only volume. /// A builder for the . public static IResourceBuilder WithDataVolume(this IResourceBuilder builder, string? name = null, bool isReadOnly = false) - => builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/data", isReadOnly); + => builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/data", isReadOnly); /// /// Modifies the host port that the storage emulator listens on for blob requests. diff --git a/src/Aspire.Hosting.Elasticsearch/Aspire.Hosting.Elasticsearch.csproj b/src/Aspire.Hosting.Elasticsearch/Aspire.Hosting.Elasticsearch.csproj index 63fdf59765..7a8673380b 100644 --- a/src/Aspire.Hosting.Elasticsearch/Aspire.Hosting.Elasticsearch.csproj +++ b/src/Aspire.Hosting.Elasticsearch/Aspire.Hosting.Elasticsearch.csproj @@ -13,7 +13,6 @@ - diff --git a/src/Aspire.Hosting.Elasticsearch/ElasticsearchBuilderExtensions.cs b/src/Aspire.Hosting.Elasticsearch/ElasticsearchBuilderExtensions.cs index 27e3ee3cf7..02b884a500 100644 --- a/src/Aspire.Hosting.Elasticsearch/ElasticsearchBuilderExtensions.cs +++ b/src/Aspire.Hosting.Elasticsearch/ElasticsearchBuilderExtensions.cs @@ -117,7 +117,7 @@ public static IResourceBuilder WithDataVolume(this IResou { ArgumentNullException.ThrowIfNull(builder); - return builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/usr/share/elasticsearch/data"); + return builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/usr/share/elasticsearch/data"); } /// diff --git a/src/Aspire.Hosting.Garnet/Aspire.Hosting.Garnet.csproj b/src/Aspire.Hosting.Garnet/Aspire.Hosting.Garnet.csproj index 2d519865be..c86cd3414e 100644 --- a/src/Aspire.Hosting.Garnet/Aspire.Hosting.Garnet.csproj +++ b/src/Aspire.Hosting.Garnet/Aspire.Hosting.Garnet.csproj @@ -14,10 +14,6 @@ 92 - - - - diff --git a/src/Aspire.Hosting.Garnet/GarnetBuilderExtensions.cs b/src/Aspire.Hosting.Garnet/GarnetBuilderExtensions.cs index 3e419819c7..89d1b5eb6e 100644 --- a/src/Aspire.Hosting.Garnet/GarnetBuilderExtensions.cs +++ b/src/Aspire.Hosting.Garnet/GarnetBuilderExtensions.cs @@ -105,7 +105,7 @@ public static IResourceBuilder WithDataVolume(this IResourceBuil { ArgumentNullException.ThrowIfNull(builder); - builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), GarnetContainerDataDirectory, + builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), GarnetContainerDataDirectory, isReadOnly); if (!isReadOnly) { diff --git a/src/Aspire.Hosting.Kafka/Aspire.Hosting.Kafka.csproj b/src/Aspire.Hosting.Kafka/Aspire.Hosting.Kafka.csproj index fb7a53c1aa..2c758bb462 100644 --- a/src/Aspire.Hosting.Kafka/Aspire.Hosting.Kafka.csproj +++ b/src/Aspire.Hosting.Kafka/Aspire.Hosting.Kafka.csproj @@ -11,12 +11,6 @@ 25 - - - - - - diff --git a/src/Aspire.Hosting.Kafka/KafkaBuilderExtensions.cs b/src/Aspire.Hosting.Kafka/KafkaBuilderExtensions.cs index 5c4dff9aa4..256682cbf4 100644 --- a/src/Aspire.Hosting.Kafka/KafkaBuilderExtensions.cs +++ b/src/Aspire.Hosting.Kafka/KafkaBuilderExtensions.cs @@ -178,7 +178,7 @@ public static IResourceBuilder WithDataVolume(this IResourc return builder .WithEnvironment(ConfigureLogDirs) - .WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), Target, isReadOnly); + .WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), Target, isReadOnly); } /// diff --git a/src/Aspire.Hosting.Keycloak/Aspire.Hosting.Keycloak.csproj b/src/Aspire.Hosting.Keycloak/Aspire.Hosting.Keycloak.csproj index 66241918be..7caeba6d97 100644 --- a/src/Aspire.Hosting.Keycloak/Aspire.Hosting.Keycloak.csproj +++ b/src/Aspire.Hosting.Keycloak/Aspire.Hosting.Keycloak.csproj @@ -11,10 +11,6 @@ 80 - - - - diff --git a/src/Aspire.Hosting.Keycloak/KeycloakResourceBuilderExtensions.cs b/src/Aspire.Hosting.Keycloak/KeycloakResourceBuilderExtensions.cs index 8696fe25cc..7363ee70c0 100644 --- a/src/Aspire.Hosting.Keycloak/KeycloakResourceBuilderExtensions.cs +++ b/src/Aspire.Hosting.Keycloak/KeycloakResourceBuilderExtensions.cs @@ -99,7 +99,7 @@ public static IResourceBuilder WithDataVolume(this IResourceBu { ArgumentNullException.ThrowIfNull(builder); - return builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/opt/keycloak/data", + return builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/opt/keycloak/data", false); } diff --git a/src/Aspire.Hosting.Milvus/Aspire.Hosting.Milvus.csproj b/src/Aspire.Hosting.Milvus/Aspire.Hosting.Milvus.csproj index 81e5c37030..51ad651575 100644 --- a/src/Aspire.Hosting.Milvus/Aspire.Hosting.Milvus.csproj +++ b/src/Aspire.Hosting.Milvus/Aspire.Hosting.Milvus.csproj @@ -18,7 +18,6 @@ - diff --git a/src/Aspire.Hosting.Milvus/MilvusBuilderExtensions.cs b/src/Aspire.Hosting.Milvus/MilvusBuilderExtensions.cs index 5a02375604..c88eeb8375 100644 --- a/src/Aspire.Hosting.Milvus/MilvusBuilderExtensions.cs +++ b/src/Aspire.Hosting.Milvus/MilvusBuilderExtensions.cs @@ -156,7 +156,7 @@ public static IResourceBuilder WithAttu(this IResourceBuilder builder, public static IResourceBuilder WithDataVolume(this IResourceBuilder builder, string? name = null, bool isReadOnly = false) { ArgumentNullException.ThrowIfNull(builder); - return builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/var/lib/milvus", isReadOnly); + return builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/var/lib/milvus", isReadOnly); } /// diff --git a/src/Aspire.Hosting.MongoDB/Aspire.Hosting.MongoDB.csproj b/src/Aspire.Hosting.MongoDB/Aspire.Hosting.MongoDB.csproj index 2558c18177..b4bca67905 100644 --- a/src/Aspire.Hosting.MongoDB/Aspire.Hosting.MongoDB.csproj +++ b/src/Aspire.Hosting.MongoDB/Aspire.Hosting.MongoDB.csproj @@ -15,7 +15,6 @@ - diff --git a/src/Aspire.Hosting.MongoDB/MongoDBBuilderExtensions.cs b/src/Aspire.Hosting.MongoDB/MongoDBBuilderExtensions.cs index f4d7539909..e6170e672f 100644 --- a/src/Aspire.Hosting.MongoDB/MongoDBBuilderExtensions.cs +++ b/src/Aspire.Hosting.MongoDB/MongoDBBuilderExtensions.cs @@ -179,7 +179,7 @@ public static IResourceBuilder WithDataVolume(this IResou { ArgumentNullException.ThrowIfNull(builder); - return builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/data/db", isReadOnly); + return builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/data/db", isReadOnly); } /// diff --git a/src/Aspire.Hosting.MySql/Aspire.Hosting.MySql.csproj b/src/Aspire.Hosting.MySql/Aspire.Hosting.MySql.csproj index f9ea708cb4..76cd66b686 100644 --- a/src/Aspire.Hosting.MySql/Aspire.Hosting.MySql.csproj +++ b/src/Aspire.Hosting.MySql/Aspire.Hosting.MySql.csproj @@ -14,7 +14,6 @@ - diff --git a/src/Aspire.Hosting.MySql/MySqlBuilderExtensions.cs b/src/Aspire.Hosting.MySql/MySqlBuilderExtensions.cs index b44c0dd6bc..fa1cfea5df 100644 --- a/src/Aspire.Hosting.MySql/MySqlBuilderExtensions.cs +++ b/src/Aspire.Hosting.MySql/MySqlBuilderExtensions.cs @@ -203,7 +203,7 @@ public static IResourceBuilder WithDataVolume(this IResourc { ArgumentNullException.ThrowIfNull(builder); - return builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/var/lib/mysql", isReadOnly); + return builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/var/lib/mysql", isReadOnly); } /// diff --git a/src/Aspire.Hosting.Nats/Aspire.Hosting.Nats.csproj b/src/Aspire.Hosting.Nats/Aspire.Hosting.Nats.csproj index a2c0ab9640..a56566f9b3 100644 --- a/src/Aspire.Hosting.Nats/Aspire.Hosting.Nats.csproj +++ b/src/Aspire.Hosting.Nats/Aspire.Hosting.Nats.csproj @@ -13,7 +13,6 @@ - diff --git a/src/Aspire.Hosting.Nats/NatsBuilderExtensions.cs b/src/Aspire.Hosting.Nats/NatsBuilderExtensions.cs index 9bb1d07da6..145ba29202 100644 --- a/src/Aspire.Hosting.Nats/NatsBuilderExtensions.cs +++ b/src/Aspire.Hosting.Nats/NatsBuilderExtensions.cs @@ -110,7 +110,7 @@ public static IResourceBuilder WithDataVolume(this IResource { ArgumentNullException.ThrowIfNull(builder); - return builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/var/lib/nats", + return builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/var/lib/nats", isReadOnly) .WithArgs("-sd", "/var/lib/nats"); } diff --git a/src/Aspire.Hosting.Oracle/Aspire.Hosting.Oracle.csproj b/src/Aspire.Hosting.Oracle/Aspire.Hosting.Oracle.csproj index 4a166988e7..be38c931b7 100644 --- a/src/Aspire.Hosting.Oracle/Aspire.Hosting.Oracle.csproj +++ b/src/Aspire.Hosting.Oracle/Aspire.Hosting.Oracle.csproj @@ -13,7 +13,6 @@ - diff --git a/src/Aspire.Hosting.Oracle/OracleDatabaseBuilderExtensions.cs b/src/Aspire.Hosting.Oracle/OracleDatabaseBuilderExtensions.cs index 4eb232e895..9fdf990488 100644 --- a/src/Aspire.Hosting.Oracle/OracleDatabaseBuilderExtensions.cs +++ b/src/Aspire.Hosting.Oracle/OracleDatabaseBuilderExtensions.cs @@ -82,7 +82,7 @@ public static IResourceBuilder AddDatabase(this IResourc /// The name of the volume. Defaults to an auto-generated name based on the application and resource names. /// The . public static IResourceBuilder WithDataVolume(this IResourceBuilder builder, string? name = null) - => builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/opt/oracle/oradata", false); + => builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/opt/oracle/oradata", false); /// /// Adds a bind mount for the data folder to a Oracle Database server container resource. diff --git a/src/Aspire.Hosting.PostgreSQL/Aspire.Hosting.PostgreSQL.csproj b/src/Aspire.Hosting.PostgreSQL/Aspire.Hosting.PostgreSQL.csproj index 5aeaa9682c..ddfe2b6113 100644 --- a/src/Aspire.Hosting.PostgreSQL/Aspire.Hosting.PostgreSQL.csproj +++ b/src/Aspire.Hosting.PostgreSQL/Aspire.Hosting.PostgreSQL.csproj @@ -14,7 +14,6 @@ - diff --git a/src/Aspire.Hosting.PostgreSQL/PostgresBuilderExtensions.cs b/src/Aspire.Hosting.PostgreSQL/PostgresBuilderExtensions.cs index e588c37c51..1ebece067c 100644 --- a/src/Aspire.Hosting.PostgreSQL/PostgresBuilderExtensions.cs +++ b/src/Aspire.Hosting.PostgreSQL/PostgresBuilderExtensions.cs @@ -357,7 +357,7 @@ public static IResourceBuilder WithDataVolume(this IReso { ArgumentNullException.ThrowIfNull(builder); - return builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), + return builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/var/lib/postgresql/data", isReadOnly); } diff --git a/src/Aspire.Hosting.Qdrant/Aspire.Hosting.Qdrant.csproj b/src/Aspire.Hosting.Qdrant/Aspire.Hosting.Qdrant.csproj index ce2929322e..27699a9b97 100644 --- a/src/Aspire.Hosting.Qdrant/Aspire.Hosting.Qdrant.csproj +++ b/src/Aspire.Hosting.Qdrant/Aspire.Hosting.Qdrant.csproj @@ -14,7 +14,6 @@ - diff --git a/src/Aspire.Hosting.Qdrant/QdrantBuilderExtensions.cs b/src/Aspire.Hosting.Qdrant/QdrantBuilderExtensions.cs index de9f5c584b..f92ca39021 100644 --- a/src/Aspire.Hosting.Qdrant/QdrantBuilderExtensions.cs +++ b/src/Aspire.Hosting.Qdrant/QdrantBuilderExtensions.cs @@ -99,7 +99,7 @@ public static IResourceBuilder WithDataVolume(this IResour { ArgumentNullException.ThrowIfNull(builder); - return builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/qdrant/storage", + return builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/qdrant/storage", isReadOnly); } diff --git a/src/Aspire.Hosting.RabbitMQ/Aspire.Hosting.RabbitMQ.csproj b/src/Aspire.Hosting.RabbitMQ/Aspire.Hosting.RabbitMQ.csproj index 6840d6544f..e505538143 100644 --- a/src/Aspire.Hosting.RabbitMQ/Aspire.Hosting.RabbitMQ.csproj +++ b/src/Aspire.Hosting.RabbitMQ/Aspire.Hosting.RabbitMQ.csproj @@ -11,10 +11,6 @@ 59 - - - - diff --git a/src/Aspire.Hosting.RabbitMQ/RabbitMQBuilderExtensions.cs b/src/Aspire.Hosting.RabbitMQ/RabbitMQBuilderExtensions.cs index 96c6c37e59..b6f9c7bbe6 100644 --- a/src/Aspire.Hosting.RabbitMQ/RabbitMQBuilderExtensions.cs +++ b/src/Aspire.Hosting.RabbitMQ/RabbitMQBuilderExtensions.cs @@ -85,7 +85,7 @@ public static IResourceBuilder WithDataVolume(this IReso { ArgumentNullException.ThrowIfNull(builder); - return builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/var/lib/rabbitmq", isReadOnly) + return builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/var/lib/rabbitmq", isReadOnly) .RunWithStableNodeName(); } diff --git a/src/Aspire.Hosting.Redis/Aspire.Hosting.Redis.csproj b/src/Aspire.Hosting.Redis/Aspire.Hosting.Redis.csproj index 0a67848cd7..0e640c2c0b 100644 --- a/src/Aspire.Hosting.Redis/Aspire.Hosting.Redis.csproj +++ b/src/Aspire.Hosting.Redis/Aspire.Hosting.Redis.csproj @@ -12,10 +12,6 @@ 90 - - - - diff --git a/src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs b/src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs index f08f348294..f3e5ff521d 100644 --- a/src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs +++ b/src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs @@ -370,7 +370,7 @@ public static IResourceBuilder WithDataVolume(this IResourceBuild { ArgumentNullException.ThrowIfNull(builder); - builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/data", isReadOnly); + builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/data", isReadOnly); if (!isReadOnly) { builder.WithPersistence(); diff --git a/src/Aspire.Hosting.Seq/Aspire.Hosting.Seq.csproj b/src/Aspire.Hosting.Seq/Aspire.Hosting.Seq.csproj index 86226702b8..4f84660205 100644 --- a/src/Aspire.Hosting.Seq/Aspire.Hosting.Seq.csproj +++ b/src/Aspire.Hosting.Seq/Aspire.Hosting.Seq.csproj @@ -12,10 +12,6 @@ 100 - - - - diff --git a/src/Aspire.Hosting.Seq/SeqBuilderExtensions.cs b/src/Aspire.Hosting.Seq/SeqBuilderExtensions.cs index 90693a1247..a6c1039989 100644 --- a/src/Aspire.Hosting.Seq/SeqBuilderExtensions.cs +++ b/src/Aspire.Hosting.Seq/SeqBuilderExtensions.cs @@ -48,7 +48,7 @@ public static IResourceBuilder AddSeq( /// A flag that indicates if this is a read-only volume. /// The . public static IResourceBuilder WithDataVolume(this IResourceBuilder builder, string? name = null, bool isReadOnly = false) - => builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), SeqContainerDataDirectory, isReadOnly); + => builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), SeqContainerDataDirectory, isReadOnly); /// /// Adds a bind mount for the data folder to a Seq container resource. diff --git a/src/Aspire.Hosting.SqlServer/Aspire.Hosting.SqlServer.csproj b/src/Aspire.Hosting.SqlServer/Aspire.Hosting.SqlServer.csproj index 0869f8378c..644b7e8802 100644 --- a/src/Aspire.Hosting.SqlServer/Aspire.Hosting.SqlServer.csproj +++ b/src/Aspire.Hosting.SqlServer/Aspire.Hosting.SqlServer.csproj @@ -14,7 +14,6 @@ - diff --git a/src/Aspire.Hosting.SqlServer/SqlServerBuilderExtensions.cs b/src/Aspire.Hosting.SqlServer/SqlServerBuilderExtensions.cs index 562db549d0..ce52227cd1 100644 --- a/src/Aspire.Hosting.SqlServer/SqlServerBuilderExtensions.cs +++ b/src/Aspire.Hosting.SqlServer/SqlServerBuilderExtensions.cs @@ -91,7 +91,7 @@ public static IResourceBuilder WithDataVolume(this IRes { ArgumentNullException.ThrowIfNull(builder); - return builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), "/var/opt/mssql", isReadOnly); + return builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), "/var/opt/mssql", isReadOnly); } /// diff --git a/src/Aspire.Hosting.Valkey/Aspire.Hosting.Valkey.csproj b/src/Aspire.Hosting.Valkey/Aspire.Hosting.Valkey.csproj index 751d885526..8614cd03b2 100644 --- a/src/Aspire.Hosting.Valkey/Aspire.Hosting.Valkey.csproj +++ b/src/Aspire.Hosting.Valkey/Aspire.Hosting.Valkey.csproj @@ -13,10 +13,6 @@ 92 - - - - diff --git a/src/Aspire.Hosting.Valkey/ValkeyBuilderExtensions.cs b/src/Aspire.Hosting.Valkey/ValkeyBuilderExtensions.cs index 870f2d58dc..8b11fd5b00 100644 --- a/src/Aspire.Hosting.Valkey/ValkeyBuilderExtensions.cs +++ b/src/Aspire.Hosting.Valkey/ValkeyBuilderExtensions.cs @@ -102,7 +102,7 @@ public static IResourceBuilder AddValkey(this IDistributedApplic public static IResourceBuilder WithDataVolume(this IResourceBuilder builder, string? name = null, bool isReadOnly = false) { - builder.WithVolume(name ?? VolumeNameGenerator.CreateVolumeName(builder, "data"), ValkeyContainerDataDirectory, + builder.WithVolume(name ?? VolumeNameGenerator.Generate(builder, "data"), ValkeyContainerDataDirectory, isReadOnly); if (!isReadOnly) { diff --git a/src/Aspire.Hosting/Aspire.Hosting.csproj b/src/Aspire.Hosting/Aspire.Hosting.csproj index c77a4c6c2a..431c998c39 100644 --- a/src/Aspire.Hosting/Aspire.Hosting.csproj +++ b/src/Aspire.Hosting/Aspire.Hosting.csproj @@ -27,7 +27,6 @@ - diff --git a/src/Aspire.Hosting/PublicAPI.Unshipped.txt b/src/Aspire.Hosting/PublicAPI.Unshipped.txt index 1207d8eeae..285a3168b4 100644 --- a/src/Aspire.Hosting/PublicAPI.Unshipped.txt +++ b/src/Aspire.Hosting/PublicAPI.Unshipped.txt @@ -211,6 +211,7 @@ Aspire.Hosting.LaunchSettings Aspire.Hosting.LaunchSettings.LaunchSettings() -> void Aspire.Hosting.LaunchSettings.Profiles.get -> System.Collections.Generic.Dictionary! Aspire.Hosting.LaunchSettings.Profiles.set -> void +Aspire.Hosting.Utils.VolumeNameGenerator static Aspire.Hosting.ApplicationModel.CommandResults.Success() -> Aspire.Hosting.ApplicationModel.ExecuteCommandResult! static Aspire.Hosting.ApplicationModel.ResourceExtensions.GetEnvironmentVariableValuesAsync(this Aspire.Hosting.ApplicationModel.IResourceWithEnvironment! resource, Aspire.Hosting.DistributedApplicationOperation applicationOperation = Aspire.Hosting.DistributedApplicationOperation.Run) -> System.Threading.Tasks.ValueTask!> Aspire.Hosting.ApplicationModel.ResourceNotificationService.WaitForResourceAsync(string! resourceName, string? targetState = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! @@ -238,6 +239,7 @@ static Aspire.Hosting.ResourceBuilderExtensions.WithCommand(this Aspire.Hosti static Aspire.Hosting.ResourceBuilderExtensions.WithHealthCheck(this Aspire.Hosting.ApplicationModel.IResourceBuilder! builder, string! key) -> Aspire.Hosting.ApplicationModel.IResourceBuilder! static Aspire.Hosting.ResourceBuilderExtensions.WithHttpHealthCheck(this Aspire.Hosting.ApplicationModel.IResourceBuilder! builder, string? path = null, int? statusCode = null, string? endpointName = null) -> Aspire.Hosting.ApplicationModel.IResourceBuilder! static Aspire.Hosting.ResourceBuilderExtensions.WithHttpsHealthCheck(this Aspire.Hosting.ApplicationModel.IResourceBuilder! builder, string? path = null, int? statusCode = null, string? endpointName = null) -> Aspire.Hosting.ApplicationModel.IResourceBuilder! +static Aspire.Hosting.Utils.VolumeNameGenerator.Generate(Aspire.Hosting.ApplicationModel.IResourceBuilder! builder, string! suffix) -> string! static readonly Aspire.Hosting.ApplicationModel.KnownResourceStates.Exited -> string! static readonly Aspire.Hosting.ApplicationModel.KnownResourceStates.FailedToStart -> string! static readonly Aspire.Hosting.ApplicationModel.KnownResourceStates.Finished -> string! diff --git a/src/Shared/VolumeNameGenerator.cs b/src/Aspire.Hosting/Utils/VolumeNameGenerator.cs similarity index 71% rename from src/Shared/VolumeNameGenerator.cs rename to src/Aspire.Hosting/Utils/VolumeNameGenerator.cs index adefee3cf8..b1e19464af 100644 --- a/src/Shared/VolumeNameGenerator.cs +++ b/src/Aspire.Hosting/Utils/VolumeNameGenerator.cs @@ -5,16 +5,26 @@ namespace Aspire.Hosting.Utils; -internal static class VolumeNameGenerator +/// +/// Utility class for generating volume names. +/// +public static class VolumeNameGenerator { - public static string CreateVolumeName(IResourceBuilder builder, string suffix) where T : IResource + /// + /// Generates a volume name with the form {applicationName}-{sha256 of apphost path}-{resourceName}-{suffix}, e.g. myapplication-a345f2451-postgres-data. + /// + /// The resource type. + /// The resource builder. + /// The suffix to append to the volume name. + /// The volume name. + /// + public static string Generate(IResourceBuilder builder, string suffix) where T : IResource { if (!HasOnlyValidChars(suffix)) { - throw new ArgumentException($"The suffix '{suffix}' contains invalid characters. Only [a-zA-Z0-9_.-] are allowed.", nameof(suffix)); + throw new ArgumentException($"The suffix '{suffix}' contains invalid characters. It must match [a-zA-Z0-9][a-zA-Z0-9_.-]*.", nameof(suffix)); } - // Creates a volume name with the form < c > $"{applicationName}-{sha256 of apphost path}-{resourceName}-{suffix}, e.g. "myapplication-a345f2451-postgres-data". // Create volume name like "{Sanitize(appname).Lower()}-{sha256.Lower()}-postgres-data" // Compute a short hash of the content root path to differentiate between multiple AppHost projects with similar volume names @@ -24,7 +34,7 @@ public static string CreateVolumeName(IResourceBuilder builder, string suf return $"{safeApplicationName}-{applicationHash}-{resourceName}-{suffix}"; } - public static string Sanitize(string name) + internal static string Sanitize(string name) { return string.Create(name.Length, name, static (s, name) => { diff --git a/tests/Aspire.Hosting.Azure.Tests/AzureCosmosDBEmulatorFunctionalTests.cs b/tests/Aspire.Hosting.Azure.Tests/AzureCosmosDBEmulatorFunctionalTests.cs index eae1d8c5b2..de5199ebac 100644 --- a/tests/Aspire.Hosting.Azure.Tests/AzureCosmosDBEmulatorFunctionalTests.cs +++ b/tests/Aspire.Hosting.Azure.Tests/AzureCosmosDBEmulatorFunctionalTests.cs @@ -142,7 +142,7 @@ public async Task WithDataVolumeShouldPersistStateBetweenUsages() var cosmos1 = builder1.AddAzureCosmosDB("cosmos"); // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - var volumeName = VolumeNameGenerator.CreateVolumeName(cosmos1, nameof(WithDataVolumeShouldPersistStateBetweenUsages)); + var volumeName = VolumeNameGenerator.Generate(cosmos1, nameof(WithDataVolumeShouldPersistStateBetweenUsages)); var db1 = cosmos1.AddDatabase(databaseName) .RunAsEmulator(emulator => emulator.WithDataVolume(volumeName)); diff --git a/tests/Aspire.Hosting.Elasticsearch.Tests/ElasticsearchFunctionalTests.cs b/tests/Aspire.Hosting.Elasticsearch.Tests/ElasticsearchFunctionalTests.cs index fd0f38b7e8..fca3e81942 100644 --- a/tests/Aspire.Hosting.Elasticsearch.Tests/ElasticsearchFunctionalTests.cs +++ b/tests/Aspire.Hosting.Elasticsearch.Tests/ElasticsearchFunctionalTests.cs @@ -87,7 +87,7 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume) if (useVolume) { // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - volumeName = VolumeNameGenerator.CreateVolumeName(elasticsearch1, nameof(WithDataShouldPersistStateBetweenUsages)); + volumeName = VolumeNameGenerator.Generate(elasticsearch1, nameof(WithDataShouldPersistStateBetweenUsages)); // if the volume already exists (because of a crashing previous run), delete it DockerUtils.AttemptDeleteDockerVolume(volumeName, throwOnFailure: true); diff --git a/tests/Aspire.Hosting.Garnet.Tests/Aspire.Hosting.Garnet.Tests.csproj b/tests/Aspire.Hosting.Garnet.Tests/Aspire.Hosting.Garnet.Tests.csproj index 3b8be43549..0ee73d4b90 100644 --- a/tests/Aspire.Hosting.Garnet.Tests/Aspire.Hosting.Garnet.Tests.csproj +++ b/tests/Aspire.Hosting.Garnet.Tests/Aspire.Hosting.Garnet.Tests.csproj @@ -15,7 +15,6 @@ - diff --git a/tests/Aspire.Hosting.Garnet.Tests/GarnetFunctionalTests.cs b/tests/Aspire.Hosting.Garnet.Tests/GarnetFunctionalTests.cs index b796438ff5..9d0a679747 100644 --- a/tests/Aspire.Hosting.Garnet.Tests/GarnetFunctionalTests.cs +++ b/tests/Aspire.Hosting.Garnet.Tests/GarnetFunctionalTests.cs @@ -119,7 +119,7 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume) if (useVolume) { // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - volumeName = VolumeNameGenerator.CreateVolumeName(garnet1, nameof(WithDataShouldPersistStateBetweenUsages)); + volumeName = VolumeNameGenerator.Generate(garnet1, nameof(WithDataShouldPersistStateBetweenUsages)); // if the volume already exists (because of a crashing previous run), try to delete it DockerUtils.AttemptDeleteDockerVolume(volumeName); diff --git a/tests/Aspire.Hosting.Kafka.Tests/Aspire.Hosting.Kafka.Tests.csproj b/tests/Aspire.Hosting.Kafka.Tests/Aspire.Hosting.Kafka.Tests.csproj index 72b4c7c5fa..6a2636a474 100644 --- a/tests/Aspire.Hosting.Kafka.Tests/Aspire.Hosting.Kafka.Tests.csproj +++ b/tests/Aspire.Hosting.Kafka.Tests/Aspire.Hosting.Kafka.Tests.csproj @@ -12,7 +12,6 @@ - diff --git a/tests/Aspire.Hosting.Kafka.Tests/KafkaFunctionalTests.cs b/tests/Aspire.Hosting.Kafka.Tests/KafkaFunctionalTests.cs index dcb94c5c65..2792d599e9 100644 --- a/tests/Aspire.Hosting.Kafka.Tests/KafkaFunctionalTests.cs +++ b/tests/Aspire.Hosting.Kafka.Tests/KafkaFunctionalTests.cs @@ -130,7 +130,7 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume) if (useVolume) { // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - volumeName = VolumeNameGenerator.CreateVolumeName(kafka1, nameof(WithDataShouldPersistStateBetweenUsages)); + volumeName = VolumeNameGenerator.Generate(kafka1, nameof(WithDataShouldPersistStateBetweenUsages)); // if the volume already exists (because of a crashing previous run), delete it DockerUtils.AttemptDeleteDockerVolume(volumeName, throwOnFailure: true); diff --git a/tests/Aspire.Hosting.Milvus.Tests/MilvusFunctionalTests.cs b/tests/Aspire.Hosting.Milvus.Tests/MilvusFunctionalTests.cs index fb404a8023..115883aa57 100644 --- a/tests/Aspire.Hosting.Milvus.Tests/MilvusFunctionalTests.cs +++ b/tests/Aspire.Hosting.Milvus.Tests/MilvusFunctionalTests.cs @@ -85,7 +85,7 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume) if (useVolume) { // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - volumeName = VolumeNameGenerator.CreateVolumeName(milvus1, nameof(WithDataShouldPersistStateBetweenUsages)); + volumeName = VolumeNameGenerator.Generate(milvus1, nameof(WithDataShouldPersistStateBetweenUsages)); // if the volume already exists (because of a crashing previous run), delete it DockerUtils.AttemptDeleteDockerVolume(volumeName, throwOnFailure: true); diff --git a/tests/Aspire.Hosting.MongoDB.Tests/Aspire.Hosting.MongoDB.Tests.csproj b/tests/Aspire.Hosting.MongoDB.Tests/Aspire.Hosting.MongoDB.Tests.csproj index 453ed447f6..ff78511994 100644 --- a/tests/Aspire.Hosting.MongoDB.Tests/Aspire.Hosting.MongoDB.Tests.csproj +++ b/tests/Aspire.Hosting.MongoDB.Tests/Aspire.Hosting.MongoDB.Tests.csproj @@ -14,7 +14,6 @@ - diff --git a/tests/Aspire.Hosting.MongoDB.Tests/MongoDbFunctionalTests.cs b/tests/Aspire.Hosting.MongoDB.Tests/MongoDbFunctionalTests.cs index 4f29fddf9a..5680a2e57a 100644 --- a/tests/Aspire.Hosting.MongoDB.Tests/MongoDbFunctionalTests.cs +++ b/tests/Aspire.Hosting.MongoDB.Tests/MongoDbFunctionalTests.cs @@ -127,7 +127,7 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume) if (useVolume) { // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - volumeName = VolumeNameGenerator.CreateVolumeName(mongodb1, nameof(WithDataShouldPersistStateBetweenUsages)); + volumeName = VolumeNameGenerator.Generate(mongodb1, nameof(WithDataShouldPersistStateBetweenUsages)); // if the volume already exists (because of a crashing previous run), delete it DockerUtils.AttemptDeleteDockerVolume(volumeName, throwOnFailure: true); diff --git a/tests/Aspire.Hosting.MySql.Tests/MySqlFunctionalTests.cs b/tests/Aspire.Hosting.MySql.Tests/MySqlFunctionalTests.cs index ff05bc5740..778b3cb1be 100644 --- a/tests/Aspire.Hosting.MySql.Tests/MySqlFunctionalTests.cs +++ b/tests/Aspire.Hosting.MySql.Tests/MySqlFunctionalTests.cs @@ -139,7 +139,7 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume) if (useVolume) { // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - volumeName = VolumeNameGenerator.CreateVolumeName(mysql1, nameof(WithDataShouldPersistStateBetweenUsages)); + volumeName = VolumeNameGenerator.Generate(mysql1, nameof(WithDataShouldPersistStateBetweenUsages)); // if the volume already exists (because of a crashing previous run), delete it DockerUtils.AttemptDeleteDockerVolume(volumeName, throwOnFailure: true); diff --git a/tests/Aspire.Hosting.Nats.Tests/Aspire.Hosting.Nats.Tests.csproj b/tests/Aspire.Hosting.Nats.Tests/Aspire.Hosting.Nats.Tests.csproj index fa137269e4..497bfc379e 100644 --- a/tests/Aspire.Hosting.Nats.Tests/Aspire.Hosting.Nats.Tests.csproj +++ b/tests/Aspire.Hosting.Nats.Tests/Aspire.Hosting.Nats.Tests.csproj @@ -13,7 +13,6 @@ - diff --git a/tests/Aspire.Hosting.Nats.Tests/NatsFunctionalTests.cs b/tests/Aspire.Hosting.Nats.Tests/NatsFunctionalTests.cs index 723d29ab70..2be2da97be 100644 --- a/tests/Aspire.Hosting.Nats.Tests/NatsFunctionalTests.cs +++ b/tests/Aspire.Hosting.Nats.Tests/NatsFunctionalTests.cs @@ -75,7 +75,7 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume) if (useVolume) { // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - volumeName = VolumeNameGenerator.CreateVolumeName(nats1, nameof(WithDataShouldPersistStateBetweenUsages)); + volumeName = VolumeNameGenerator.Generate(nats1, nameof(WithDataShouldPersistStateBetweenUsages)); // if the volume already exists (because of a crashing previous run), delete it DockerUtils.AttemptDeleteDockerVolume(volumeName, throwOnFailure: true); diff --git a/tests/Aspire.Hosting.Oracle.Tests/Aspire.Hosting.Oracle.Tests.csproj b/tests/Aspire.Hosting.Oracle.Tests/Aspire.Hosting.Oracle.Tests.csproj index 0a2b0195f8..0dc6946294 100644 --- a/tests/Aspire.Hosting.Oracle.Tests/Aspire.Hosting.Oracle.Tests.csproj +++ b/tests/Aspire.Hosting.Oracle.Tests/Aspire.Hosting.Oracle.Tests.csproj @@ -13,7 +13,6 @@ - diff --git a/tests/Aspire.Hosting.Oracle.Tests/OracleFunctionalTests.cs b/tests/Aspire.Hosting.Oracle.Tests/OracleFunctionalTests.cs index 579f5df30b..d59a1a5eb2 100644 --- a/tests/Aspire.Hosting.Oracle.Tests/OracleFunctionalTests.cs +++ b/tests/Aspire.Hosting.Oracle.Tests/OracleFunctionalTests.cs @@ -103,7 +103,7 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume) if (useVolume) { // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - volumeName = VolumeNameGenerator.CreateVolumeName(oracle1, nameof(WithDataShouldPersistStateBetweenUsages)); + volumeName = VolumeNameGenerator.Generate(oracle1, nameof(WithDataShouldPersistStateBetweenUsages)); // If the volume already exists (because of a crashing previous run), try to delete it DockerUtils.AttemptDeleteDockerVolume(volumeName, throwOnFailure: true); diff --git a/tests/Aspire.Hosting.PostgreSQL.Tests/PostgresFunctionalTests.cs b/tests/Aspire.Hosting.PostgreSQL.Tests/PostgresFunctionalTests.cs index 31554f2465..983c0eeb90 100644 --- a/tests/Aspire.Hosting.PostgreSQL.Tests/PostgresFunctionalTests.cs +++ b/tests/Aspire.Hosting.PostgreSQL.Tests/PostgresFunctionalTests.cs @@ -214,7 +214,7 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume) if (useVolume) { // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - volumeName = VolumeNameGenerator.CreateVolumeName(postgres1, nameof(WithDataShouldPersistStateBetweenUsages)); + volumeName = VolumeNameGenerator.Generate(postgres1, nameof(WithDataShouldPersistStateBetweenUsages)); // if the volume already exists (because of a crashing previous run), delete it DockerUtils.AttemptDeleteDockerVolume(volumeName, throwOnFailure: true); diff --git a/tests/Aspire.Hosting.Qdrant.Tests/Aspire.Hosting.Qdrant.Tests.csproj b/tests/Aspire.Hosting.Qdrant.Tests/Aspire.Hosting.Qdrant.Tests.csproj index 80c29342bb..aa5a474f2d 100644 --- a/tests/Aspire.Hosting.Qdrant.Tests/Aspire.Hosting.Qdrant.Tests.csproj +++ b/tests/Aspire.Hosting.Qdrant.Tests/Aspire.Hosting.Qdrant.Tests.csproj @@ -13,7 +13,6 @@ - diff --git a/tests/Aspire.Hosting.Qdrant.Tests/QdrantFunctionalTests.cs b/tests/Aspire.Hosting.Qdrant.Tests/QdrantFunctionalTests.cs index 4d2f3df823..3573281e04 100644 --- a/tests/Aspire.Hosting.Qdrant.Tests/QdrantFunctionalTests.cs +++ b/tests/Aspire.Hosting.Qdrant.Tests/QdrantFunctionalTests.cs @@ -106,7 +106,7 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume) if (useVolume) { // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - volumeName = VolumeNameGenerator.CreateVolumeName(qdrant1, nameof(WithDataShouldPersistStateBetweenUsages)); + volumeName = VolumeNameGenerator.Generate(qdrant1, nameof(WithDataShouldPersistStateBetweenUsages)); // if the volume already exists (because of a crashing previous run), delete it DockerUtils.AttemptDeleteDockerVolume(volumeName, throwOnFailure: true); diff --git a/tests/Aspire.Hosting.RabbitMQ.Tests/Aspire.Hosting.RabbitMQ.Tests.csproj b/tests/Aspire.Hosting.RabbitMQ.Tests/Aspire.Hosting.RabbitMQ.Tests.csproj index 6e9e545e05..a8c80929d4 100644 --- a/tests/Aspire.Hosting.RabbitMQ.Tests/Aspire.Hosting.RabbitMQ.Tests.csproj +++ b/tests/Aspire.Hosting.RabbitMQ.Tests/Aspire.Hosting.RabbitMQ.Tests.csproj @@ -13,7 +13,6 @@ - diff --git a/tests/Aspire.Hosting.RabbitMQ.Tests/RabbitMQFunctionalTests.cs b/tests/Aspire.Hosting.RabbitMQ.Tests/RabbitMQFunctionalTests.cs index 7a2b9a4ac5..375a15041b 100644 --- a/tests/Aspire.Hosting.RabbitMQ.Tests/RabbitMQFunctionalTests.cs +++ b/tests/Aspire.Hosting.RabbitMQ.Tests/RabbitMQFunctionalTests.cs @@ -113,7 +113,7 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume) if (useVolume) { // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - volumeName = VolumeNameGenerator.CreateVolumeName(rabbitMQ1, nameof(WithDataShouldPersistStateBetweenUsages)); + volumeName = VolumeNameGenerator.Generate(rabbitMQ1, nameof(WithDataShouldPersistStateBetweenUsages)); // if the volume already exists (because of a crashing previous run), delete it DockerUtils.AttemptDeleteDockerVolume(volumeName, throwOnFailure: true); diff --git a/tests/Aspire.Hosting.Redis.Tests/RedisFunctionalTests.cs b/tests/Aspire.Hosting.Redis.Tests/RedisFunctionalTests.cs index 0b01d42403..e04687f238 100644 --- a/tests/Aspire.Hosting.Redis.Tests/RedisFunctionalTests.cs +++ b/tests/Aspire.Hosting.Redis.Tests/RedisFunctionalTests.cs @@ -298,7 +298,7 @@ public async Task WithDataVolumeShouldPersistStateBetweenUsages() var redis1 = builder1.AddRedis("redis"); // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - var volumeName = VolumeNameGenerator.CreateVolumeName(redis1, nameof(WithDataVolumeShouldPersistStateBetweenUsages)); + var volumeName = VolumeNameGenerator.Generate(redis1, nameof(WithDataVolumeShouldPersistStateBetweenUsages)); redis1.WithDataVolume(volumeName); // if the volume already exists (because of a crashing previous run), delete it DockerUtils.AttemptDeleteDockerVolume(volumeName, throwOnFailure: true); diff --git a/tests/Aspire.Hosting.SqlServer.Tests/Aspire.Hosting.SqlServer.Tests.csproj b/tests/Aspire.Hosting.SqlServer.Tests/Aspire.Hosting.SqlServer.Tests.csproj index dab38c0c0c..0bfa65c52a 100644 --- a/tests/Aspire.Hosting.SqlServer.Tests/Aspire.Hosting.SqlServer.Tests.csproj +++ b/tests/Aspire.Hosting.SqlServer.Tests/Aspire.Hosting.SqlServer.Tests.csproj @@ -13,7 +13,6 @@ - diff --git a/tests/Aspire.Hosting.SqlServer.Tests/SqlServerFunctionalTests.cs b/tests/Aspire.Hosting.SqlServer.Tests/SqlServerFunctionalTests.cs index 5726d9d749..b4b87ab1f2 100644 --- a/tests/Aspire.Hosting.SqlServer.Tests/SqlServerFunctionalTests.cs +++ b/tests/Aspire.Hosting.SqlServer.Tests/SqlServerFunctionalTests.cs @@ -142,7 +142,7 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume) if (useVolume) { // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - volumeName = VolumeNameGenerator.CreateVolumeName(sqlserver1, nameof(WithDataShouldPersistStateBetweenUsages)); + volumeName = VolumeNameGenerator.Generate(sqlserver1, nameof(WithDataShouldPersistStateBetweenUsages)); // if the volume already exists (because of a crashing previous run), delete it DockerUtils.AttemptDeleteDockerVolume(volumeName, throwOnFailure: true); diff --git a/tests/Aspire.Hosting.Tests/Utils/VolumeNameGeneratorTests.cs b/tests/Aspire.Hosting.Tests/Utils/VolumeNameGeneratorTests.cs index 2d6873dd24..f78d579571 100644 --- a/tests/Aspire.Hosting.Tests/Utils/VolumeNameGeneratorTests.cs +++ b/tests/Aspire.Hosting.Tests/Utils/VolumeNameGeneratorTests.cs @@ -18,7 +18,7 @@ public void VolumeGeneratorUsesUniqueName() var resource = builder.AddResource(new TestResource("myresource")); - var volumeName = CreateVolumeName(resource, "data"); + var volumeName = Generate(resource, "data"); Assert.Equal($"{volumePrefix}-{resource.Resource.Name}-data", volumeName); } @@ -30,7 +30,7 @@ public void ThrowsWhenSuffixContainsInvalidChars(string suffix) var builder = DistributedApplication.CreateBuilder(); var resource = builder.AddResource(new TestResource("myresource")); - Assert.Throws(nameof(suffix), () => CreateVolumeName(resource, suffix)); + Assert.Throws(nameof(suffix), () => Generate(resource, suffix)); } public static object[][] InvalidNameParts => [ @@ -61,8 +61,8 @@ public void VolumeNameDiffersBetweenPublishAndRun() var runResource = runBuilder.AddResource(new TestResource("myresource")); var publishResource = publishBuilder.AddResource(new TestResource("myresource")); - var runVolumeName = CreateVolumeName(runResource, "data"); - var publishVolumeName = CreateVolumeName(publishResource, "data"); + var runVolumeName = Generate(runResource, "data"); + var publishVolumeName = Generate(publishResource, "data"); Assert.Equal($"{runVolumePrefix}-{runResource.Resource.Name}-data", runVolumeName); Assert.Equal($"{publishVolumePrefix}-{publishResource.Resource.Name}-data", publishVolumeName); diff --git a/tests/Aspire.Hosting.Valkey.Tests/Aspire.Hosting.Valkey.Tests.csproj b/tests/Aspire.Hosting.Valkey.Tests/Aspire.Hosting.Valkey.Tests.csproj index cbaf03c0b6..10c457e1b0 100644 --- a/tests/Aspire.Hosting.Valkey.Tests/Aspire.Hosting.Valkey.Tests.csproj +++ b/tests/Aspire.Hosting.Valkey.Tests/Aspire.Hosting.Valkey.Tests.csproj @@ -12,7 +12,6 @@ - diff --git a/tests/Aspire.Hosting.Valkey.Tests/ValkeyFunctionalTests.cs b/tests/Aspire.Hosting.Valkey.Tests/ValkeyFunctionalTests.cs index 2ac91e1c12..70f6848a96 100644 --- a/tests/Aspire.Hosting.Valkey.Tests/ValkeyFunctionalTests.cs +++ b/tests/Aspire.Hosting.Valkey.Tests/ValkeyFunctionalTests.cs @@ -72,7 +72,7 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume) if (useVolume) { // Use a deterministic volume name to prevent them from exhausting the machines if deletion fails - volumeName = VolumeNameGenerator.CreateVolumeName(valkey1, nameof(WithDataShouldPersistStateBetweenUsages)); + volumeName = VolumeNameGenerator.Generate(valkey1, nameof(WithDataShouldPersistStateBetweenUsages)); // if the volume already exists (because of a crashing previous run), delete it DockerUtils.AttemptDeleteDockerVolume(volumeName, throwOnFailure: true);