diff --git a/Makefile b/Makefile index 3de76f18..27ca52ce 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,7 @@ jepsen_test: timeout 600 docker exec mysync_mysql2_1 sh -c "/var/lib/dist/base/generate_certs.sh mysync_mysql2_1.mysync_mysql_net && supervisorctl restart mysync && supervisorctl start mysqld" timeout 600 docker exec mysync_mysql3_1 sh -c "/var/lib/dist/base/generate_certs.sh mysync_mysql3_1.mysync_mysql_net && supervisorctl restart mysync && supervisorctl start mysqld" timeout 600 docker exec mysync_mysql1_1 setup.sh + timeout 600 bash ./tests/images/copy_keys.sh mkdir -p ./tests/logs (docker exec mysync_jepsen_1 /root/jepsen/run.sh > ./tests/logs/jepsen.log 2>&1 && tail -n 4 ./tests/logs/jepsen.log) || ./tests/images/jepsen_main/save_logs.sh docker compose -p mysync -f ./tests/images/jepsen-compose.yml down --rmi all diff --git a/tests/images/copy_keys.sh b/tests/images/copy_keys.sh new file mode 100755 index 00000000..aec153ad --- /dev/null +++ b/tests/images/copy_keys.sh @@ -0,0 +1,13 @@ +for i in mysql1 mysql2 mysql3; do + docker exec mysync_${i}_1 rm /root/.ssh/id_rsa + docker exec mysync_${i}_1 ssh-keygen -m PEM -t rsa -b 2048 -N '' -C root@mysync_${i}_1 -f /root/.ssh/id_rsa +done + +for i in mysql1 mysql2 mysql3; do + docker cp mysync_${i}_1:/root/.ssh/id_rsa.pub id_rsa.pub + for j in mysql1 mysql2 mysql3; do + docker exec mysync_${j}_1 /bin/bash -c "echo '$(cat id_rsa.pub)' >>/root/.ssh/authorized_keys" + done +done + +rm id_rsa.pub diff --git a/tests/images/jepsen_common/sshd_config b/tests/images/jepsen_common/sshd_config index 9bf6cd33..966d45a4 100644 --- a/tests/images/jepsen_common/sshd_config +++ b/tests/images/jepsen_common/sshd_config @@ -5,6 +5,6 @@ X11Forwarding yes PrintMotd no AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server -PubkeyAcceptedAlgorithms ssh-rsa +PubkeyAcceptedAlgorithms +ssh-rsa PermitRootLogin yes MaxAuthTries 1000000 diff --git a/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj b/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj index af153303..e6470af9 100644 --- a/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj +++ b/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj @@ -93,15 +93,16 @@ (try (with-conn [c conn] (case (:f op) - :read (cond (= (count (j/query c ["show slave status for channel ''"])) 0) + :read (timeout 60000 (assoc op :type :info, :error "read-timeout") + (cond (= (count (j/query c ["show slave status for channel ''"])) 0) (assoc op :type :ok, :value (->> (j/query c ["select value from test1.test_set"] {:row-fn :value}) (vec) (set))) true - (assoc op :type :info, :error "read-only")) - :add (timeout 5000 (assoc op :type :info, :error "timeout") + (assoc op :type :info, :error "read-only"))) + :add (timeout 5000 (assoc op :type :info, :error "add-timeout") (do (info (str "Adding: " (get op :value) " to " (get c :subname))) (j/execute! c [(str "insert into test1.test_set values ('" (get op :value) "')")]) @@ -266,9 +267,9 @@ (fn [] (map gen/once [{:type :info, :f (rand-nth nemesis-starts)} {:type :info, :f (rand-nth nemesis-starts)} - {:type :sleep, :value 120} + {:type :sleep, :value 60} {:type :info, :f :stop} - {:type :sleep, :value 120}]))) + {:type :sleep, :value 60}]))) (gen/time-limit 7200)) (->> r (gen/stagger 1)