Skip to content

Commit e8f9a9f

Browse files
committed
Convert tests to snapshot-based tests
1 parent 8fd92af commit e8f9a9f

File tree

162 files changed

+5516
-4364
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+5516
-4364
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,7 @@ node_modules/
147147
.venv
148148

149149
# Publisher Outputs
150-
playground/**/publish/
150+
playground/**/publish/
151+
152+
# Verify
153+
*.received.*

tests/Aspire.Hosting.Azure.Tests/Aspire.Hosting.Azure.Tests.csproj

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,34 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<ProjectReference Include="..\..\src\Aspire.Hosting\Aspire.Hosting.csproj" />
8+
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.AppConfiguration\Aspire.Hosting.Azure.AppConfiguration.csproj" />
99
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.AppContainers\Aspire.Hosting.Azure.AppContainers.csproj" />
10-
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure\Aspire.Hosting.Azure.csproj" />
11-
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.Redis\Aspire.Hosting.Azure.Redis.csproj" />
12-
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.KeyVault\Aspire.Hosting.Azure.KeyVault.csproj" />
10+
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.ApplicationInsights\Aspire.Hosting.Azure.ApplicationInsights.csproj" />
1311
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.CognitiveServices\Aspire.Hosting.Azure.CognitiveServices.csproj" />
14-
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.PostgreSQL\Aspire.Hosting.Azure.PostgreSQL.csproj" />
1512
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.CosmosDB\Aspire.Hosting.Azure.CosmosDB.csproj" />
1613
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.EventHubs\Aspire.Hosting.Azure.EventHubs.csproj" />
1714
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.Functions\Aspire.Hosting.Azure.Functions.csproj" />
18-
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.Storage\Aspire.Hosting.Azure.Storage.csproj" />
15+
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.KeyVault\Aspire.Hosting.Azure.KeyVault.csproj" />
16+
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.OperationalInsights\Aspire.Hosting.Azure.OperationalInsights.csproj" />
17+
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.PostgreSQL\Aspire.Hosting.Azure.PostgreSQL.csproj" />
18+
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.Redis\Aspire.Hosting.Azure.Redis.csproj" />
19+
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.Search\Aspire.Hosting.Azure.Search.csproj" />
1920
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.ServiceBus\Aspire.Hosting.Azure.ServiceBus.csproj" />
20-
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.WebPubSub\Aspire.Hosting.Azure.WebPubSub.csproj" />
21-
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.Sql\Aspire.Hosting.Azure.Sql.csproj" />
2221
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.SignalR\Aspire.Hosting.Azure.SignalR.csproj" />
23-
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.Search\Aspire.Hosting.Azure.Search.csproj" />
24-
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.OperationalInsights\Aspire.Hosting.Azure.OperationalInsights.csproj" />
25-
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.ApplicationInsights\Aspire.Hosting.Azure.ApplicationInsights.csproj" />
26-
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.AppConfiguration\Aspire.Hosting.Azure.AppConfiguration.csproj" />
22+
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.Sql\Aspire.Hosting.Azure.Sql.csproj" />
23+
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.Storage\Aspire.Hosting.Azure.Storage.csproj" />
24+
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure.WebPubSub\Aspire.Hosting.Azure.WebPubSub.csproj" />
25+
<ProjectReference Include="..\..\src\Aspire.Hosting.Azure\Aspire.Hosting.Azure.csproj" />
26+
<ProjectReference Include="..\..\src\Aspire.Hosting\Aspire.Hosting.csproj" />
2727
<ProjectReference Include="..\..\src\Components\Aspire.Azure.Messaging.EventHubs\Aspire.Azure.Messaging.EventHubs.csproj" />
2828
<ProjectReference Include="..\..\src\Components\Aspire.Azure.Messaging.ServiceBus\Aspire.Azure.Messaging.ServiceBus.csproj" />
2929
<ProjectReference Include="..\..\src\Components\Aspire.Azure.Storage.Blobs\Aspire.Azure.Storage.Blobs.csproj" />
3030
<ProjectReference Include="..\..\src\Components\Aspire.Microsoft.Azure.Cosmos\Aspire.Microsoft.Azure.Cosmos.csproj" />
3131
<ProjectReference Include="..\..\src\Components\Aspire.Microsoft.EntityFrameworkCore.Cosmos\Aspire.Microsoft.EntityFrameworkCore.Cosmos.csproj" />
3232
<ProjectReference Include="..\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj" />
33+
</ItemGroup>
3334

35+
<ItemGroup>
3436
<Compile Include="$(RepoRoot)src\Aspire.Hosting.Azure.EventHubs\EventHubsEmulatorContainerImageTags.cs" />
3537
<Compile Include="$(RepoRoot)src\Aspire.Hosting.Azure.ServiceBus\ServiceBusEmulatorContainerImageTags.cs" />
3638
<Compile Include="$(RepoRoot)src\Aspire.Hosting.Azure.Storage\AzureStorageEmulatorConnectionString.cs" />
@@ -39,6 +41,7 @@
3941
<ItemGroup>
4042
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" />
4143
<PackageReference Include="Microsoft.Azure.SignalR.Management" />
44+
<PackageReference Include="Verify.XunitV3" />
4245
</ItemGroup>
4346

