This commit adds extensive test coverage for the IncrByFloat Redis command,
covering various edge cases and scenarios that were not previously tested.
Test cases added:
- Negative increment values
- Zero increment (should return current value)
- High precision floating point operations
- Non-existent key behavior (should start from 0)
- Integer values stored as strings
- Scientific notation (both positive and negative)
- Error handling for non-numeric values
- Very large numbers (near float64 limits)
- Very small numbers (near zero precision)
These tests ensure robust behavior of the IncrByFloat command across
different numeric formats and edge conditions, improving the overall
reliability and test coverage of the go-redis library.
The tests use Gomega's BeNumerically matcher for floating point
comparisons to handle precision issues appropriately.
* Bumps test image to 8.2.1-pre
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Missed the “benchmark” job
Signed-off-by: Elena Kolevska <elena@kolevska.com>
---------
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* fix conflicts
* Fix JSON nil response handling
Ensure that JSON.GET returns redis.Nil for missing keys/paths,
making it consistent with other Redis commands.
- Restore proper nil detection logic in JSONCmd.readReply
- Add comprehensive test coverage for JSON nil scenarios
- Handle both non-existent keys and non-existent paths consistently
- Distinguish between empty arrays and nil responses
- Add documentation for Val() and Expanded() methods
Original work and problem identification by Nic Gibson.
Enhanced implementation with comprehensive testing and fixes
for the broken nil detection logic.
Fixes#2987
* Fix JSON nil response handling - align with Redis behavior
- Non-existent keys return redis.Nil (consistent with other Redis commands)
- Non-existent paths in existing keys return empty array '[]'
- Fix broken test that was using wrong doc1 reference
- Add comprehensive test coverage for JSON nil scenarios
This aligns with official Redis JSON.GET behavior:
- Missing keys should return nil error like other Redis commands
- Missing paths should return empty JSON array, not error
* Fix JSONDel tests
---------
Co-authored-by: Nic Gibson <nic.gibson@redis.com>
Co-authored-by: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com>
* Fix hard code of failing timeout
1. if not set failing time limit, default is 15 seconds.
* feat: Complete configurable FailingTimeoutSeconds implementation
---------
Co-authored-by: Shino Wu <shino_wu@trendmicro.com>
- replace two similar functions `appendUniqueNode` and `appendIfNotExists` with a generic function.
- simplify the implementation of the `get` method in `clusterNodes`
- keep the member name `_generation` of `clusterNodes` consistent with other types.
- rename a data member `_masterAddr` to `masterAddr`.
Signed-off-by: Xiaolong Chen <fukua95@gmail.com>
* updated stale issue policy
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Adds a temporary dry run
Signed-off-by: Elena Kolevska <elena@kolevska.com>
---------
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* fix(search): return results even if doc is empty
"If a relevant key expires while a query is running, an attempt to load
the key's value will return a null array. However, the key is still
counted in the total number of results." - Redis Search return
documentation
* fix(doctest): fix assertions in doctests
* Add support for new bitop operations
* chore(ci): Add 8.2 pre build for CI
* feat(info): add new client info keys
* fixed tests
* added godocs for bitop commands
---------
Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
Co-authored-by: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com>
- At present, the `scan` command is dispatched to a random slot.
- As far as I can tell, the scanX family of commands are not cluster aware (e.g. don't redirect the client to the correct slot).
- You can see [here](869dc0bb66/src/main/java/redis/clients/jedis/ShardedCommandObjects.java (L101)), the Jedis client calling `processKey` on the match argument, and this is what this PR also does.
We've had this patch running in production, and it seems to work well for us.
For further thought:
- Continuing looking at other Redis clients (e.g. Jedis), they outright [reject as invalid](869dc0bb66/src/main/java/redis/clients/jedis/ShardedCommandObjects.java (L98)) any scan command that does not include a hash-tag. Presumably this has the advantage of users not being surprised when their scan produces no results when a random server is picked.
- Perhaps it would be sensible for go-redis to do the same also?
Co-authored-by: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com>
* feat(redisotel): add WithCaller option
Allow the disabling the collection of the `code.function`, `code.filepath` and `code.lineno` tracing attributes.
When setting `WithCaller(false)` overall performance is increased as the "expensive" `runtime.Callers` and `runtime.(*Frames).Next` calls are no longer needed.
* chore(redisotel): improve docblock language
* chore(redisotel): rename `WithCaller` to `WithCallerEnabled`
---------
Co-authored-by: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com>
* fix(txpipeline): keyless commands should take the slot of the keyed commands
* fix(txpipeline): extract only keyed cmds from all cmds
* chore(test): Add tests for keyless cmds and txpipeline
* fix(cmdSlot): Add preferred random slot
* fix(cmdSlot): Add shortlist of keyless cmds
* chore(test): Fix ring test
* fix(keylessCommands): Add list of keyless commands
Add list of keyless Commands based on the Commands output
for redis 8
* chore(txPipeline): refactor slottedCommands impl
* fix(osscluster): typo