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