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

feature: redis fixtures support #176

Merged
merged 1 commit into from Aug 11, 2022
Merged

Conversation

anemtarev
Copy link

Add redis fixtures support.
All major redis types are supported:

  • Key/value
  • Set
  • Hash
  • List
  • ZSet

Also implement the way to use custom fixture loader for gonkey library mode. That allows usage third-party fixture loaders for tests.

fixtures/aerospike/aerospike.go Show resolved Hide resolved
fixtures/redis/parser/fixture.go Outdated Show resolved Hide resolved
README-ru.md Outdated
- `-db_dsn <...>` dsn для вашей тестовой SQL базы данных (бд будет очищена перед наполнением!), поддерживается только PostgreSQL
- `-aerospike_host <...>` при использовании Aerospike - URL для подключения к нему в формате `host:port/namespace`
- `-redis_addr <...>` при использовании Redis - адрес для подключения к Redis в формате `host:port`
Copy link

Choose a reason for hiding this comment

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

я бы сделал наверное возможность полную ссылку писать (redis://...),
go-redis/redis умеет из ссылки парсить достаточное большое кол-во параметров, чтобы потом не возиться с паролями и прочим

Copy link
Author

Choose a reason for hiding this comment

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

Как я понял с паролями в адресе он работать не может к сожалению. Пароль и пользователь передаются в отдельных параметрах.

Copy link

Choose a reason for hiding this comment

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

У go-redis есть функция ParseURL я бы заиспользовал ее. Да и вообще впринципе URL проще расширять при необходимости в обратно совместимом режиме, не добавляя новые параметры. В горедис достаточная функция, но вроде без поддержки кластера/сентинела, что впринципе для тестирования не нужно. В крайнем случае можно будет реализовать парсинг ссылки самостоятельно потом и сделать UniversalClient.

Copy link
Author

Choose a reason for hiding this comment

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

сделал на основе ParseURL

Copy link

Choose a reason for hiding this comment

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

Назвал бы тогда redis_url

Copy link
Author

Choose a reason for hiding this comment

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

Сделал

@anemtarev anemtarev force-pushed the redis_fixtures branch 2 times, most recently from c52c022 to 44824b9 Compare August 8, 2022 22:31
@vitkarpenko vitkarpenko merged commit 757322f into lamoda:master Aug 11, 2022
@github-actions
Copy link

🚀 PR was released in v1.18.3 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants