diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2022-07-05 17:37:53 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2022-07-05 17:37:53 +0200 |
commit | 8ffc2ca8735b2d670614dea9bcccb1211ad7d213 (patch) | |
tree | 3954fd43361dc95dbea06dc18c5b246078ce490a | |
parent | 9d4574d45d2544b94d28244441ea8042da090fbb (diff) | |
download | alpine-conf-8ffc2ca8735b2d670614dea9bcccb1211ad7d213.zip |
setup-interfaces: mock apk add and test that vlan gets installed
test that vlan gets installed
-rw-r--r-- | setup-interfaces.in | 8 | ||||
-rwxr-xr-x | 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 } + +setup_interfaces_interactive_vlan_body() { + init_env + create_fake_ifaces lo eth0 + ( + # Which one do you want to initialize? (or '?' or 'done') [eth0] + echo eth0.5 + # Ip address for eth0.5? (or 'dhcp', 'none', '?') [dhcp] + echo dhcp + # Which one do you want to initialize? (or '?' or 'done') [eth0] + echo done + # Do you want to do any manual network configuration? (y/n) [n] + echo n + )>answers + atf_check -s exit:0 \ + -o match:"apk add.*vlan" \ + setup-interfaces <answers +} |