Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions Aspire.sln
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Hosting.PostgreSQL.T
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Hosting.Qdrant.Tests", "tests\Aspire.Hosting.Qdrant.Tests\Aspire.Hosting.Qdrant.Tests.csproj", "{8E2AA85E-C351-47B4-AF91-58557FAD5840}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Hosting.MySql.Tests", "tests\Aspire.Hosting.MySql.Tests\Aspire.Hosting.MySql.Tests.csproj", "{F3F33CF8-A2BB-4351-8501-A6884C5126FE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1330,14 +1332,18 @@ Global
{1BC02557-B78B-48CE-9D3C-488A6B7672F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1BC02557-B78B-48CE-9D3C-488A6B7672F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1BC02557-B78B-48CE-9D3C-488A6B7672F4}.Release|Any CPU.Build.0 = Release|Any CPU
{8E2AA85E-C351-47B4-AF91-58557FAD5840}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E2AA85E-C351-47B4-AF91-58557FAD5840}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E2AA85E-C351-47B4-AF91-58557FAD5840}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E2AA85E-C351-47B4-AF91-58557FAD5840}.Release|Any CPU.Build.0 = Release|Any CPU
{7425E5B2-BC47-4521-AC40-B8CECA329E08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7425E5B2-BC47-4521-AC40-B8CECA329E08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7425E5B2-BC47-4521-AC40-B8CECA329E08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7425E5B2-BC47-4521-AC40-B8CECA329E08}.Release|Any CPU.Build.0 = Release|Any CPU
{8E2AA85E-C351-47B4-AF91-58557FAD5840}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E2AA85E-C351-47B4-AF91-58557FAD5840}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E2AA85E-C351-47B4-AF91-58557FAD5840}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E2AA85E-C351-47B4-AF91-58557FAD5840}.Release|Any CPU.Build.0 = Release|Any CPU
{F3F33CF8-A2BB-4351-8501-A6884C5126FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3F33CF8-A2BB-4351-8501-A6884C5126FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3F33CF8-A2BB-4351-8501-A6884C5126FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3F33CF8-A2BB-4351-8501-A6884C5126FE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1581,8 +1587,9 @@ Global
{C424395C-1235-41A4-BF55-07880A04368C} = {4981B3A5-4AFD-4191-BF7D-8692D9783D60}
{830A89EC-4029-4753-B25A-068BAE37DEC7} = {4981B3A5-4AFD-4191-BF7D-8692D9783D60}
{1BC02557-B78B-48CE-9D3C-488A6B7672F4} = {830A89EC-4029-4753-B25A-068BAE37DEC7}
{8E2AA85E-C351-47B4-AF91-58557FAD5840} = {830A89EC-4029-4753-B25A-068BAE37DEC7}
{7425E5B2-BC47-4521-AC40-B8CECA329E08} = {830A89EC-4029-4753-B25A-068BAE37DEC7}
{8E2AA85E-C351-47B4-AF91-58557FAD5840} = {830A89EC-4029-4753-B25A-068BAE37DEC7}
{F3F33CF8-A2BB-4351-8501-A6884C5126FE} = {830A89EC-4029-4753-B25A-068BAE37DEC7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6DCEDFEC-988E-4CB3-B45B-191EB5086E0C}
Expand Down
3 changes: 2 additions & 1 deletion src/Aspire.Hosting.MySql/Aspire.Hosting.MySql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="Aspire.Hosting.Tests" />
<!-- Required for PhpMyAdminConfigWriterHook -->
<InternalsVisibleTo Include="Aspire.Hosting.MySql.Tests" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

using System.Net.Sockets;
using System.Text.RegularExpressions;
using Aspire.Hosting.MySql;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Tests.Utils;
using Aspire.Hosting.Utils;
using Microsoft.Extensions.DependencyInjection;
using Xunit;

namespace Aspire.Hosting.Tests.MySql;
namespace Aspire.Hosting.MySql.Tests;

public class AddMySqlTests
{
Expand All @@ -20,7 +20,7 @@ public void AddMySqlAddsGeneratedPasswordParameterWithUserSecretsParameterDefaul

var mysql = appBuilder.AddMySql("mysql");

Assert.IsType<UserSecretsParameterDefault>(mysql.Resource.PasswordParameter.Default);
Assert.Equal(nameof(UserSecretsParameterDefault), mysql.Resource.PasswordParameter.Default?.GetType().Name);
}

[Fact]
Expand All @@ -30,7 +30,7 @@ public void AddMySqlDoesNotAddGeneratedPasswordParameterWithUserSecretsParameter

var mysql = appBuilder.AddMySql("mysql");

Assert.IsNotType<UserSecretsParameterDefault>(mysql.Resource.PasswordParameter.Default);
Assert.Equal(nameof(GenerateParameterDefault), mysql.Resource.PasswordParameter.Default?.GetType().Name);
}

[Fact]
Expand Down
19 changes: 19 additions & 0 deletions tests/Aspire.Hosting.MySql.Tests/Aspire.Hosting.MySql.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(NetCurrent)</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Aspire.Hosting.AppHost\Aspire.Hosting.AppHost.csproj" />
<ProjectReference Include="..\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj" />
<ProjectReference Include="..\..\src\Aspire.Hosting.MySql\Aspire.Hosting.MySql.csproj" />
<ProjectReference Include="..\..\src\Components\Aspire.MySqlConnector\Aspire.MySqlConnector.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(SharedDir)SecretsStore.cs" Link="Utils\SecretsStore.cs" />
<Compile Include="$(RepoRoot)src\Aspire.Hosting\ApplicationModel\UserSecretsParameterDefault.cs" Link="Utils\UserSecretsParameterDefault.cs" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are tests checking that this is the type of credential that is created with the resource.
For all DBs btw.

AddMySqlAddsGeneratedPasswordParameterWithUserSecretsParameterDefaultInRunMode
AddMySqlDoesNotAddGeneratedPasswordParameterWithUserSecretsParameterDefaultInPublishMode

These are adapted though since the actual instance type is from the internal type in the Hosting assembly, and not the local one. What would solve it would be to make the type public.

</ItemGroup>

</Project>
Loading