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

Create Redis cluster in CI #150

Merged
merged 6 commits into from
Jul 18, 2023

Conversation

vearutop
Copy link
Member

No description provided.

@github-actions
Copy link

github-actions bot commented Jul 18, 2023

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 29 3025 (+87) 2215 (+64) 291 (+7) 519 (+16) 400 (+3) 80.3K (+3K)
Go (test) 8 (+1) 2445 (+890) 1961 (+713) 82 (+34) 402 (+143) 159 (+72) 72K (+27.7K)
Markdown 1 654 (+9) 485 (+8) 0 169 (+1) 0 24.6K (+459B)
Shell 1 (+1) 125 (+125) 105 (+105) 5 (+5) 15 (+15) 32 (+32) 3K (+3K)
YAML 4 355 (-9) 301 (-9) 16 38 0 13.3K (-3B)

@github-actions
Copy link

Go API Changes

# github.com/adjust/rmq/v5
## compatible changes
OpenClusterConnection: added
OpenConnectionWithRedisOptions: added

# summary
Inferred base version: v5.1.3
Suggested version: v5.2.0

@github-actions
Copy link

github-actions bot commented Jul 18, 2023

Benchmark Result

Benchmark diff with base branch
name     old time/op    new time/op    delta
Queue-2     204µs ± 8%     205µs ± 4%    ~     (p=0.662 n=6+5)

name     old alloc/op   new alloc/op   delta
Queue-2    39.2kB ± 7%    40.4kB ± 6%    ~     (p=0.180 n=6+6)

name     old allocs/op  new allocs/op  delta
Queue-2      91.0 ± 0%      93.7 ± 1%  +2.93%  (p=0.010 n=4+6)
Benchmark result
name     time/op
Queue-2   205µs ± 4%

name     alloc/op
Queue-2  40.4kB ± 6%

name     allocs/op
Queue-2    93.7 ± 1%

@github-actions
Copy link

Unit Test Coverage

total: (statements) 71.5%
changed lines: (statements) 77.8%, coverage is less than 90.0%, consider testing the changes more thoroughly

Coverage of changed lines
File Function Coverage
Total 77.8%
connection.go 88.9%
connection.go:75 OpenConnectionWithRedisOptions 100.0%
connection.go:93 OpenConnectionWithRmqRedisClient 100.0%
connection.go:98 OpenClusterConnection 100.0%
connection.go:102 openConnection 100.0%
connection.go:268 hijackConnection 100.0%
connection.go:306 openQueue 100.0%
connection.go:70 OpenConnection 0.0%
queue.go 100.0%
queue.go:66 newQueue 100.0%
redis_keys.go 100.0%
redis_keys.go:21 getTemplate 100.0%
redis_wrapper.go 100.0%
redis_wrapper.go:14 Set 100.0%
redis_wrapper.go:19 Del 100.0%
redis_wrapper.go:23 TTL 100.0%
redis_wrapper.go:27 LPush 100.0%
redis_wrapper.go:31 LLen 100.0%
redis_wrapper.go:35 LRem 100.0%
redis_wrapper.go:39 LTrim 100.0%
redis_wrapper.go:44 RPop 100.0%
redis_wrapper.go:48 RPopLPush 100.0%
redis_wrapper.go:61 SAdd 100.0%
redis_wrapper.go:65 SMembers 100.0%
redis_wrapper.go:69 SRem 100.0%
redis_wrapper.go:73 FlushDb 100.0%
test_util.go 38.9%
test_util.go:14 testRedis 69.2%
test_util.go:25 testClusterRedis 14.6%
Coverage diff with base branch
File Function Base Coverage Current Coverage
Total 72.2% 71.5% (-0.7%)
github.com/adjust/rmq/v5/connection.go OpenClusterConnection no function 100.0%
github.com/adjust/rmq/v5/connection.go OpenConnection 100.0% 0.0% (-100.0%)
github.com/adjust/rmq/v5/connection.go OpenConnectionWithRedisOptions no function 100.0%
github.com/adjust/rmq/v5/connection.go OpenConnectionWithRmqRedisClient 75.0% 100.0% (+25.0%)
github.com/adjust/rmq/v5/connection.go openConnection no function 75.0%
github.com/adjust/rmq/v5/queue.go batchTimeout 92.3% 84.6% (-7.7%)
github.com/adjust/rmq/v5/redis_keys.go getTemplate no function 100.0%
github.com/adjust/rmq/v5/test_batch_consumer.go Consume 85.7% 100.0% (+14.3%)
github.com/adjust/rmq/v5/test_util.go testClusterRedis no function 30.8%
github.com/adjust/rmq/v5/test_util.go testRedis no function 60.0%

@vearutop vearutop changed the base branch from master to 113-redis-cluster-support July 18, 2023 14:48
@vearutop vearutop marked this pull request as ready for review July 18, 2023 14:48
@vearutop vearutop changed the title Wip test redis cluster support Create Redis cluster in CI Jul 18, 2023
@vearutop vearutop merged commit d984c20 into 113-redis-cluster-support Jul 18, 2023
9 checks passed
@vearutop vearutop deleted the wip-test-redis-cluster-support branch July 18, 2023 14:49
vearutop added a commit that referenced this pull request Jul 20, 2023
* fix using another wrapper to fit redis cluster and redis single node;
fix using {} to replace [] - untested

* update test files with new openConn;

add queue_cluster_test.go

welle: Remove hardcoded connection options.

* Bring back the original OpenConnection() for compatibility

Add new function OpenConnectionWithOptions() for the new approach.

* Allow cluster tests to run against local cluster

* Remove RedisClusterWrapper again

Rename RedisSingleWrapper back to RedisWrapper

* Bring back original OpenConnectionWithRedisClient()

* Add OpenClusterConnection()

To allow opening RMQ connections which use the Redis hash tags {}
instead of []. This is required to make rmq work with Redis clusters.

This commit also reverts the behavior of all other OpenConnection[...]
functions to behave as before by still using [] instead of {}.

This switch is done by using different Redis key templates. For example
instead of

    rmq::connection::{connection}::queue::[{queue}]::consumers

we would use

    rmq::connection::{connection}::queue::{{queue}}::consumers

when using OpenClusterConnection()

* Document OpenClusterConnection() in README

* Use safe accessors in tests

* Update deps

* Create Redis cluster in CI (#150)

---------

Co-authored-by: zhanglei <luckforzhang@vip.qq.com>
Co-authored-by: Viacheslav Poturaev <vearutop@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant