From 48d9bf0a6ad9f55631e406f9b55e4602ee125425 Mon Sep 17 00:00:00 2001 From: Gabriel Mougard Date: Tue, 20 Aug 2024 16:24:13 +0200 Subject: [PATCH] debug Signed-off-by: Gabriel Mougard --- .github/workflows/tests.yml | 4 + cmd/microcloud/ask.go | 1 + test/main.sh | 148 ++++++++++++++++++------------------ test/suites/basic.sh | 4 + 4 files changed, 84 insertions(+), 73 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 79fb14fbe..a8d73688a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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: diff --git a/cmd/microcloud/ask.go b/cmd/microcloud/ask.go index 4e0825f2d..7fe762c76 100644 --- a/cmd/microcloud/ask.go +++ b/cmd/microcloud/ask.go @@ -1141,6 +1141,7 @@ func (c *initConfig) askOVNNetwork(sh *service.Handler) error { return err } + fmt.Printf("Using %q for OVN underlay traffic on %q\n", ip.String(), peer) system.OVNGeneveAddr = ip.String() } } diff --git a/test/main.sh b/test/main.sh index 1b203e988..45521a890 100755 --- a/test/main.sh +++ b/test/main.sh @@ -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() diff --git a/test/suites/basic.sh b/test/suites/basic.sh index 93cf88b5e..f14745596 100644 --- a/test/suites/basic.sh +++ b/test/suites/basic.sh @@ -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" lxc exec micro01 -- tail -1 out | grep "MicroCloud is ready" -q