bitoffdev opened a new pull request #2058: URL: https://github.com/apache/hbase/pull/2058
Resolves https://issues.apache.org/jira/browse/HBASE-24722 ## Changelog - Prior to this commit, there were 13 commands that unintentionally return the number of lines they print (usually one). This commit ensures that they return the value documented by the help text, or nil if there is not a simple logical value to return. - Fixes 6 hbase-shell commands that return String rather than TrueClass or FalseClass - Use double-bang to cast truthy values to TrueClass and FalseClass so that ruby's to_s can reliably print true or false without using ternary operators - Updates tests for is_disabled, is_enabled, disable_rpc_throttle, enable_rpc_throttle, disable_exceed_throttle_quota, enable_exceed_throttle_quota, clear_deadservers, snapshot_cleanup_switch, snapshot_cleanup_enabled, and balancer to check return values - Adds new tests for balance_switch, balancer_enabled, normalizer_switch, normalizer_enabled, catalog_janitor_switch, catalogjanitor_enabled, cleaner_chore_switch, cleaner_chore_enabled, splitormerge_switch, and splitormerge_enabled _Note that the many assertions with explicit comparisons to booleans are intentional (ie. `assert(return_value == false)`). In ruby, this test makes sure that return value is actually an instance of TrueClass or FalseClass, which makes these tests much more potent. Since every ruby object can be cast to a boolean, we don't want to just `assert(return_value)`._ ## Testing - Of the 19 commands updated, 17 are covered by unit testing (a number of the unit tests are introduced by this PR). - I manually tested my changes to the 2 commands not covered by unit tests: normalize and clear_block_cache. I'd love to get these commands covered as well, but I believe that is out of scope for this ticket since testing those commands should be a little more extensive. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
