Skip to content

Commit

Permalink
Add daemon cleanup logging (#599)
Browse files Browse the repository at this point in the history
This aims at catching the panic the occurs from time to time in the
interactive test suite. See
https://github.com/canonical/microcloud/actions/runs/12989749320/job/36223575544:

`Error: System "micro02" failed to join the cluster: Failed to update
cluster status of services: Put
"https://10.24.232.150:9443/1.0/services": EOF`
  • Loading branch information
roosterfish authored Jan 30, 2025
2 parents 04a2ebe + abac07a commit e83ef5b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
45 changes: 24 additions & 21 deletions test/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,33 @@ cleanup() {
set +x
fi

for name in $(lxc list -c n -f csv micro); do
echo -n "${name} CLI stdout:"
if ! lxc exec "${name}" -- test -e out; then
echo " was not found"
elif ! lxc exec "${name}" -- test -s out; then
echo " was empty"
else
echo
lxc exec "${name}" -- cat out
fi

for name in $(lxc list -c n -f csv micro); do
echo -n "${name} CLI stdout:"
if ! lxc exec "${name}" -- test -e out; then
echo " was not found"
elif ! lxc exec "${name}" -- test -s out; then
echo " was empty"
else
echo
lxc exec "${name}" -- cat out
fi
echo

echo -n "${name} Debug output:"
if ! lxc exec "${name}" -- test -e debug; then
echo " was not found"
elif ! lxc exec "${name}" -- test -s debug; then
echo " was empty"
else
echo
# The github console can't interpret the escape sequences baked into the output, so omit them manually.
lxc exec "${name}" -- cat -v debug | sed -e 's/\^M$//g' -e 's/.*\^M//g' -e 's/\^\[\[D//' -e 's/^\^\[.*//g' -e '/^$/d'
fi
if ! lxc exec "${name}" -- test -e debug; then
echo " was not found"
elif ! lxc exec "${name}" -- test -s debug; then
echo " was empty"
else
echo
# The github console can't interpret the escape sequences baked into the output, so omit them manually.
lxc exec "${name}" -- cat -v debug | sed -e 's/\^M$//g' -e 's/.*\^M//g' -e 's/\^\[\[D//' -e 's/^\^\[.*//g' -e '/^$/d'
fi
echo
done

echo -n "${name} MicroCloud daemon log:"
lxc exec "${name}" -- snap logs microcloud -n 200
done

if [ ${enable_xtrace} = 1 ]; then
set -x
Expand Down
8 changes: 7 additions & 1 deletion test/suites/instances.sh
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,12 @@ EOF
check_instance_connectivity "c1" "c2" "0"
check_instance_connectivity "v1" "c1" "1"

# We're done with c2 so we can delete it now, and free up space on the runners for more instances.
lxc exec micro01 -- lxc delete c2 -f

# Flush the neighbour cache in the remaining container so that it can ping new containers via hostname quicker.
lxc exec micro01 -- lxc exec c1 -- ip neigh flush all


# Add a new node, don't add any OSDs to keep Ceph fully remote.
preseed="$(cat << EOF
Expand Down Expand Up @@ -689,7 +695,7 @@ EOF
check_instance_connectivity "c1" "c3" "0"
check_instance_connectivity "c1" "c4" "0"

lxc exec micro01 -- lxc delete -f c1 c2 c3 c4
lxc exec micro01 -- lxc delete -f c1 c3 c4
if ! [ "${SKIP_VM_LAUNCH}" = "1" ]; then
lxc exec micro01 -- lxc delete -f v1
fi
Expand Down

0 comments on commit e83ef5b

Please sign in to comment.