Browse Source

Fix integration tests

davidfowl/common-services
Reuben Bond 1 year ago
parent
commit
3858d7ccf7
15 changed files with 7918 additions and 7923 deletions
  1. +1
    -1
      src/Services/Basket/Basket.FunctionalTests/Base/BasketScenarioBase.cs
  2. +1
    -1
      src/Services/Basket/Basket.FunctionalTests/Basket.FunctionalTests.csproj
  3. +0
    -0
      src/Services/Basket/Basket.FunctionalTests/appsettings.Basket.json
  4. +2
    -2
      src/Services/Catalog/Catalog.FunctionalTests/Catalog.FunctionalTests.csproj
  5. +9
    -8
      src/Services/Catalog/Catalog.FunctionalTests/CatalogScenarioBase.cs
  6. +1
    -1
      src/Services/Catalog/Catalog.FunctionalTests/appsettings.Catalog.json
  7. +2
    -2
      src/Services/Identity/Identity.API/Program.cs
  8. +2
    -2
      src/Services/Ordering/Ordering.BackgroundTasks/Extensions/CustomExtensionMethods.cs
  9. +1
    -1
      src/Services/Ordering/Ordering.FunctionalTests/Ordering.FunctionalTests.csproj
  10. +3
    -3
      src/Services/Ordering/Ordering.FunctionalTests/OrderingScenarioBase.cs
  11. +1
    -1
      src/Services/Ordering/Ordering.FunctionalTests/appsettings.Ordering.json
  12. +2
    -2
      src/Services/Webhooks/Webhooks.API/Extensions/Extensions.cs
  13. +1
    -1
      src/Services/Webhooks/Webhooks.API/appsettings.Development.json
  14. +0
    -6
      src/Tests/Services/Application.FunctionalTests/Application.FunctionalTests.csproj
  15. +7892
    -7892
      src/Web/WebSPA/Client/yarn.lock

+ 1
- 1
src/Services/Basket/Basket.FunctionalTests/Base/BasketScenarioBase.cs View File

@ -45,7 +45,7 @@ public class BasketScenarioBase
{ {
var directory = Path.GetDirectoryName(typeof(BasketScenarioBase).Assembly.Location)!; var directory = Path.GetDirectoryName(typeof(BasketScenarioBase).Assembly.Location)!;
c.AddJsonFile(Path.Combine(directory, "appsettings.json"), optional: false);
c.AddJsonFile(Path.Combine(directory, "appsettings.Basket.json"), optional: false);
}); });
return base.CreateHost(builder); return base.CreateHost(builder);


+ 1
- 1
src/Services/Basket/Basket.FunctionalTests/Basket.FunctionalTests.csproj View File

@ -7,7 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Content Include="appsettings.json">
<Content Include="appsettings.Basket.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>


src/Services/Basket/Basket.FunctionalTests/appsettings.json → src/Services/Basket/Basket.FunctionalTests/appsettings.Basket.json View File


+ 2
- 2
src/Services/Catalog/Catalog.FunctionalTests/Catalog.FunctionalTests.csproj View File

@ -7,7 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="appsettings.json" />
<None Remove="appsettings.Catalog.json" />
<None Remove="Setup\CatalogBrands.csv" /> <None Remove="Setup\CatalogBrands.csv" />
<None Remove="Setup\CatalogItems.csv" /> <None Remove="Setup\CatalogItems.csv" />
<None Remove="Setup\CatalogItems.zip" /> <None Remove="Setup\CatalogItems.zip" />
@ -15,7 +15,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="appsettings.json">
<Content Include="appsettings.Catalog.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Setup\CatalogBrands.csv"> <Content Include="Setup\CatalogBrands.csv">


+ 9
- 8
src/Services/Catalog/Catalog.FunctionalTests/CatalogScenarioBase.cs View File

