650 Commits

Author SHA1 Message Date
antirez
7e0ea8b30d Test: fix SPOP replication test count.
If count is 0 SADD is called without element arguments, which is
currently invalid.
2015-03-13 17:30:13 +01:00
antirez
5f6292f980 Test: HSTRLEN stress test of corner cases.
Main point here is to correctly report LLONG_MIN length, since to take
the absolute value we need care in sdigits10().
2015-02-27 15:44:44 +01:00
antirez
d4a13bd2f4 Hash: HSTRLEN (was HVSTRLEN) improved.
1. HVSTRLEN -> HSTRLEN. It's unlikely one needs the length of the key,
   not clear how the API would work (by value does not make sense) and
   there will be better names anyway.
2. Default is to return 0 when field is missing.
3. Default is to return 0 when key is missing.
4. The implementation was slower than needed, and produced unnecessary COW.

Related issue #2415.
2015-02-27 15:31:55 +01:00
Salvatore Sanfilippo
261b9d1b0f Merge pull request #2415 from landmime/unstable
added a new hvstrlen command
2015-02-27 15:24:04 +01:00
antirez
d5efd018cf Test: fixes a few tests after basic unit refactoring. 2015-02-25 10:37:52 +01:00
antirez
5b562e64a0 Test: split basic unit into string, incr, keyspace units. 2015-02-25 10:33:29 +01:00
antirez
fa8fcff3f0 Change RENAME behavior when src and dst keys are the same.
Fixes issue #2392.
2015-02-23 11:24:24 +01:00
Jason Roth
6cc1d51719 added a new hvstrlen command
the hvstrlen command returns the length of a hash field value
2015-02-21 15:01:18 +00:00
antirez
45a1c66553 SPOP replication tests. 2015-02-11 10:52:28 +01:00
antirez
b842565acb SPOP explicit tests for the three different code paths. 2015-02-11 10:52:28 +01:00
antirez
38afac7752 alsoPropagate: handle REDIS_CALL_PROPAGATE and AOF loading. 2015-02-11 10:52:28 +01:00
antirez
ce54260321 Faster memory efficiency test.
This test on Linux was extremely slow, since in Tcl we can't enable
easily tcp-nodelay, so the busy loop used to take *a lot* with bigger
writes. Fixed using pipelining.
2015-02-10 14:47:45 +01:00
antirez
41d0e80ec3 Added regression test for issue #2371. 2015-02-10 14:40:27 +01:00
antirez
d7d689e5cf Fix RDB corruption test after server behavior change. 2015-02-04 11:53:19 +01:00
antirez
a301cd0de4 Avoid duplicated instance execution code in Cluster test. 2015-01-22 18:59:39 +01:00
antirez
46670cd1ff Cluster test: when valgrind is enabled, use a larger node-timeout.
Removes some percentage of timing related failures.
2015-01-22 16:08:21 +01:00
antirez
ebe1f52ddb Cluster test initialization: use transaction for reset + set-config-epoch.
Otherwise between the two commands other nodes may contact us making the
next SET-CONFIG-EPOCH call impossible.
2015-01-21 18:48:08 +01:00
antirez
3f759958ac Cluster test: wait for port to unbound in kill_instance.
Otherwise kill_instance + restart_instance in short succession will
still find the port busy and will fail.
2015-01-21 16:47:36 +01:00
antirez
b71060f360 Cluster/Sentinel test: also pause on abort_sentinel_test call. 2015-01-21 16:18:34 +01:00
antirez
507ca219b4 Cluster/Sentinel test: pause on exceptions as well. 2015-01-21 16:13:30 +01:00
Matt Stancliff
e240d16cc9 Add --track-origins=yes to valgrind 2015-01-21 15:48:19 +01:00
Matt Stancliff
52aa050a79 Tell sentinel/cluster tests to allow valgrind 2015-01-21 15:04:12 +01:00
antirez
72640fe5fc Cluster test: also write from Lua script in resharding test. 2015-01-09 11:23:22 +01:00
Matt Stancliff
16cda6f076 Config: Add quicklist, remove old list options
This removes:
  - list-max-ziplist-entries
  - list-max-ziplist-value

This adds:
  - list-max-ziplist-size
  - list-compress-depth

Also updates config file with new sections and updates
tests to use quicklist settings instead of old list settings.
2015-01-02 11:16:10 -05:00
Matt Stancliff
6abb134d6e Increase test size for migrating large values
Previously, the old test ran 5,000 loops and used about 500k.

With quicklist, storing those same 5,000 loops takes up 24k, so the
"large value check" failed!

This increases the test to 20,000 loops which makes the object dump 96k.
2015-01-02 11:16:09 -05:00
Matt Stancliff
e24ef16446 Add quicklist implementation
This replaces individual ziplist vs. linkedlist representations
for Redis list operations.

