Fix the catalog tests
This commit is contained in:
		
							parent
							
								
									f46b03cb36
								
							
						
					
					
						commit
						794c546d2e
					
				| @ -16,14 +16,23 @@ | ||||
|       "Protocols": "Http2" | ||||
|     } | ||||
|   }, | ||||
|   "ApplicationInsights": { | ||||
|     "InstrumentationKey": "" | ||||
|   }, | ||||
|   "UseVault": false, | ||||
|   "Vault": { | ||||
|     "Name": "eshop", | ||||
|     "ClientId": "your-client-id", | ||||
|     "ClientSecret": "your-client-secret" | ||||
|   }, | ||||
|   "OpenApi": { | ||||
|     "Endpoint": { | ||||
|       "Name": "" | ||||
|     }, | ||||
|     "Document": { | ||||
|       "Name": "Basket API", | ||||
|       "Description": "Basket API", | ||||
|       "Title": "Basket API", | ||||
|       "Name": "Basket.API V1", | ||||
|       "Description": "The Basket Service HTTP API", | ||||
|       "Title": "eShopOnContainers - Basket HTTP API", | ||||
|       "Version": "v1" | ||||
|     } | ||||
|   }, | ||||
| @ -41,14 +50,5 @@ | ||||
|     "SubscriptionClientName": "Basket", | ||||
|     "ConnectionString": "localhost", | ||||
|     "RetryCount": 5 | ||||
|   }, | ||||
|   "ApplicationInsights": { | ||||
|     "InstrumentationKey": "" | ||||
|   }, | ||||
|   "UseVault": false, | ||||
|   "Vault": { | ||||
|     "Name": "eshop", | ||||
|     "ClientId": "your-client-id", | ||||
|     "ClientSecret": "your-client-secret" | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -4,11 +4,14 @@ | ||||
|     { | ||||
|         var hcBuilder = services.AddHealthChecks(); | ||||
| 
 | ||||
|         if (configuration.GetConnectionString("CatalogDB") is string connectionString) | ||||
|         { | ||||
|             hcBuilder | ||||
|                 .AddSqlServer( | ||||
|                 configuration.GetConnectionString("Application"), | ||||
|                     connectionString, | ||||
|                     name: "CatalogDB-check", | ||||
|                     tags: new string[] { "catalogdb" }); | ||||
|         } | ||||
| 
 | ||||
|         var accountName = configuration["AzureStorageAccountName"]; | ||||
|         var accountKey = configuration["AzureStorageAccountKey"]; | ||||
| @ -30,7 +33,9 @@ | ||||
|         services.AddEntityFrameworkSqlServer() | ||||
|             .AddDbContext<CatalogContext>(options => | ||||
|             { | ||||
|                 options.UseSqlServer(configuration["ConnectionString"], | ||||
|                 var connectionString = configuration.GetRequiredConnectionString("CatalogDB"); | ||||
| 
 | ||||
|                 options.UseSqlServer(connectionString, | ||||
|                                     sqlServerOptionsAction: sqlOptions => | ||||
|                                     { | ||||
|                                         sqlOptions.MigrationsAssembly(typeof(Program).GetTypeInfo().Assembly.GetName().Name); | ||||
| @ -41,7 +46,9 @@ | ||||
| 
 | ||||
|         services.AddDbContext<IntegrationEventLogContext>(options => | ||||
|         { | ||||
|             options.UseSqlServer(configuration["ConnectionString"], | ||||
|             var connectionString = configuration.GetRequiredConnectionString("CatalogDB"); | ||||
| 
 | ||||
|             options.UseSqlServer(connectionString, | ||||
|                                     sqlServerOptionsAction: sqlOptions => | ||||
|                                     { | ||||
|                                         sqlOptions.MigrationsAssembly(typeof(Program).GetTypeInfo().Assembly.GetName().Name); | ||||
| @ -86,4 +93,7 @@ | ||||
| 
 | ||||
|         return services; | ||||
|     } | ||||
| 
 | ||||
|     private static string GetRequiredConnectionString(this IConfiguration configuration, string name) => | ||||
|     configuration.GetConnectionString(name) ?? throw new InvalidOperationException($"Configuration missing value for: {(configuration is IConfigurationSection s ? s.Path + ":ConnectionStrings:" + name : "ConnectionStrings:" + name)}"); | ||||
| } | ||||
|  | ||||
| @ -14,7 +14,6 @@ | ||||
|   }, | ||||
|   "AzureServiceBusEnabled": false, | ||||
|   "AzureStorageEnabled": false, | ||||
|   "SubscriptionClientName": "Catalog", | ||||
|   "ApplicationInsights": { | ||||
|     "InstrumentationKey": "" | ||||
|   }, | ||||
| @ -36,10 +35,10 @@ | ||||
|     } | ||||
|   }, | ||||
|   "ConnectionStrings": { | ||||
|     "Application": "" | ||||
|     "CatalogDB": "" | ||||
|   }, | ||||
|   "EventBus": { | ||||
|     "SubscriptionClientName": "Basket", | ||||
|     "SubscriptionClientName": "Catalog", | ||||
|     "ConnectionString": "localhost", | ||||
|     "RetryCount": 5 | ||||
|   } | ||||
|  | ||||
| @ -1,9 +1,15 @@ | ||||
| { | ||||
|   "ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word;Encrypt=False;TrustServerCertificate=true", | ||||
|   "ExternalCatalogBaseUrl": "http://localhost:5101", | ||||
|   "IdentityUrl": "http://localhost:5105", | ||||
|   "isTest": "true", | ||||
|   "EventBusConnection": "localhost", | ||||
|   "PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/", | ||||
|   "SubscriptionClientName": "Catalog" | ||||
| 
 | ||||
|   "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" | ||||
|   }, | ||||
| 
 | ||||
|   "EventBus": { | ||||
|     "SubscriptionClientName": "Catalog", | ||||
|     "ConnectionString": "localhost" | ||||
|   } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user