Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(service_mock): set server address from argument #107

Merged
merged 4 commits into from
Nov 23, 2021

Conversation

33r01b
Copy link
Contributor

@33r01b 33r01b commented Nov 9, 2021

Привет, хотелось бы управлять адресом поднимаемого мок сервера через аргументы, тк в моем случае тестируемый сервис находится вне сервиса откуда запускаются тесты (другой контейнер) и поэтому мне нужно предопределить адрес мок сервера при старте тестируемого сервиса

@@ -26,8 +26,7 @@ func NewServiceMock(serviceName string, mock *definition) *ServiceMock {
}
}

func (m *ServiceMock) StartServer() error {
addr := "localhost:0" // loopback, random port
func (m *ServiceMock) StartServer(addr string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Привет. Метод StartServer публичный и добавление в него нового параметра сломает обратную совместимость. Хотелось бы этого избежать.
Давай добавим отдельный метод StartServerWithAddr или StartWithAddr который будет принимать адрес.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, это решение будет получше, добавил метод StartServerWithAddr

@33r01b 33r01b requested a review from fetinin November 23, 2021 19:11
@fetinin fetinin changed the title refactor(service_mock): set server address from argument (service_mock): set server address from argument Nov 23, 2021
@fetinin fetinin added enhancement New feature or request minor release as minor labels Nov 23, 2021
@fetinin fetinin merged commit d19e9cc into lamoda:master Nov 23, 2021
@github-actions
Copy link

🚀 PR was released in v1.8.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor release as minor released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants