Чукарев Михаил Лаб. 3 Группа 6511#133
Open
Mishachuu wants to merge 29 commits into
Open
Conversation
Added details about the third laboratory work on integration testing, including descriptions of the file service, message broker, object storage, and integration tests.
danlla
requested changes
May 13, 2026
Comment on lines
+54
to
+61
| var replica = builder.AddProject<Projects.VehicleApi>($"vehicleapi-{serviceId++}") | ||
| .WithReference(cache) | ||
| .WithEnvironment("Sqs__ServiceUrl", sqsServiceUrl) | ||
| .WithEnvironment("Sqs__QueueUrl", sqsQueueUrl) | ||
| .WithHttpEndpoint(port: port, name: "api-endpoint", isProxied: false) | ||
| .WithExternalHttpEndpoints() | ||
| .WaitFor(cache) | ||
| .WaitFor(localstack); |
There was a problem hiding this comment.
Сейчас при запуске в консоли есть ошибки, связанные с тем, что не получается назначить 5000 порт всем 3 сервисам
происходит это из-за того, что в launchSettings.json файле VehicleApi 5000 задан по дефолту
поправить это можно двумя способами:
- явно переопределить 5000 порт на нужный:
var replica = builder.AddProject<Projects.VehicleApi>($"vehicleapi-{serviceId++}")
.WithReference(cache)
.WithEnvironment("Sqs__ServiceUrl", sqsServiceUrl)
.WithEnvironment("Sqs__QueueUrl", sqsQueueUrl)
.WithEndpoint("http", e =>
{
e.Port = port;
e.IsProxied = false;
})
.WithExternalHttpEndpoints()
.WaitFor(cache)
.WaitFor(localstack);- задать запускаемый профиль как
null:
var replica = builder.AddProject<Projects.VehicleApi>($"vehicleapi-{serviceId++}", launchProfileName: null)
.WithReference(cache)
.WithEnvironment("Sqs__ServiceUrl", sqsServiceUrl)
.WithEnvironment("Sqs__QueueUrl", sqsQueueUrl)
.WithHttpEndpoint(port: port, name: "api-endpoint", isProxied: false)
.WithExternalHttpEndpoints()
.WaitFor(cache)
.WaitFor(localstack);| ports = [5101, 5102, 5103]; | ||
|
|
||
| var gatewayPort = int.TryParse(builder.Configuration["ApiGateway:Port"], out var p) ? p : 5200; | ||
| var fileServicePort = int.TryParse(builder.Configuration["FileService:Port"], out var fp) ? fp : 5300; |
| var localstackEndpoint = localstack.GetEndpoint("api"); | ||
| var minioEndpoint = minio.GetEndpoint("api"); | ||
|
|
||
| var sqsServiceUrl = ReferenceExpression.Create($"http://{localstackEndpoint.Property(EndpointProperty.Host)}:{localstackEndpoint.Property(EndpointProperty.Port)}"); |
There was a problem hiding this comment.
Можно же просто .WithReference(localstack) сделать и в ConnectionStrings появится нужный url для подключения
| var fileService = builder.AddProject<Projects.FileService>("fileservice") | ||
| .WithEnvironment("Sqs__ServiceUrl", sqsServiceUrl) | ||
| .WithEnvironment("Sqs__QueueUrl", sqsQueueUrl) | ||
| .WithEnvironment("Minio__Endpoint", ReferenceExpression.Create($"{minioEndpoint.Property(EndpointProperty.Host)}:{minioEndpoint.Property(EndpointProperty.Port)}")) |
Comment on lines
+34
to
+46
| public async Task EnsureQueueExistsAsync() | ||
| { | ||
| try | ||
| { | ||
| var queueName = _queueUrl.Split('/').Last(); | ||
| await sqs.CreateQueueAsync(new Amazon.SQS.Model.CreateQueueRequest { QueueName = queueName }); | ||
| logger.LogInformation("SQS queue ensured by VehicleApi"); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| logger.LogWarning("Could not create queue: {Message}", ex.Message); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ФИО: Чукарев Михаил
Номер группы: 6511
Номер лабораторной: 3
Номер варианта: 17
Краткое описание предметной области: Транспортное средство
Краткое описание добавленных фич: Добавлен SQS брокер, MinIO хранилище и интеграционные тесты