@ -1,15 +1,10 @@
using Microsoft.AspNetCore.Mvc.Testing;
using System;
using Microsoft.AspNetCore.Mvc.Testing;
namespace Catalog.FunctionalTests; namespace Catalog.FunctionalTests;
public class CatalogScenariosBase public class CatalogScenariosBase
{ {
public TestServer CreateServer()
{
var factory = new CatalogApplication();
return factory.Server;
}
private class CatalogApplication : WebApplicationFactory<Program> private class CatalogApplication : WebApplicationFactory<Program>
{ {
protected override IHost CreateHost(IHostBuilder builder) protected override IHost CreateHost(IHostBuilder builder)
@ -18,13 +13,19 @@ public class CatalogScenariosBase
{ {
var directory = Path.GetDirectoryName(typeof(CatalogScenariosBase).Assembly.Location)!; var directory = Path.GetDirectoryName(typeof(CatalogScenariosBase).Assembly.Location)!;
c.AddJsonFile(Path.Combine(directory, "appsettings.json"), optional: false);
c.AddJsonFile(Path.Combine(directory, "appsettings.Catalog.json"), optional: false);
}); });
return base.CreateHost(builder); return base.CreateHost(builder);
} }
} }
public TestServer CreateServer()
{
var factory = new CatalogApplication();
return factory.Server;
}
public static class Get public static class Get
{ {
private const int PageIndex = 0; private const int PageIndex = 0;


src/Services/Catalog/Catalog.FunctionalTests/appsettings.json → src/Services/Catalog/Catalog.FunctionalTests/appsettings.Catalog.json View File

@ -4,7 +4,7 @@
"PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/", "PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/",
"ConnectionStrings": { "ConnectionStrings": {
"CatalogDb": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true"
"CatalogDB": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true"
}, },
"EventBus": { "EventBus": {

+ 2
- 2
src/Services/Identity/Identity.API/Program.cs View File

@ -5,7 +5,7 @@ builder.AddServiceDefaults();
builder.Services.AddControllersWithViews(); builder.Services.AddControllersWithViews();
builder.Services.AddDbContext<ApplicationDbContext>(options => builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("IdentityDb")));
options.UseSqlServer(builder.Configuration.GetConnectionString("IdentityDB")));
builder.Services.AddIdentity<ApplicationUser, IdentityRole>() builder.Services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>() .AddEntityFrameworkStores<ApplicationDbContext>()
@ -30,7 +30,7 @@ builder.Services.AddIdentityServer(options =>
builder.Services.AddHealthChecks() builder.Services.AddHealthChecks()
.AddSqlServer(_ => .AddSqlServer(_ =>
builder.Configuration.GetRequiredConnectionString("IdentityDb"),
builder.Configuration.GetRequiredConnectionString("IdentityDB"),
name: "IdentityDB-check", name: "IdentityDB-check",
tags: new string[] { "IdentityDB" }); tags: new string[] { "IdentityDB" });


+ 2
- 2
src/Services/Ordering/Ordering.BackgroundTasks/Extensions/CustomExtensionMethods.cs View File

@ -7,7 +7,7 @@ public static class CustomExtensionMethods
var hcBuilder = services.AddHealthChecks(); var hcBuilder = services.AddHealthChecks();
hcBuilder.AddSqlServer(_ => hcBuilder.AddSqlServer(_ =>
configuration.GetRequiredConnectionString("OrderingDb"),
configuration.GetRequiredConnectionString("OrderingDB"),
name: "OrderingTaskDB-check", name: "OrderingTaskDB-check",
tags: new string[] { "live", "ready" }); tags: new string[] { "live", "ready" });
@ -19,7 +19,7 @@ public static class CustomExtensionMethods
return services.Configure<BackgroundTaskSettings>(configuration) return services.Configure<BackgroundTaskSettings>(configuration)
.Configure<BackgroundTaskSettings>(o => .Configure<BackgroundTaskSettings>(o =>
{ {
o.ConnectionString = configuration.GetRequiredConnectionString("OrderingDb");
o.ConnectionString = configuration.GetRequiredConnectionString("OrderingDB");
}); });
} }
} }