4447
</Project>

tests/Aspire.Hosting.Azure.Tests/AzureBicepProvisionerTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using Aspire.Hosting.Utils;
99
using Microsoft.Extensions.Configuration;
1010
using Microsoft.Extensions.DependencyInjection;
11-
using Xunit;
1211

1312
namespace Aspire.Hosting.Azure.Tests;
1413

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@description('The location for the resource(s) to be deployed.')
2+
param location string = resourceGroup().location
3+
4+
param applicationType string = 'web'
5+
6+
param kind string = 'web'
7+
8+
param logAnalyticsWorkspaceId string
9+
10+
resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
11+
name: take('appInsights-${uniqueString(resourceGroup().id)}', 260)
12+
kind: kind
13+
location: location
14+
properties: {
15+
Application_Type: applicationType
16+
WorkspaceResourceId: logAnalyticsWorkspaceId
17+
}
18+
tags: {
19+
'aspire-resource-name': 'appInsights'
20+
}
21+
}
22+
23+
output appInsightsConnectionString string = appInsights.properties.ConnectionString
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@description('The location for the resource(s) to be deployed.')
2+
param location string = resourceGroup().location
3+
4+
param applicationType string = 'web'
5+
6+
param kind string = 'web'
7+
8+
param logAnalyticsWorkspaceId string
9+
10+
resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
11+
name: take('appInsights-${uniqueString(resourceGroup().id)}', 260)
12+
kind: kind
13+
location: location
14+
properties: {
15+
Application_Type: applicationType
16+
WorkspaceResourceId: logAnalyticsWorkspaceId
17+
}
18+
tags: {
19+
'aspire-resource-name': 'appInsights'
20+
}
21+
}
22+
23+
output appInsightsConnectionString string = appInsights.properties.ConnectionString
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
@description('The location for the resource(s) to be deployed.')
2+
param location string = resourceGroup().location
3+
4+
param applicationType string = 'web'
5+
6+
param kind string = 'web'
7+
8+
resource law_appInsights 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
9+
name: take('lawappInsights-${uniqueString(resourceGroup().id)}', 63)
10+
location: location
11+
properties: {
12+
sku: {
13+
name: 'PerGB2018'
14+
}
15+
}
16+
tags: {
17+
'aspire-resource-name': 'law_appInsights'
18+
}
19+
}
20+
21+
resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
22+
name: take('appInsights-${uniqueString(resourceGroup().id)}', 260)
23+
kind: kind
24+
location: location
25+
properties: {
26+
Application_Type: applicationType
27+
WorkspaceResourceId: law_appInsights.id
28+
}
29+
tags: {
30+
'aspire-resource-name': 'appInsights'
31+
}
32+
}
33+
34+
output appInsightsConnectionString string = appInsights.properties.ConnectionString
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
@description('The location for the resource(s) to be deployed.')
2+
param location string = resourceGroup().location
3+
4+
resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-08-15' = {
5+
name: take('cosmos-${uniqueString(resourceGroup().id)}', 44)
6+
location: location
7+
properties: {
8+
locations: [
9+
{
10+
locationName: location
11+
failoverPriority: 0
12+
}
13+
]
14+
consistencyPolicy: {
15+
defaultConsistencyLevel: 'Session'
16+
}
17+
databaseAccountOfferType: 'Standard'
18+
disableLocalAuth: true
19+
}
20+
kind: 'GlobalDocumentDB'
21+
tags: {
22+
'aspire-resource-name': 'cosmos'
23+
}
24+
}
25+
26+
resource mydatabase 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2024-08-15' = {
27+
name: 'mydatabase'
28+
location: location
29+
properties: {
30+
resource: {
31+
id: 'mydatabase'
32+
}
33+
}
34+
parent: cosmos
35+
}
36+
37+
resource mycontainer 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2024-08-15' = {
38+
name: 'mycontainer'
39+
location: location
40+
properties: {
41+
resource: {
42+
id: 'mycontainer'
43+
partitionKey: {
44+
paths: [
45+
'mypartitionkeypath'
46+
]
47+
}
48+
}
49+
}
50+
parent: mydatabase
51+
}
52+
53+
output connectionString string = cosmos.properties.documentEndpoint
54+
55+
output name string = cosmos.name
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
@description('The location for the resource(s) to be deployed.')
2+
param location string = resourceGroup().location
3+
4+
param keyVaultName string
5+
6+
resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-08-15' = {
7+
name: take('cosmos-${uniqueString(resourceGroup().id)}', 44)
8+
location: location
9+
properties: {
10+
locations: [
11+
{
12+
locationName: location
13+
failoverPriority: 0
14+
}
15+
]
16+
consistencyPolicy: {
17+
defaultConsistencyLevel: 'Session'
18+
}
19+
databaseAccountOfferType: 'Standard'
20+
disableLocalAuth: false
21+
}
22+
kind: 'GlobalDocumentDB'
23+
tags: {
24+
'aspire-resource-name': 'cosmos'
25+
}
26+
}
27+
28+
resource mydatabase 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2024-08-15' = {
29+
name: 'mydatabase'
30+
location: location
31+
properties: {
32+
resource: {
33+
id: 'mydatabase'
34+
}
35+
}
36+
parent: cosmos
37+
}
38+
39+
resource mycontainer 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2024-08-15' = {
40+
name: 'mycontainer'
41+
location: location
42+
properties: {
43+
resource: {
44+
id: 'mycontainer'
45+
partitionKey: {
46+
paths: [
47+
'mypartitionkeypath'
48+
]
49+
}
50+
}
51+
}
52+
parent: mydatabase
53+
}
54+
55+
resource keyVault 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
56+
name: keyVaultName
57+
}
58+
59+
resource connectionString 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = {
60+
name: 'connectionstrings--cosmos'
61+
properties: {
62+
value: 'AccountEndpoint=${cosmos.properties.documentEndpoint};AccountKey=${cosmos.listKeys().primaryMasterKey}'
63+
}
64+
parent: keyVault
65+
}
66+
67+
resource mydatabase_connectionString 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = {
68+
name: 'connectionstrings--mydatabase'
69+
properties: {
70+
value: 'AccountEndpoint=${cosmos.properties.documentEndpoint};AccountKey=${cosmos.listKeys().primaryMasterKey};Database=mydatabase'
71+
}
72+
parent: keyVault
73+
}
74+
75+
resource mycontainer_connectionString 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = {
76+
name: 'connectionstrings--mycontainer'
77+
properties: {
78+
value: 'AccountEndpoint=${cosmos.properties.documentEndpoint};AccountKey=${cosmos.listKeys().primaryMasterKey};Database=mydatabase;Container=mycontainer'
79+
}
80+
parent: keyVault
81+
}
82+
83+
output name string = cosmos.name
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
@description('The location for the resource(s) to be deployed.')
2+
param location string = resourceGroup().location
3+
4+
param keyVaultName string
5+
6+
resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-08-15' = {
7+
name: take('cosmos-${uniqueString(resourceGroup().id)}', 44)
8+
location: location
9+
properties: {
10+
locations: [
11+
{
12+
locationName: location
13+
failoverPriority: 0
14+
}
15+
]
16+
consistencyPolicy: {
17+
defaultConsistencyLevel: 'Session'
18+
}
19+
databaseAccountOfferType: 'Standard'
20+
disableLocalAuth: false
21+
}
22+
kind: 'GlobalDocumentDB'
23+
tags: {
24+
'aspire-resource-name': 'cosmos'
25+
}
26+
}
27+
28+
resource mydatabase 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2024-08-15' = {
29+
name: 'mydatabase'
30+
location: location
31+
properties: {
32+
resource: {
33+
id: 'mydatabase'
34+
}
35+
}
36+
parent: cosmos
37+
}
38+
39+
resource mycontainer 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2024-08-15' = {
40+
name: 'mycontainer'
41+
location: location
42+
properties: {
43+
resource: {
44+
id: 'mycontainer'
45+
partitionKey: {
46+
paths: [
47+
'mypartitionkeypath'
48+
]
49+
}
50+
}
51+
}
52+
parent: mydatabase
53+
}
54+
55+
resource keyVault 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
56+
name: keyVaultName
57+
}
58+
59+
resource connectionString 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = {
60+
name: 'connectionstrings--cosmos'
61+
properties: {
62+
value: 'AccountEndpoint=${cosmos.properties.documentEndpoint};AccountKey=${cosmos.listKeys().primaryMasterKey}'
63+
}
64+
parent: keyVault
65+
}
66+
67+
resource mydatabase_connectionString 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = {
68+
name: 'connectionstrings--mydatabase'
69+
properties: {
70+
value: 'AccountEndpoint=${cosmos.properties.documentEndpoint};AccountKey=${cosmos.listKeys().primaryMasterKey};Database=mydatabase'
71+
}
72+
parent: keyVault
73+
}
74+
75+
resource mycontainer_connectionString 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = {
76+
name: 'connectionstrings--mycontainer'
77+
properties: {
78+
value: 'AccountEndpoint=${cosmos.properties.documentEndpoint};AccountKey=${cosmos.listKeys().primaryMasterKey};Database=mydatabase;Container=mycontainer'
79+
}
80+
parent: keyVault
81+
}
82+
83+
output name string = cosmos.name

0 commit comments

Comments
 (0)