Big thanks for all the reviews and feedback from everybody in
https://github.com/antirez/redis/pull/2143
2015-01-02 11:16:08 -05:00
Alon Diamant
582c15db57 Added <count> parameter to SPOP:
spopCommand() now runs spopWithCountCommand() in case the <count> param is found.
Added intsetRandomMembers() to Intset: Copies N random members from the set into inputted 'values' array. Uses either the Knuth or Floyd sample algos depending on ratio count/size.
Added setTypeRandomElements() to SET type: Returns a number of random elements from a non empty set. This is a version of setTypeRandomElement() that is modified in order to return multiple entries, using dictGetRandomKeys() and intsetRandomMembers().
Added tests for SPOP with <count>: unit/type/set, unit/scripting, integration/aof
--
Cleaned up code a bit to match with required Redis coding style
2014-12-14 12:25:42 +02:00
Salvatore Sanfilippo
55d0a99c09 Merge pull request #2094 from mattsta/nosort
Fix zero-ordering SORT when called against lists
2014-12-11 15:54:39 +01:00
antirez
ac6a7e5925 Regression test for issue #2175. 2014-12-03 10:38:56 +01:00
antirez
e346d72200 Test: wait for actual startup in start_server.
start_server now uses return value from Tcl exec to get the server pid,
however this introduces errors that depend from timing: a lot of the
testing code base assumed the server to be actually up and running when
server_start returns.

So the old code that waits to see the pid in the log file was restored.
2014-11-28 11:49:26 +01:00
antirez
820d9dd5cb Test: try to cleanup still running Redis instances on exit.
It's hard to run the Redis test continuously if it leaks processes on
exceptions / errors.
2014-11-28 11:38:17 +01:00
antirez
bf470753ee Test framework: exit on timeout with report.
There was no sane way to detect tests that may never end because of
Redis bugs or tests bugs.
2014-11-28 11:05:58 +01:00
antirez
013fc0ad58 Attempt to prevent false positives in replication test. 2014-11-24 11:54:56 +01:00
antirez
35591ab436 Merge remote-tracking branch 'origin/unstable' into unstable 2014-11-14 17:10:48 +01:00
Matt Stancliff
f23ce6b19a Lua: add cmsgpack scripting tests
Basically: test to make sure we can load cmsgpack
and do some sanity checks to make sure pack/unpack works
properly.  We also have a bonus test for circular encoding
and decoding because I was curious how it worked.
2014-11-14 17:08:57 +01:00
Matt Stancliff
4c0a54b852 Lua: add cjson scripting test
Two simple decode tests added mainly to check that
the 'cjson' global gets registered and is usable.
2014-11-14 17:08:22 +01:00
Salvatore Sanfilippo
73036e808d Merge pull request #1662 from mattsta/lua-add-bitops
Lua: Add bitop
2014-11-14 17:05:28 +01:00
Matt Stancliff
be7f7a56a0 Fix zero-ordering SORT when called against lists
People mostly use SORT against lists, but our prior
behavior was pretending lists were an unordered bag
requiring a forced-sort when no sort was requested.

We can just use the native list ordering to ensure
consistency across replicaion and scripting calls.

Closes #2079
Closes #545 (again)
2014-10-29 14:57:35 -04:00
antirez
6028313f90 Merge branch 'memsync' into unstable 2014-10-29 14:25:18 +01:00
antirez
6982032cc0 Diskless replication tested with the multiple slaves consistency test. 2014-10-24 09:49:26 +02:00
Matt Stancliff
c3d2758a14 Lua: Add bitop
A few people have written custom C commands because bit
manipulation isn't exposed through Lua.  Let's give
them Mike Pall's bitop.

This adds bitop 1.0.2 (2012-05-08) from http://bitop.luajit.org/

bitop is imported as "bit" into the global namespace.

New Lua commands: bit.tobit, bit.tohex, bit.bnot, bit.band, bit.bor, bit.bxor,
bit.lshift, bit.rshift, bit.arshift, bit.rol, bit.ror, bit.bswap

Verification of working (the asserts would abort on error, so (nil) is correct):
127.0.0.1:6379> eval "assert(bit.tobit(1) == 1); assert(bit.band(1) == 1); assert(bit.bxor(1,2) == 3); assert(bit.bor(1,2,4,8,16,32,64,128) == 255)" 0
(nil)
127.0.0.1:6379> eval 'assert(0x7fffffff == 2147483647, "broken hex literals"); assert(0xffffffff == -1 or 0xffffffff == 2^32-1, "broken hex literals"); assert(tostring(-1) == "-1", "broken tostring()"); assert(tostring(0xffffffff) == "-1" or tostring(0xffffffff) == "4294967295", "broken tostring()")' 0
(nil)

Tests also integrated into the scripting tests and can be run with:
./runtest --single unit/scripting

Tests are excerpted from `bittest.lua` included in the bitop distribution.
2014-10-09 11:51:30 -04:00
antirez
46d25757c4 Cluster test: helpers/onlydots.tcl: detect EOF and exit. 2014-10-08 10:17:01 +02:00
antirez
c6a0f01831 Cluster test: less console-spammy resharding test. 2014-10-08 10:12:40 +02:00
Salvatore Sanfilippo
df989ce8fa Merge pull request #1902 from mattsta/comment-fixes
ALL comment fixes
2014-10-06 09:44:54 +02:00
antirez
41f59ee225 Test: check that INCR object sharing works as expected. 2014-10-03 12:28:56 +01:00
Matt Stancliff
5fab7e5bf2 Remove trailing spaces from tests 2014-09-29 06:49:08 -04:00
Matt Stancliff
a5042b6c9d Fix spelling in some test cases 2014-09-29 06:49:08 -04:00
Matt Stancliff
a13ea7e6d4 Spell software correctly 2014-09-29 06:49:07 -04:00
Aaron Rutkovsky
bd82bd65c0 Fix typos
Closes #1513
2014-09-29 06:49:07 -04:00
antirez
7586f21c25 Better truncated AOF loading tests.
Now there are tests to write more data after loading a truncated AOF,
testing that the loaded data is correct, appending more, and testing
again.
2014-09-16 11:05:12 +02:00