+ 1
- 1
src/Services/Ordering/Ordering.FunctionalTests/Ordering.FunctionalTests.csproj View File

@ -7,7 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Content Include="appsettings.json">
<Content Include="appsettings.Ordering.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>


+ 3
- 3
src/Services/Ordering/Ordering.FunctionalTests/OrderingScenarioBase.cs View File

@ -14,16 +14,16 @@ public class OrderingScenarioBase
protected override IHost CreateHost(IHostBuilder builder) protected override IHost CreateHost(IHostBuilder builder)
{ {
builder.ConfigureServices(servies =>
builder.ConfigureServices(services =>
{ {
servies.AddSingleton<IStartupFilter, AuthStartupFilter>();
services.AddSingleton<IStartupFilter, AuthStartupFilter>();
}); });
builder.ConfigureAppConfiguration(c => builder.ConfigureAppConfiguration(c =>
{ {
var directory = Path.GetDirectoryName(typeof(OrderingScenarioBase).Assembly.Location)!; var directory = Path.GetDirectoryName(typeof(OrderingScenarioBase).Assembly.Location)!;
c.AddJsonFile(Path.Combine(directory, "appsettings.json"), optional: false);
c.AddJsonFile(Path.Combine(directory, "appsettings.Ordering.json"), optional: false);
}); });
return base.CreateHost(builder); return base.CreateHost(builder);


src/Services/Ordering/Ordering.FunctionalTests/appsettings.json → src/Services/Ordering/Ordering.FunctionalTests/appsettings.Ordering.json View File

@ -1,6 +1,6 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"OrderingDb": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true",
"OrderingDB": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true",
"EventBus": "localhost" "EventBus": "localhost"
}, },
"CheckUpdateTime": "30000", "CheckUpdateTime": "30000",

+ 2
- 2
src/Services/Webhooks/Webhooks.API/Extensions/Extensions.cs View File

@ -4,7 +4,7 @@
{ {
services.AddDbContext<WebhooksContext>(options => services.AddDbContext<WebhooksContext>(options =>
{ {
options.UseSqlServer(configuration.GetRequiredConnectionString("WebHooksDb"),
options.UseSqlServer(configuration.GetRequiredConnectionString("WebHooksDB"),
sqlServerOptionsAction: sqlOptions => sqlServerOptionsAction: sqlOptions =>
{ {
sqlOptions.MigrationsAssembly(typeof(Program).Assembly.FullName); sqlOptions.MigrationsAssembly(typeof(Program).Assembly.FullName);
@ -23,7 +23,7 @@
hcBuilder hcBuilder
.AddSqlServer(_ => .AddSqlServer(_ =>
configuration.GetRequiredConnectionString("WebHooksDb"),
configuration.GetRequiredConnectionString("WebHooksDB"),
name: "WebhooksApiDb-check", name: "WebhooksApiDb-check",
tags: new string[] { "ready" }); tags: new string[] { "ready" });


+ 1
- 1
src/Services/Webhooks/Webhooks.API/appsettings.Development.json View File

@ -7,6 +7,6 @@
} }
}, },
"ConnectionStrings": { "ConnectionStrings": {
"WebHooksDb": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;TrustServerCertificate=true"
"WebHooksDB": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;TrustServerCertificate=true"
} }
} }

+ 0
- 6
src/Tests/Services/Application.FunctionalTests/Application.FunctionalTests.csproj View File

@ -53,12 +53,6 @@
<ProjectReference Include="..\..\..\Web\WebMVC\WebMVC.csproj" /> <ProjectReference Include="..\..\..\Web\WebMVC\WebMVC.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Update="Services\Locations\appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup> <ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" /> <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup> </ItemGroup>


+ 7892
- 7892
src/Web/WebSPA/Client/yarn.lock
File diff suppressed because it is too large
View File


Loading…
Cancel
Save