From 6a22f40132f3e04b285b1c81f62f74a25cab7ae3 Mon Sep 17 00:00:00 2001 From: noname0443 Date: Fri, 13 Sep 2024 17:04:39 +0300 Subject: [PATCH] jepsen fix --- tests/images/jepsen_common/Dockerfile | 3 +-- .../jepsen_main/jepsen/src/jepsen/mysync.clj | 2 +- tests/images/jepsen_main/save_logs.sh | 20 +++++++++---------- tests/images/jepsen_sshd_config | 10 ++++++++++ tests/images/mysql_jepsen/Dockerfile | 1 + tests/images/zookeeper_jepsen/Dockerfile | 2 ++ 6 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 tests/images/jepsen_sshd_config diff --git a/tests/images/jepsen_common/Dockerfile b/tests/images/jepsen_common/Dockerfile index fa02b69e..dd309799 100644 --- a/tests/images/jepsen_common/Dockerfile +++ b/tests/images/jepsen_common/Dockerfile @@ -1,7 +1,6 @@ FROM mysync-test-base:latest -RUN (yes | ssh-keygen -t rsa -N '' -f /root/test_ssh_key -C jepsen || true) && \ +RUN (yes | ssh-keygen -m PEM -t rsa -b 2048 -N '' -f /root/test_ssh_key -C root@mysync_jepsen_1 || true) && \ eval `ssh-agent -s` && cp /root/test_ssh_key.pub /root/.ssh/authorized_keys && \ cp /root/test_ssh_key.pub /root/.ssh/id_rsa.pub && \ cp /root/test_ssh_key /root/.ssh/id_rsa && ssh-add -k /root/.ssh/id_rsa - COPY ./ssh_config /etc/ssh/ssh_config diff --git a/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj b/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj index c9beaf4a..6f384529 100644 --- a/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj +++ b/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj @@ -249,7 +249,7 @@ :name "mysync" :os os/noop :db (db) - :ssh {:private-key-path "/root/.ssh/id_rsa"} + :ssh {:private-key-path "/root/.ssh/id_rsa" :strict-host-key-checking :no} :net net/iptables :client (mysql-client nil) :nemesis (nemesis/compose {{:start-halves :start} (nemesis/partition-random-halves) diff --git a/tests/images/jepsen_main/save_logs.sh b/tests/images/jepsen_main/save_logs.sh index 21e15ccc..08065b22 100755 --- a/tests/images/jepsen_main/save_logs.sh +++ b/tests/images/jepsen_main/save_logs.sh @@ -1,17 +1,17 @@ #!/bin/bash -for i in 1 2 3 -do - mkdir -p tests/logs/mysql${i} - mkdir -p tests/logs/zookeeper${i} +for i in 1 2 3; do + mkdir -p tests/logs/mysql${i} + mkdir -p tests/logs/zookeeper${i} - for logfile in /var/log/mysync.log /var/log/mysql/error.log /var/log/mysql/query.log /var/log/resetup.log /var/log/supervisor.log - do - logname=$(echo "${logfile}" | rev | cut -d/ -f1 | rev) - docker exec mysync_mysql${i}_1 cat "${logfile}" > "tests/logs/mysql${i}/${logname}" - done + queries=$(docker exec mysync_mysql${i}_1 bash -c 'ls /var/log/mysql/ -d /var/log/mysql/* | sed 1d') - docker exec mysync_zoo${i}_1 cat /var/log/zookeeper/zookeeper--server-mysync_zookeeper${i}_1.log > tests/logs/zookeeper${i}/zk.log 2>&1 + for logfile in /var/log/mysync.log /var/log/mysql/error.log $queries /var/log/resetup.log /var/log/supervisor.log; do + logname=$(echo "${logfile}" | rev | cut -d/ -f1 | rev) + docker exec mysync_mysql${i}_1 cat "${logfile}" >"tests/logs/mysql${i}/${logname}" + done + + docker exec mysync_zoo${i}_1 cat /var/log/zookeeper/zookeeper--server-mysync_zookeeper${i}_1.log >tests/logs/zookeeper${i}/zk.log 2>&1 done tail -n 18 tests/logs/jepsen.log diff --git a/tests/images/jepsen_sshd_config b/tests/images/jepsen_sshd_config new file mode 100644 index 00000000..9bf6cd33 --- /dev/null +++ b/tests/images/jepsen_sshd_config @@ -0,0 +1,10 @@ +PubkeyAuthentication yes +ChallengeResponseAuthentication no +UsePAM yes +X11Forwarding yes +PrintMotd no +AcceptEnv LANG LC_* +Subsystem sftp /usr/lib/openssh/sftp-server +PubkeyAcceptedAlgorithms ssh-rsa +PermitRootLogin yes +MaxAuthTries 1000000 diff --git a/tests/images/mysql_jepsen/Dockerfile b/tests/images/mysql_jepsen/Dockerfile index b11d1dd2..e2c31423 100644 --- a/tests/images/mysql_jepsen/Dockerfile +++ b/tests/images/mysql_jepsen/Dockerfile @@ -8,6 +8,7 @@ COPY ./setup.sh /usr/local/bin/setup.sh COPY ./my.cnf /etc/mysql/my.cnf COPY ./.my.cnf /root/.my.cnf COPY ./supervisor_mysql.conf /etc/supervisor/conf.d +COPY ../jepsen_sshd_config /etc/sshd/sshd_config RUN chown mysql:root /etc/mysql RUN touch /etc/mysync.yaml RUN chown mysql:mysql /etc/mysync.yaml diff --git a/tests/images/zookeeper_jepsen/Dockerfile b/tests/images/zookeeper_jepsen/Dockerfile index db615e29..1035a821 100644 --- a/tests/images/zookeeper_jepsen/Dockerfile +++ b/tests/images/zookeeper_jepsen/Dockerfile @@ -4,3 +4,5 @@ COPY ./supervisor_zookeeper.conf /etc/supervisor/conf.d COPY ./retriable_path_create.sh /usr/local/bin/retriable_path_create.sh COPY ./generate_certs_with_restart.sh /usr/local/bin/generate_certs_with_restart.sh RUN chmod 755 /usr/local/bin/generate_certs_with_restart.sh + +COPY ../jepsen_sshd_config /etc/sshd/sshd_config