remove mvc routing spa
This commit is contained in:
parent
aee00cf406
commit
17faebfa30
@ -9,6 +9,7 @@ using Xunit;
|
|||||||
|
|
||||||
namespace Marketing.FunctionalTests
|
namespace Marketing.FunctionalTests
|
||||||
{
|
{
|
||||||
|
[Collection("Sequential")]
|
||||||
public class CampaignScenarios
|
public class CampaignScenarios
|
||||||
: CampaignScenarioBase
|
: CampaignScenarioBase
|
||||||
{
|
{
|
||||||
|
@ -20,13 +20,9 @@ namespace Marketing.FunctionalTests
|
|||||||
|
|
||||||
public TestServer CreateServer()
|
public TestServer CreateServer()
|
||||||
{
|
{
|
||||||
|
|
||||||
Console.WriteLine(" Creating test server");
|
|
||||||
var path = Assembly.GetAssembly(typeof(MarketingScenarioBase))
|
var path = Assembly.GetAssembly(typeof(MarketingScenarioBase))
|
||||||
.Location;
|
.Location;
|
||||||
|
|
||||||
Console.WriteLine(" Creating builder");
|
|
||||||
|
|
||||||
var hostBuilder = new WebHostBuilder()
|
var hostBuilder = new WebHostBuilder()
|
||||||
.UseContentRoot(Path.GetDirectoryName(path))
|
.UseContentRoot(Path.GetDirectoryName(path))
|
||||||
.ConfigureAppConfiguration(cb =>
|
.ConfigureAppConfiguration(cb =>
|
||||||
@ -36,38 +32,28 @@ namespace Marketing.FunctionalTests
|
|||||||
})
|
})
|
||||||
.CaptureStartupErrors(true)
|
.CaptureStartupErrors(true)
|
||||||
.UseStartup<MarketingTestsStartup>();
|
.UseStartup<MarketingTestsStartup>();
|
||||||
|
|
||||||
Console.WriteLine(" Created builder");
|
|
||||||
|
|
||||||
var testServer = new TestServer(hostBuilder);
|
var testServer = new TestServer(hostBuilder);
|
||||||
|
|
||||||
using (var scope = testServer.Services.CreateScope())
|
using (var scope = testServer.Services.CreateScope())
|
||||||
{
|
{
|
||||||
var services = scope.ServiceProvider;
|
var services = scope.ServiceProvider;
|
||||||
|
|
||||||
var logger = services.GetRequiredService<ILogger<MarketingScenarioBase>>();
|
var logger = services.GetRequiredService<ILogger<MarketingScenarioBase>>();
|
||||||
var settings = services.GetRequiredService<IOptions<MarketingSettings>>();
|
var settings = services.GetRequiredService<IOptions<MarketingSettings>>();
|
||||||
logger.LogError("connectionString " + settings.Value.ConnectionString);
|
logger.LogError("connectionString " + settings.Value.ConnectionString);
|
||||||
Console.WriteLine("connectionString " + settings.Value.ConnectionString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
testServer.Host
|
testServer.Host
|
||||||
.RemoveDbContext<MarketingContext>()
|
|
||||||
.MigrateDbContext<MarketingContext>((context, services) =>
|
.MigrateDbContext<MarketingContext>((context, services) =>
|
||||||
{
|
{
|
||||||
var logger = services.GetService<ILogger<MarketingContextSeed>>();
|
var logger = services.GetService<ILogger<MarketingContextSeed>>();
|
||||||
|
|
||||||
logger.LogError("Migrating MarketingContextSeed");
|
logger.LogError("Migrating MarketingContextSeed");
|
||||||
new MarketingContextSeed()
|
new MarketingContextSeed()
|
||||||
.SeedAsync(context, logger)
|
.SeedAsync(context, logger)
|
||||||
.Wait();
|
.Wait();
|
||||||
|
|
||||||
});
|
});
|
||||||
Console.WriteLine(" Thread to sleep");
|
|
||||||
|
|
||||||
Thread.Sleep(5000);
|
|
||||||
Console.WriteLine(" Thread after");
|
|
||||||
|
|
||||||
|
|
||||||
return testServer;
|
return testServer;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using Xunit;
|
|||||||
|
|
||||||
namespace Marketing.FunctionalTests
|
namespace Marketing.FunctionalTests
|
||||||
{
|
{
|
||||||
|
[Collection("Sequential")]
|
||||||
public class UserLocationRoleScenarios
|
public class UserLocationRoleScenarios
|
||||||
: UserLocationRoleScenariosBase
|
: UserLocationRoleScenariosBase
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.DataProtection;
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
@ -26,12 +25,8 @@ namespace eShopConContainers.WebSPA
|
|||||||
|
|
||||||
public IConfiguration Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
|
|
||||||
private IHostingEnvironment _hostingEnv;
|
public Startup()
|
||||||
|
|
||||||
public Startup(IHostingEnvironment env)
|
|
||||||
{
|
{
|
||||||
_hostingEnv = env;
|
|
||||||
|
|
||||||
var localPath = new Uri(Configuration["ASPNETCORE_URLS"])?.LocalPath ?? "/";
|
var localPath = new Uri(Configuration["ASPNETCORE_URLS"])?.LocalPath ?? "/";
|
||||||
Configuration["BaseUrl"] = localPath;
|
Configuration["BaseUrl"] = localPath;
|
||||||
}
|
}
|
||||||
@ -48,8 +43,6 @@ namespace eShopConContainers.WebSPA
|
|||||||
.AddUrlGroup(new Uri(Configuration["MarketingUrlHC"]), name: "marketingapigw-check", tags: new string[] { "marketingapigw" })
|
.AddUrlGroup(new Uri(Configuration["MarketingUrlHC"]), name: "marketingapigw-check", tags: new string[] { "marketingapigw" })
|
||||||
.AddUrlGroup(new Uri(Configuration["IdentityUrlHC"]), name: "identityapi-check", tags: new string[] { "identityapi" });
|
.AddUrlGroup(new Uri(Configuration["IdentityUrlHC"]), name: "identityapi-check", tags: new string[] { "identityapi" });
|
||||||
|
|
||||||
services.AddControllers();
|
|
||||||
|
|
||||||
services.Configure<AppSettings>(Configuration);
|
services.Configure<AppSettings>(Configuration);
|
||||||
|
|
||||||
if (Configuration.GetValue<string>("IsClusterEnv") == bool.TrueString)
|
if (Configuration.GetValue<string>("IsClusterEnv") == bool.TrueString)
|
||||||
@ -62,16 +55,13 @@ namespace eShopConContainers.WebSPA
|
|||||||
}
|
}
|
||||||
|
|
||||||
services.AddAntiforgery(options => options.HeaderName = "X-XSRF-TOKEN");
|
services.AddAntiforgery(options => options.HeaderName = "X-XSRF-TOKEN");
|
||||||
|
services.AddControllers()
|
||||||
services.AddMvc()
|
|
||||||
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
|
|
||||||
.AddJsonOptions(options =>
|
.AddJsonOptions(options =>
|
||||||
{
|
{
|
||||||
options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
|
options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IAntiforgery antiforgery)
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IAntiforgery antiforgery)
|
||||||
{
|
{
|
||||||
@ -102,6 +92,7 @@ namespace eShopConContainers.WebSPA
|
|||||||
WebContextSeed.Seed(app, env, loggerFactory);
|
WebContextSeed.Seed(app, env, loggerFactory);
|
||||||
|
|
||||||
var pathBase = Configuration["PATH_BASE"];
|
var pathBase = Configuration["PATH_BASE"];
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(pathBase))
|
if (!string.IsNullOrEmpty(pathBase))
|
||||||
{
|
{
|
||||||
loggerFactory.CreateLogger<Startup>().LogDebug("Using PATH BASE '{pathBase}'", pathBase);
|
loggerFactory.CreateLogger<Startup>().LogDebug("Using PATH BASE '{pathBase}'", pathBase);
|
||||||
@ -127,6 +118,7 @@ namespace eShopConContainers.WebSPA
|
|||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseEndpoints(endpoints =>
|
app.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
|
endpoints.MapControllers();
|
||||||
endpoints.MapHealthChecks("/liveness", new HealthCheckOptions
|
endpoints.MapHealthChecks("/liveness", new HealthCheckOptions
|
||||||
{
|
{
|
||||||
Predicate = r => r.Name.Contains("self")
|
Predicate = r => r.Name.Contains("self")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user