38 Commits

Author SHA1 Message Date
bodong.ybd
cb4f96657b Tests: Some fixes for macOS
1) cur_test: when restart_server, "no such variable" error occurs
  ./runtest --single integration/rdb
  test {client freed during loading}
      SET ::cur_test
      restart_server
        kill_server
          test "Check for memory leaks (pid $pid)"
          SET ::cur_test
          UNSET ::cur_test
      UNSET ::cur_test // This global variable has been unset.

2) `ps --ppid` not available on macOS platform, can be replaced with
`pgrep -P pid`.

(cherry picked from commit e90385e2232d41fd7c40dc239279f9837e7bdf57)
2020-09-10 14:09:00 +03:00
Oran Agra
540841d6f7 Improve valgrind support for cluster tests (#7725)
- redirect valgrind reports to a dedicated file rather than console
- try to avoid killing instances with SIGKILL so that we get the memory
  leak report (killing with SIGTERM before resorting to SIGKILL)
- search for valgrind reports when done, print them and fail the tests
- add --dont-clean option to keep the logs on exit
- fix exit error code when crash is found (would have exited with 0)

changes that affect the normal redis test suite:
- refactor check_valgrind_errors into two functions one to search and
  one to report
- move the search half into util.tcl to serve the cluster tests too
- ignore "address range perms" valgrind warnings which seem non relevant.

(cherry picked from commit da723a917dec7f2514d821a615668e158bb4f60c)
2020-09-10 14:09:00 +03:00
Oran Agra
e001152825 test infra - wait_done_loading
reduce code duplication in aof.tcl.
move creation of clients into the test so that it can be skipped

(cherry picked from commit cc455a710cc68d0fd8243cd1f04c5ee7332e4fdb)
2020-09-10 14:09:00 +03:00
Oran Agra
60bec0c20c test infra - write test name to logfile
(cherry picked from commit e783c03dd1828fbf67259ee037a4faf835c4700a)
2020-09-10 14:09:00 +03:00
Oran Agra
10a8407a4f Fix failing tests due to issues with wait_for_log_message (#7572)
- the test now waits for specific set of log messages rather than wait for
  timeout looking for just one message.
- we don't wanna sample the current length of the log after an action, due
  to a race, we need to start the search from the line number of the last
  message we where waiting for.
- when attempting to trigger a full sync, use multi-exec to avoid a race
  where the replica manages to re-connect before we completed the set of
  actions that should force a full sync.
- fix verify_log_message which was broken and unused

(cherry picked from commit 06aaeabaea9d9b248e8a790dde352cd14d66628a)
2020-09-01 09:27:58 +03:00
Remi Collet
443e57b08e Fix deprecated tail syntax in tests (#7543)
(cherry picked from commit 7853d8410b12c3ffac699c8a2e06f2a8e6df26b0)
2020-09-01 09:27:58 +03:00
Oran Agra
c994e73c8e stabilize tests that look for log lines (#7367)
tests were sensitive to additional log lines appearing in the log
causing the search to come empty handed.

instead of just looking for the n last log lines, capture the log lines
before performing the action, and then search from that offset.

(cherry picked from commit efc4189b6227a17f26ed9bd6bbac62bf4bf7ab66)
2020-07-20 21:08:26 +03:00
Oran Agra
571b03021a tests: find_available_port start search from next port
i.e. don't start the search from scratch hitting the used ones again.
this will also reduce the likelihood of collisions (if there are any
left) by increasing the time until we re-use a port we did use in the
past.
2020-05-28 10:09:51 +02:00
Oran Agra
4653d796f0 tests: each test client work on a distinct port range
apparently when running tests in parallel (the default of --clients 16),
there's a chance for two tests to use the same port.
specifically, one test might shutdown a master and still have the
replica up, and then another test will re-use the port number of master
for another master, and then that replica will connect to the master of
the other test.

this can cause a master to count too many full syncs and fail a test if
we run the tests with --single integration/psync2 --loop --stop

see Probmem 2 in #7314
2020-05-28 10:09:51 +02:00
Yossi Gottlieb
10ffeb03e4 TLS: Connections refactoring and TLS support.
* Introduce a connection abstraction layer for all socket operations and
integrate it across the code base.
* Provide an optional TLS connections implementation based on OpenSSL.
* Pull a newer version of hiredis with TLS support.
* Tests, redis-cli updates for TLS support.
2019-10-07 21:06:13 +03:00
Oran Agra
73a945c73c prevent diskless replica from terminating on short read
now that replica can read rdb directly from the socket, it should avoid exiting
on short read and instead try to re-sync.

this commit tries to have minimal effects on non-diskless rdb reading.
and includes a test that tries to trigger this scenario on various read cases.
2019-07-17 16:46:22 +02:00
Oran Agra
29754ebe22 diskless replication on slave side (don't store rdb to file), plus some other related fixes
The implementation of the diskless replication was currently diskless only on the master side.
The slave side was still storing the received rdb file to the disk before loading it back in and parsing it.

This commit adds two modes to load rdb directly from socket:
1) when-empty
2) using "swapdb"
the third mode of using diskless slave by flushdb is risky and currently not included.

other changes:
--------------
distinguish between aof configuration and state so that we can re-enable aof only when sync eventually
succeeds (and not when exiting from readSyncBulkPayload after a failed attempt)
also a CONFIG GET and INFO during rdb loading would have lied

When loading rdb from the network, don't kill the server on short read (that can be a network error)

Fix rdb check when performed on preamble AOF

tests:
run replication tests for diskless slave too
make replication test a bit more aggressive
Add test for diskless load swapdb
2019-07-08 15:37:48 +03:00
Oran Agra
05d6b8b9ae fix small test suite race conditions 2018-11-12 10:26:10 +02:00
antirez
dc475bcedd Test: fix lshuffle by providing the "K" combinator. 2018-07-13 17:52:39 +02:00
antirez
51bb49d8f2 Test: add lshuffle in the Tcl utility functions set. 2018-07-13 17:51:03 +02:00
antirez
0aa35539c6 Test: csvdump now scans all DBs. 2015-08-05 12:27:15 +02:00
Mariano Pérez Rodríguez
144922a63e Stop tests from leaving a black background
Uses ANSI "default background" color code after closing tests
so any non-black terminals don't remain polluted.

Fixes #1649
Closes #1912
2014-08-25 10:14:03 +02:00
antirez
383536119d Test: AOF rewrite during write load. 2014-07-10 11:25:12 +02:00
antirez
e2078f8001 Test: find_available_port: check that cluster port is free as well.
The function will only return ports that have also port+10000 free, so
that Redis Cluster instances can be executed at the returned port.
2014-06-30 12:08:24 +02:00
antirez
e3c7c1ebd5 Test: colorstr moved to util.tcl. 2014-02-17 17:36:50 +01:00
antirez
5917f2c5c5 Test: code to test server availability refactored.
Some inline test moved into server_is_up procedure.
Also find_available_port was moved into util since it is going
to be used for the Sentinel test as well.
2014-02-17 16:44:57 +01:00
antirez
31f34595c6 Test: randomInt() behavior commented. 2013-06-25 15:32:37 +02:00
antirez
c1be7c2610 New test: hash ziplist -> hashtable encoding conversion.
A new stress test was added to stress test the code converting a ziplist
into an hash table.

In this commit also randomValue helper function was modified to also
return negative values.
2012-06-11 15:19:46 +02:00
antirez
7f255aac59 EVAL replication test: less false positives.
wait_for_condition is now used instead of the usual "after 1000" (that
is the way to sleep in Tcl). This should avoid to find the replica in
a state where it is loading the RDB in memory, returning -LOADING error.

This test used to fail when running the test over valgrind, due to the
added latencies.
2012-06-02 23:29:57 +02:00
antirez
f2ca912f74 Tests modified to account for INFO fields renaming.
Commit 2f22d57a5219aaabe088cc4e64624d3d3fccf760 modified the name of a
few INFO fields. This commit changes the Redis test to account for this
changes.
2012-05-25 15:20:59 +02:00
antirez
ccc9234552 Redis test: include bug report on crash.
Due to a change in the format of the bug report in case of crash of
failed assertion the test suite was no longer able to properly log it.
Instead just a protocol error was logged by the Redis TCL client that
provided no clue about the actual problem.

This commit resolves the issue by logging everything from the first line
of the log including the string REDIS BUG REPORT, till the end of the
file.
2012-05-22 13:13:24 +02:00
antirez
26d2ed1ce4 more valgrind (and other archs) friendly testing of floating number related features. 2011-11-16 14:40:50 +01:00
Pieter Noordhuis
0dc602e3b5 Be less verbose in testing; improve error handling 2010-12-10 16:13:21 +01:00
antirez
e039e0488b minor test suite bug fixed 2010-11-04 10:48:49 +01:00
antirez
6146329f1f replication test with expires 2010-08-03 13:38:39 +02:00
antirez
a0573260b0 better random dataset creation function in test. master-slave replication test now is able to save the two datasets in CSV when an inconsistency is detected. 2010-07-28 14:08:46 +02:00
antirez
dd3f505ff5 Consistency test improved 2010-07-27 14:42:11 +02:00
antirez
b056ca39f2 improved random dataset creation in test: del, sunionstore, zunionstore 2010-07-06 18:30:38 +02:00
Pieter Noordhuis
53cbf66caf initial tests for AOF (and small changes to server.tcl to support these) 2010-05-19 14:54:20 +02:00
Pieter Noordhuis
fdfb02e7ff print warnings in redis log when a test raises an exception (very likely to be caused by something like a failed assertion) 2010-05-15 23:48:08 +02:00
Pieter Noordhuis
85ecc65edc initial rough integration test for replication 2010-05-14 20:50:58 +02:00
Pieter Noordhuis
9cf9e6f197 proc to retrieve values from INFO properties 2010-05-14 20:48:57 +02:00
antirez
ab72b4833d minor fixes to the new test suite, html doc updated 2010-05-14 18:48:33 +02:00