propagate.tcl 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. set testmodule [file normalize tests/modules/propagate.so]
  2. tags "modules" {
  3. test {Modules can propagate in async and threaded contexts} {
  4. start_server {} {
  5. set replica [srv 0 client]
  6. set replica_host [srv 0 host]
  7. set replica_port [srv 0 port]
  8. start_server [list overrides [list loadmodule "$testmodule"]] {
  9. set master [srv 0 client]
  10. set master_host [srv 0 host]
  11. set master_port [srv 0 port]
  12. # Start the replication process...
  13. $replica replicaof $master_host $master_port
  14. wait_for_sync $replica
  15. after 1000
  16. $master propagate-test
  17. wait_for_condition 5000 10 {
  18. ([$replica get timer] eq "10") && \
  19. ([$replica get a-from-thread] eq "10")
  20. } else {
  21. fail "The two counters don't match the expected value."
  22. }
  23. $master propagate-test-2
  24. $master propagate-test-3
  25. $master multi
  26. $master propagate-test-2
  27. $master propagate-test-3
  28. $master exec
  29. wait_for_ofs_sync $master $replica
  30. assert_equal [s -1 unexpected_error_replies] 0
  31. }
  32. }
  33. }
  34. }
  35. tags "modules aof" {
  36. test {Modules RM_Replicate replicates MULTI/EXEC correctly} {
  37. start_server [list overrides [list loadmodule "$testmodule"]] {
  38. # Enable the AOF
  39. r config set appendonly yes
  40. r config set auto-aof-rewrite-percentage 0 ; # Disable auto-rewrite.
  41. waitForBgrewriteaof r
  42. r propagate-test-2
  43. r propagate-test-3
  44. r multi
  45. r propagate-test-2
  46. r propagate-test-3
  47. r exec
  48. # Load the AOF
  49. r debug loadaof
  50. assert_equal [s 0 unexpected_error_replies] 0
  51. }
  52. }
  53. }