1
0
mirror of https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git synced 2025-12-14 19:02:45 +03:00
tiny-cloud/tests/assemble-interfaces.test
Natanael Copa 85108e958b Fix vim modelines and make more readable
Add missing trailing :

Use filetype=sh instead of ft=sh to make it more readable.
2023-05-24 14:50:02 +00:00

38 lines
795 B
Bash
Executable File

#!/usr/bin/env atf-sh
# vim:set filetype=sh:
# shellcheck shell=sh
. $(atf_get_srcdir)/test_env.sh
init_tests \
assemble_eth0 \
assemble_missing_interfaces_d
assemble_eth0_body() {
mkdir -p etc/network/interfaces.d \
sys/class/net/eth0
cat > etc/network/interfaces.d/DEFAULT <<-EOF
auto %%
iface %% inet dhcp
EOF
atf_check assemble-interfaces
atf_check \
-o match:"# NOTE:" \
-o match:"auto eth0" \
-o match:"iface eth0 inet dhcp" \
cat etc/network/interfaces
}
# test what happens if etc/network/interfaces.d is missing
assemble_missing_interfaces_d_body() {
atf_check -s not-exit:0 \
-e match:"([Nn]o such file or directory|can't cd to)" \
assemble-interfaces
if [ -f etc/network/interfaces ]; then
atf_fail "should not create etc/network/interfaces"
fi
}