Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Mougard <[email protected]>
  • Loading branch information
gabrielmougard committed Aug 20, 2024
1 parent fbf7758 commit ecba06c
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 79 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ jobs:
cd test
sudo --preserve-env=DEBUG,GITHUB_ACTIONS,MICROCLOUD_DEBUG_PATH,MICROCLOUDD_DEBUG_PATH,SKIP_VM_LAUNCH,SNAPSHOT_RESTORE,TEST_STORAGE_SOURCE,TESTBED_READY ./main.sh ${{ matrix.suite }}
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3

documentation-checks:
uses: canonical/documentation-workflows/.github/workflows/documentation-checks.yaml@main
with:
Expand Down
8 changes: 2 additions & 6 deletions cmd/microcloud/ask.go
Original file line number Diff line number Diff line change
Expand Up @@ -1136,12 +1136,8 @@ func (c *initConfig) askOVNNetwork(sh *service.Handler) error {
if ovnUnderlaySelectedIPs != nil {
ovnUnderlayIpAddr, ok := ovnUnderlaySelectedIPs[peer]
if ok {
ip, _, err := net.ParseCIDR(ovnUnderlayIpAddr)
if err != nil {
return err
}

system.OVNGeneveAddr = ip.String()
fmt.Printf("Using %q for OVN underlay traffic on %q\n", ovnUnderlayIpAddr, peer)
system.OVNGeneveAddr = ovnUnderlayIpAddr
}
}

Expand Down
148 changes: 75 additions & 73 deletions test/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,79 +37,81 @@ echo "==> Checking for dependencies"
check_dependencies lxc lxd curl awk jq git python3 shuf rsync openssl

cleanup() {
# Do not exit if commands fail on cleanup. (No need to reset -e as this is only run on test suite exit).
set -eux
lxc remote switch local
lxc project switch microcloud-test
set +e

if [ "${TEST_CURRENT}" = "setup" ] && [ "${TEST_RESULT}" = "success" ]; then
return
fi

# Allow for inspection
if [ -n "${CLOUD_INSPECT:-}" ]; then
if [ "${TEST_RESULT}" != "success" ]; then
echo "==> TEST DONE: ${TEST_CURRENT_DESCRIPTION}"
fi
echo "==> Test result: ${TEST_RESULT}"

echo "Tests Completed (${TEST_RESULT}): hit enter to continue"
read -r _
fi

echo "::group::debug-failure"
lxc list --all-projects || true
lxc exec micro01 -- lxc list || true

for name in $(lxc list -c n -f csv micro); do
echo "Check LXD resources on ${name} for disk ordering"
lxc exec "${name}" -- lxc query "/1.0/resources" | jq -r '.storage.disks[] | {id, device_id, device_path}'
lxc exec "${name}" -- lsblk
done

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

# LXD daemon logs
echo "::group::lxd logs"
journalctl --quiet --no-hostname --no-pager --boot=0 --lines=100 --unit=snap.lxd.daemon.service
echo "::endgroup::"

# dmesg may contain oops, IO errors, crashes, etc
echo "::group::dmesg logs"
journalctl --quiet --no-hostname --no-pager --boot=0 --lines=100 --dmesg
echo "::endgroup::"

if [ -n "${GITHUB_ACTIONS:-}" ]; then
echo "==> Skipping cleanup (GitHub Action runner detected)"
else
echo "==> Cleaning up"
cleanup_systems
fi

echo ""
echo ""
if [ "${TEST_RESULT}" != "success" ]; then
echo "==> TEST DONE: ${TEST_CURRENT_DESCRIPTION}"
fi
echo "==> Test result: ${TEST_RESULT}"

if [ "${CONCURRENT_SETUP}" = 1 ]; then
# kill our whole process group
kill -- -$$
fi
echo "==> DEBUG: Skip Cleaning up"

# # Do not exit if commands fail on cleanup. (No need to reset -e as this is only run on test suite exit).
# set -eux
# lxc remote switch local
# lxc project switch microcloud-test
# set +e

# if [ "${TEST_CURRENT}" = "setup" ] && [ "${TEST_RESULT}" = "success" ]; then
# return
# fi

# # Allow for inspection
# if [ -n "${CLOUD_INSPECT:-}" ]; then
# if [ "${TEST_RESULT}" != "success" ]; then
# echo "==> TEST DONE: ${TEST_CURRENT_DESCRIPTION}"
# fi
# echo "==> Test result: ${TEST_RESULT}"

# echo "Tests Completed (${TEST_RESULT}): hit enter to continue"
# read -r _
# fi

# echo "::group::debug-failure"
# lxc list --all-projects || true
# lxc exec micro01 -- lxc list || true

# for name in $(lxc list -c n -f csv micro); do
# echo "Check LXD resources on ${name} for disk ordering"
# lxc exec "${name}" -- lxc query "/1.0/resources" | jq -r '.storage.disks[] | {id, device_id, device_path}'
# lxc exec "${name}" -- lsblk
# done

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

# # LXD daemon logs
# echo "::group::lxd logs"
# journalctl --quiet --no-hostname --no-pager --boot=0 --lines=100 --unit=snap.lxd.daemon.service
# echo "::endgroup::"

# # dmesg may contain oops, IO errors, crashes, etc
# echo "::group::dmesg logs"
# journalctl --quiet --no-hostname --no-pager --boot=0 --lines=100 --dmesg
# echo "::endgroup::"

# if [ -n "${GITHUB_ACTIONS:-}" ]; then
# echo "==> Skipping cleanup (GitHub Action runner detected)"
# else
# echo "==> Cleaning up"
# cleanup_systems
# fi

# echo ""
# echo ""
# if [ "${TEST_RESULT}" != "success" ]; then
# echo "==> TEST DONE: ${TEST_CURRENT_DESCRIPTION}"
# fi
# echo "==> Test result: ${TEST_RESULT}"

# if [ "${CONCURRENT_SETUP}" = 1 ]; then
# # kill our whole process group
# kill -- -$$
# fi
}

# Must be set before cleanup()
Expand Down
4 changes: 4 additions & 0 deletions test/suites/basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ test_interactive() {
export CEPH_CLUSTER_NETWORK="${ceph_cluster_subnet_prefix}.0/24"
export OVN_UNDERLAY_NETWORK="yes"
export OVN_UNDERLAY_FILTER="${ovn_underlay_subnet_prefix}"

# Exit to test the above.
return 1

microcloud_interactive | lxc exec micro01 -- sh -c "microcloud init > out"

Check warning

Code scanning / shellcheck

SC2317 Warning test

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

lxc exec micro01 -- tail -1 out | grep "MicroCloud is ready" -q

Check warning

Code scanning / shellcheck

SC2317 Warning test

Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
Expand Down

0 comments on commit ecba06c

Please sign in to comment.