selftest: Fix several test issue with Fedora 33

- ssh-copy-id is bugged and not working, use a more robust way to sync
  ssh keys
- systemd-resolvd will bind on port 53 so DHCP server won't work,
  disable systemd-resolvd's builtin DNS server

Signed-off-by: Kairui Song <kasong@redhat.com>
This commit is contained in:
Kairui Song 2020-11-18 23:33:06 +08:00
parent 616d359c5e
commit 7b7e5d0743
5 changed files with 13 additions and 5 deletions

View File

@ -94,7 +94,7 @@ for test_case in $testcases; do
$(run_test_sync $script > $(get_test_console_file $script)) & $(run_test_sync $script > $(get_test_console_file $script)) &
sleep 3 sleep 5
done done
script="$main_script" script="$main_script"

View File

@ -8,6 +8,9 @@ on_build() {
img_run_cmd "echo /srv/nfs 192.168.77.1/24\(rw,async,insecure,no_root_squash\) > /etc/exports" img_run_cmd "echo /srv/nfs 192.168.77.1/24\(rw,async,insecure,no_root_squash\) > /etc/exports"
img_run_cmd "systemctl enable nfs-server" img_run_cmd "systemctl enable nfs-server"
img_run_cmd "touch /etc/systemd/resolved.conf"
img_run_cmd "echo DNSStubListener=no >> /etc/systemd/resolved.conf"
img_run_cmd "echo interface=eth0 > /etc/dnsmasq.conf" img_run_cmd "echo interface=eth0 > /etc/dnsmasq.conf"
img_run_cmd "echo dhcp-authoritative >> /etc/dnsmasq.conf" img_run_cmd "echo dhcp-authoritative >> /etc/dnsmasq.conf"
img_run_cmd "echo dhcp-range=192.168.77.50,192.168.77.100,255.255.255.0,12h >> /etc/dnsmasq.conf" img_run_cmd "echo dhcp-range=192.168.77.50,192.168.77.100,255.255.255.0,12h >> /etc/dnsmasq.conf"

View File

@ -15,7 +15,7 @@ core_collector makedumpfile -l --message-level 7 -d 31
EOF EOF
while ! ping -c 1 $nfs_server -W 1; do while ! ping -c 1 $nfs_server -W 1; do
: sleep 1
done done
kdumpctl start || test_failed "Failed to start kdump" kdumpctl start || test_failed "Failed to start kdump"

View File

@ -9,6 +9,9 @@ on_build() {
img_run_cmd 'sed -i "s/^.*PermitRootLogin .*\$/PermitRootLogin yes/" /etc/ssh/sshd_config' img_run_cmd 'sed -i "s/^.*PermitRootLogin .*\$/PermitRootLogin yes/" /etc/ssh/sshd_config'
img_run_cmd "systemctl enable sshd" img_run_cmd "systemctl enable sshd"
img_run_cmd "touch /etc/systemd/resolved.conf"
img_run_cmd "echo DNSStubListener=no >> /etc/systemd/resolved.conf"
img_run_cmd "echo interface=eth0 > /etc/dnsmasq.conf" img_run_cmd "echo interface=eth0 > /etc/dnsmasq.conf"
img_run_cmd "echo dhcp-authoritative >> /etc/dnsmasq.conf" img_run_cmd "echo dhcp-authoritative >> /etc/dnsmasq.conf"
img_run_cmd "echo dhcp-range=192.168.77.50,192.168.77.100,255.255.255.0,12h >> /etc/dnsmasq.conf" img_run_cmd "echo dhcp-range=192.168.77.50,192.168.77.100,255.255.255.0,12h >> /etc/dnsmasq.conf"

View File

@ -14,7 +14,7 @@ ssh root@192.168.77.1
core_collector makedumpfile -l --message-level 7 -d 31 -F core_collector makedumpfile -l --message-level 7 -d 31 -F
EOF EOF
ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa <<< y &>/dev/ttyS1 ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa <<< y
while ! ping -c 1 $ssh_server -W 1; do while ! ping -c 1 $ssh_server -W 1; do
sleep 1 sleep 1
@ -24,9 +24,11 @@ EOF
ssh-keyscan -H 192.168.77.1 > /root/.ssh/known_hosts ssh-keyscan -H 192.168.77.1 > /root/.ssh/known_hosts
done done
sshpass -p fedora ssh-copy-id root@$ssh_server -f &>/dev/ttyS1 sshpass -p fedora ssh $ssh_server "mkdir /root/.ssh"
cat /root/.ssh/id_rsa.pub | sshpass -p fedora ssh $ssh_server "cat >> /root/.ssh/authorized_keys"
sshpass -p fedora kdumpctl propagate &>/dev/ttyS1 sshpass -p fedora kdumpctl propagate
cat /root/.ssh/kdump_id_rsa.pub | sshpass -p fedora ssh $ssh_server "cat >> /root/.ssh/authorized_keys"
kdumpctl start || test_failed "Failed to start kdump" kdumpctl start || test_failed "Failed to start kdump"