Skip to content

Commit

Permalink
tests: Add an interactive MicroCloud test with IPv6 disabled and IPv4…
Browse files Browse the repository at this point in the history
… disabled

Signed-off-by: Gabriel Mougard <[email protected]>
  • Loading branch information
gabrielmougard committed Jun 10, 2024
1 parent bef6a0c commit 2ebc66a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/includes/microcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ unset_interactive_vars() {
unset LOOKUP_IFACE LIMIT_SUBNET SKIP_SERVICE EXPECT_PEERS REUSE_EXISTING REUSE_EXISTING_COUNT \
SETUP_ZFS ZFS_FILTER ZFS_WIPE \
SETUP_CEPH CEPH_WARNING CEPH_FILTER CEPH_WIPE SETUP_CEPHFS \
SETUP_OVN OVN_WARNING OVN_FILTER IPV4_SUBNET IPV4_START IPV4_END DNS_ADDRESSES IPV6_SUBNET
PROCEED_WITH_NO_OVERLAY_NETWORKING SETUP_OVN OVN_WARNING OVN_FILTER IPV4_SUBNET IPV4_START IPV4_END DNS_ADDRESSES IPV6_SUBNET
}

# microcloud_interactive: outputs text that can be passed to `TEST_CONSOLE=1 microcloud init`
Expand All @@ -27,6 +27,7 @@ microcloud_interactive() {
CEPH_WARNING=${CEPH_WARNING:-} # (yes/no) input for warning about eligible disk detection.
CEPH_FILTER=${CEPH_FILTER:-} # filter string for CEPH disks.
CEPH_WIPE=${CEPH_WIPE:-} # (yes/no) to wipe all disks.
PROCEED_WITH_NO_OVERLAY_NETWORKING=${PROCEED_WITH_NO_OVERLAY_NETWORKING:-} # (yes/no) input for proceeding without overlay networking.
SETUP_OVN=${SETUP_OVN:-} # (yes/no) input for initiating OVN network setup.
OVN_WARNING=${OVN_WARNING:-} # (yes/no) input for warning about eligible interface detection.
OVN_FILTER=${OVN_FILTER:-} # filter string for OVN interfaces.
Expand Down Expand Up @@ -86,6 +87,12 @@ $(true) # workaround for set -e
"
fi

if [ -n "${PROCEED_WITH_NO_OVERLAY_NETWORKING}" ]; then
setup="${setup}
${PROCEED_WITH_NO_OVERLAY_NETWORKING} # agree to proceed without overlay networking (neither FAN nor OVN networking) (yes/no)
$(true) # workaround for set -e
"
fi

if [ -n "${SETUP_OVN}" ]; then
setup="${setup}
Expand Down
40 changes: 40 additions & 0 deletions test/suites/basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,46 @@ test_interactive() {
validate_system_lxd "${m}" 3 disk1
done

# Reset the systems with just LXD and no IPv6 support.
reset_systems 3 3 1

for m in micro01 micro02 micro03 ; do
lxc exec "${m}" -- echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
lxc exec "${m}" -- snap disable microceph || true
lxc exec "${m}" -- snap disable microovn || true
lxc exec "${m}" -- snap restart microcloud
done

echo "Creating a MicroCloud with ZFS storage and no IPv6 support"
microcloud_interactive | lxc exec micro01 -- sh -c "microcloud init > out"

lxc exec micro01 -- tail -1 out | grep "MicroCloud is ready" -q
for m in micro01 micro02 micro03 ; do
validate_system_lxd "${m}" 3 disk1
done

# Reset the systems with just LXD and no IPv4 support.
gw_net_addr=$(lxc network get lxdbr0 ipv4.address)
lxc network set lxdbr0 ipv4.address none
reset_systems 3 3 1

for m in micro01 micro02 micro03 ; do
lxc exec "${m}" -- snap disable microceph || true
lxc exec "${m}" -- snap disable microovn || true
lxc exec "${m}" -- snap restart microcloud
done

export PROCEED_WITH_NO_OVERLAY_NETWORKING="no" # This will avoid to setup the cluster if no overlay networking is available.
echo "Creating a MicroCloud with ZFS storage and no IPv4 support"
! microcloud_interactive | lxc exec micro01 -- sh -c "microcloud init 2> err" || false

# Ensure we error out due to a lack of usable overlay networking.
lxc exec micro01 -- cat err | grep "cluster bootstrapping aborted due to lack of usable networking" -q

# Set the IPv4 address back to the original value.
lxc network set lxdbr0 ipv4.address "${gw_net_addr}"
unset PROCEED_WITH_NO_OVERLAY_NETWORKING

# Reset the systems and install microceph.
reset_systems 3 3 1

Expand Down

0 comments on commit 2ebc66a

Please sign in to comment.