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 24, 2024
1 parent 459de0b commit 8f91864
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 17 deletions.
42 changes: 25 additions & 17 deletions 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 CEPH_CLUSTER_NETWORK IGNORE_CEPH_NETWORKING \
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 @@ -19,24 +19,25 @@ microcloud_interactive() {
EXPECT_PEERS=${EXPECT_PEERS:-} # wait for this number of systems to be available to join the cluster.
REUSE_EXISTING=${REUSE_EXISTING:-} # (yes/no) incorporate an existing clustered service.
REUSE_EXISTING_COUNT=${REUSE_EXISTING_COUNT:-0} # (number) number of existing clusters to incorporate.
SETUP_ZFS=${SETUP_ZFS:-} # (yes/no) input for initiating ZFS storage pool setup.
ZFS_FILTER=${ZFS_FILTER:-} # filter string for ZFS disks.
ZFS_WIPE=${ZFS_WIPE:-} # (yes/no) to wipe all disks.
SETUP_CEPH=${SETUP_CEPH:-} # (yes/no) input for initiating CEPH storage pool setup.
SETUP_CEPHFS=${SETUP_CEPHFS:-} # (yes/no) input for initialising CephFS storage pool setup.
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.
SETUP_ZFS=${SETUP_ZFS:-} # (yes/no) input for initiating ZFS storage pool setup.
ZFS_FILTER=${ZFS_FILTER:-} # filter string for ZFS disks.
ZFS_WIPE=${ZFS_WIPE:-} # (yes/no) to wipe all disks.
SETUP_CEPH=${SETUP_CEPH:-} # (yes/no) input for initiating CEPH storage pool setup.
SETUP_CEPHFS=${SETUP_CEPHFS:-} # (yes/no) input for initialising CephFS storage pool setup.
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.
CEPH_CLUSTER_NETWORK=${CEPH_CLUSTER_NETWORK:-} # (default: MicroCloud internal subnet or Ceph public network if specified previously) input for setting up a cluster network.
IGNORE_CEPH_NETWORKING=${IGNORE_CEPH_NETWORKING:-} # (yes/no) input for ignoring Ceph network setup. Set it to `yes` during `microcloud add` .
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.
IPV4_SUBNET=${IPV4_SUBNET:-} # OVN ipv4 gateway subnet.
IPV4_START=${IPV4_START:-} # OVN ipv4 range start.
IPV4_END=${IPV4_END:-} # OVN ipv4 range end.
DNS_ADDRESSES=${DNS_ADDRESSES:-} # OVN custom DNS addresses.
IPV6_SUBNET=${IPV6_SUBNET:-} # OVN ipv6 range.
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.
IPV4_SUBNET=${IPV4_SUBNET:-} # OVN ipv4 gateway subnet.
IPV4_START=${IPV4_START:-} # OVN ipv4 range start.
IPV4_END=${IPV4_END:-} # OVN ipv4 range end.
DNS_ADDRESSES=${DNS_ADDRESSES:-} # OVN custom DNS addresses.
IPV6_SUBNET=${IPV6_SUBNET:-} # OVN ipv6 range.

setup="
${LOOKUP_IFACE} # filter the lookup interface
Expand Down Expand Up @@ -88,6 +89,13 @@ $(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 [ -z "${IGNORE_CEPH_NETWORKING}" ]; then
if [ -n "${CEPH_CLUSTER_NETWORK}" ]; 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 @@ -47,6 +47,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 8f91864

Please sign in to comment.