feat: mock logs

This commit is contained in:
Kirill 2023-06-20 13:00:21 +03:00
parent a9f2a70550
commit e66343086e
2 changed files with 16 additions and 5 deletions

@ -17,12 +17,12 @@ services:
- GRPC_PORT=9085
- IS_MOCK=true
- MOCK_SERVICE_HOST=http://treasurer-mock:8080
- MOCK_SERVICE_HOST=http://treasurer-mock-service:8080
- YOOMONEY_STORE_ID=id
- YOOMONEY_SECRET_KEY=secret
- YOOMONEY_WEBHOOKS_URL=http://treasurer-mock:8080/webhooks
- YOOMONEY_PAYMENTS_URL=http://treasurer-mock:8080/payments
- YOOMONEY_WEBHOOKS_URL=http://treasurer-mock-service:8080/webhooks
- YOOMONEY_PAYMENTS_URL=http://treasurer-mock-service:8080/payments
- MONGO_HOST=mongo
- MONGO_PORT=27017
@ -39,6 +39,7 @@ services:
- treasurer-mock
treasurer-mock:
hostname: treasurer-mock-service
container_name: treasurermock-container
image: 'wiremock/wiremock:2.35.0'
ports:

@ -92,13 +92,23 @@ func (receiver *YoomoneyMockService) RegisterPayments(host string) errors.Error
AtPriority(1)
if err := mockClient.StubFor(rule); err != nil {
receiver.logger.Error("failed to init payment mock handler on <RegisterPayment> of <YoomoneyMockService>", zap.Error(err))
receiver.logger.Error("failed to init payment mock handler on <RegisterPayment> of <YoomoneyMockService>",
zap.Error(err),
zap.String("payments full url", receiver.yoomoneyURL.Payments),
zap.String("payments path", paymentsURL.Path),
)
return errors.NewWithError(fmt.Errorf("failed to init payment mock handler: %w", err), errors.ErrInternalError)
}
isVerified, err := mockClient.Verify(wiremock.NewRequest("post", wiremock.URLPathEqualTo(paymentsURL.Path)), 0)
if err != nil {
receiver.logger.Error("failed to verify payment mock handler on <RegisterPayment> of <YoomoneyMockService>", zap.Error(err))
receiver.logger.Error("failed to verify payment mock handler on <RegisterPayment> of <YoomoneyMockService>",
zap.Error(err),
zap.String("payments full url", receiver.yoomoneyURL.Payments),
zap.String("payments path", paymentsURL.Path),
)
return errors.NewWithError(fmt.Errorf("failed to verify payment mock handler: %w", err), errors.ErrInternalError)
}