Fix the catalog tests
This commit is contained in:
		
							parent
							
								
									f46b03cb36
								
							
						
					
					
						commit
						794c546d2e
					
				| @ -16,14 +16,23 @@ | |||||||
|       "Protocols": "Http2" |       "Protocols": "Http2" | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|  |   "ApplicationInsights": { | ||||||
|  |     "InstrumentationKey": "" | ||||||
|  |   }, | ||||||
|  |   "UseVault": false, | ||||||
|  |   "Vault": { | ||||||
|  |     "Name": "eshop", | ||||||
|  |     "ClientId": "your-client-id", | ||||||
|  |     "ClientSecret": "your-client-secret" | ||||||
|  |   }, | ||||||
|   "OpenApi": { |   "OpenApi": { | ||||||
|     "Endpoint": { |     "Endpoint": { | ||||||
|       "Name": "" |       "Name": "" | ||||||
|     }, |     }, | ||||||
|     "Document": { |     "Document": { | ||||||
|       "Name": "Basket API", |       "Name": "Basket.API V1", | ||||||
|       "Description": "Basket API", |       "Description": "The Basket Service HTTP API", | ||||||
|       "Title": "Basket API", |       "Title": "eShopOnContainers - Basket HTTP API", | ||||||
|       "Version": "v1" |       "Version": "v1" | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
| @ -41,14 +50,5 @@ | |||||||
|     "SubscriptionClientName": "Basket", |     "SubscriptionClientName": "Basket", | ||||||
|     "ConnectionString": "localhost", |     "ConnectionString": "localhost", | ||||||
|     "RetryCount": 5 |     "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(); |         var hcBuilder = services.AddHealthChecks(); | ||||||
| 
 | 
 | ||||||
|         hcBuilder |         if (configuration.GetConnectionString("CatalogDB") is string connectionString) | ||||||
|             .AddSqlServer( |         { | ||||||
|                 configuration.GetConnectionString("Application"), |             hcBuilder | ||||||
|                 name: "CatalogDB-check", |                 .AddSqlServer( | ||||||
|                 tags: new string[] { "catalogdb" }); |                     connectionString, | ||||||
|  |                     name: "CatalogDB-check", | ||||||
|  |                     tags: new string[] { "catalogdb" }); | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         var accountName = configuration["AzureStorageAccountName"]; |         var accountName = configuration["AzureStorageAccountName"]; | ||||||
|         var accountKey = configuration["AzureStorageAccountKey"]; |         var accountKey = configuration["AzureStorageAccountKey"]; | ||||||
| @ -30,7 +33,9 @@ | |||||||
|         services.AddEntityFrameworkSqlServer() |         services.AddEntityFrameworkSqlServer() | ||||||
|             .AddDbContext<CatalogContext>(options => |             .AddDbContext<CatalogContext>(options => | ||||||
|             { |             { | ||||||
|                 options.UseSqlServer(configuration["ConnectionString"], |                 var connectionString = configuration.GetRequiredConnectionString("CatalogDB"); | ||||||
|  | 
 | ||||||
|  |                 options.UseSqlServer(connectionString, | ||||||
|                                     sqlServerOptionsAction: sqlOptions => |                                     sqlServerOptionsAction: sqlOptions => | ||||||
|                                     { |                                     { | ||||||
|                                         sqlOptions.MigrationsAssembly(typeof(Program).GetTypeInfo().Assembly.GetName().Name); |                                         sqlOptions.MigrationsAssembly(typeof(Program).GetTypeInfo().Assembly.GetName().Name); | ||||||
| @ -41,7 +46,9 @@ | |||||||
| 
 | 
 | ||||||
|         services.AddDbContext<IntegrationEventLogContext>(options => |         services.AddDbContext<IntegrationEventLogContext>(options => | ||||||
|         { |         { | ||||||
|             options.UseSqlServer(configuration["ConnectionString"], |             var connectionString = configuration.GetRequiredConnectionString("CatalogDB"); | ||||||
|  | 
 | ||||||
|  |             options.UseSqlServer(connectionString, | ||||||
|                                     sqlServerOptionsAction: sqlOptions => |                                     sqlServerOptionsAction: sqlOptions => | ||||||
|                                     { |                                     { | ||||||
|                                         sqlOptions.MigrationsAssembly(typeof(Program).GetTypeInfo().Assembly.GetName().Name); |                                         sqlOptions.MigrationsAssembly(typeof(Program).GetTypeInfo().Assembly.GetName().Name); | ||||||
| @ -86,4 +93,7 @@ | |||||||
| 
 | 
 | ||||||
|         return services; |         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, |   "AzureServiceBusEnabled": false, | ||||||
|   "AzureStorageEnabled": false, |   "AzureStorageEnabled": false, | ||||||
|   "SubscriptionClientName": "Catalog", |  | ||||||
|   "ApplicationInsights": { |   "ApplicationInsights": { | ||||||
|     "InstrumentationKey": "" |     "InstrumentationKey": "" | ||||||
|   }, |   }, | ||||||
| @ -36,10 +35,10 @@ | |||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   "ConnectionStrings": { |   "ConnectionStrings": { | ||||||
|     "Application": "" |     "CatalogDB": "" | ||||||
|   }, |   }, | ||||||
|   "EventBus": { |   "EventBus": { | ||||||
|     "SubscriptionClientName": "Basket", |     "SubscriptionClientName": "Catalog", | ||||||
|     "ConnectionString": "localhost", |     "ConnectionString": "localhost", | ||||||
|     "RetryCount": 5 |     "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", |   "ExternalCatalogBaseUrl": "http://localhost:5101", | ||||||
|   "IdentityUrl": "http://localhost:5105", |   "IdentityUrl": "http://localhost:5105", | ||||||
|   "isTest": "true", |   "isTest": "true", | ||||||
|   "EventBusConnection": "localhost", |  | ||||||
|   "PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/", |   "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