Fix integration tests
This commit is contained in:
parent
a87efdef32
commit
3858d7ccf7
@ -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);
|
||||||
|
@ -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>
|
||||||
|
@ -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">
|
||||||
|
@ -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;
|
||||||
|
@ -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": {
|
@ -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" });
|
||||||
|
|
||||||
|
@ -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");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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>
|
||||||
|
@ -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);
|
||||||
|
@ -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",
|
@ -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" });
|
||||||
|
|
||||||
|
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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>
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user