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

Fix unstable test cases #896

Merged
merged 2 commits into from Mar 30, 2020
Merged

Conversation

supercaracal
Copy link
Contributor

@supercaracal supercaracal commented Mar 28, 2020

The following test case have been becoming unstable since I added several replica and Sentinel nodes for test. (ref: #816 #895)

def test_info_commandstats
target_version "2.5.7" do
r.nodes.each { |n| n.config(:resetstat) }
r.ping # Executed on every node
r.info(:commandstats).each do |info|
assert_equal "1", info["ping"]["calls"]
end
end
end

Sentinels keep pinging to the node for monitoring. So the stats was unintentionally incremented. I modified as not using PING stats.

irb(main):032:0> r.info(:commandstats).keys
=> ["publish", "ping", "info", "replconf", "config"]
irb(main):033:0> r.info(:commandstats)['ping']
=> {"calls"=>"51", "usec"=>"109", "usec_per_call"=>"2.14"}

irb(main):034:0> r.info(:commandstats)['ping']
=> {"calls"=>"56", "usec"=>"116", "usec_per_call"=>"2.07"}

irb(main):035:0> r.info(:commandstats)['ping']
=> {"calls"=>"63", "usec"=>"127", "usec_per_call"=>"2.02"}
irb(main):057:0> r.config :resetstat
=> "OK"

irb(main):058:0> r.info(:commandstats)['config']
=> {"calls"=>"1", "usec"=>"18", "usec_per_call"=>"18.00"}

irb(main):059:0> r.info(:commandstats)['config']
=> {"calls"=>"1", "usec"=>"18", "usec_per_call"=>"18.00"}

irb(main):060:0> r.config :get, 'port'
=> {"port"=>"6381"}

irb(main):061:0> r.info(:commandstats)['config']
=> {"calls"=>"2", "usec"=>"46", "usec_per_call"=>"23.00"}

@supercaracal supercaracal changed the title Fix a unstable test case Fix unstable test cases Mar 28, 2020
@byroot byroot merged commit 45666da into redis:master Mar 30, 2020
@byroot
Copy link
Collaborator

byroot commented Mar 30, 2020

Thanks a lot!

@supercaracal supercaracal deleted the fix-a-unstable-test-case branch March 30, 2020 13:20
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

2 participants