From 8ffc2ca8735b2d670614dea9bcccb1211ad7d213 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 5 Jul 2022 17:37:53 +0200 Subject: setup-interfaces: mock apk add and test that vlan gets installed test that vlan gets installed --- setup-interfaces.in | 8 ++++---- tests/setup_interfaces_test | 21 ++++++++++++++++++++- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/setup-interfaces.in b/setup-interfaces.in index 3ebb320..f1e98eb 100644 --- a/setup-interfaces.in +++ b/setup-interfaces.in @@ -195,7 +195,7 @@ config_iface() { echo "raw_device=\"$raw_device\"" >> $conf fi if is_wifi $iface; then - apk add --quiet --no-progress wireless-tools wpa_supplicant || return + $MOCK apk add --quiet --no-progress wireless-tools wpa_supplicant || return local wifi_configured=false while ! $wifi_configured; do echo "Available wireless networks (scanning):" @@ -523,14 +523,14 @@ prompt_for_interfaces() { if ask_yesno "Do you want to do any manual network configuration? (y/n)" n; then case "$EDITOR" in - nano) apk add nano;; - vim) apk add vim;; + nano) $MOCK apk add nano;; + vim) $MOCK apk add vim;; esac ${EDITOR:-vi} interfaces fi if [ -n "$PKGS" ]; then - apk add --quiet $PKGS + $MOCK apk add --quiet $PKGS fi mkdir -p $ROOT/etc/network diff --git a/tests/setup_interfaces_test b/tests/setup_interfaces_test index fc652c1..c09968c 100755 --- a/tests/setup_interfaces_test +++ b/tests/setup_interfaces_test @@ -3,7 +3,8 @@ . $(atf_get_srcdir)/test_env.sh init_tests \ setup_interfaces_usage \ - setup_interfaces_interactive_dhcp + setup_interfaces_interactive_dhcp \ + setup_interfaces_interactive_vlan setup_interfaces_usage_body() { test_usage setup-interfaces @@ -34,3 +35,21 @@ setup_interfaces_interactive_dhcp_body() { -o match:"Available interfaces are: eth0" \ setup-interfaces answers + atf_check -s exit:0 \ + -o match:"apk add.*vlan" \ + setup-interfaces