mirror of
https://github.com/systemd/systemd
synced 2024-10-02 22:37:25 +00:00
test-13-NSPAWN: add more test case for passing network interfaces
- test interface renaming that conflicts with the current alternative network interface name, - test passing wlan interfaces.
This commit is contained in:
parent
1c3e5b4210
commit
e8736fb6c9
|
@ -13,6 +13,10 @@ test_append_files() {
|
|||
local workspace="${1:?}"
|
||||
local container="$workspace/testsuite-13-container-template"
|
||||
|
||||
# For virtual wlan interface.
|
||||
instmods mac80211_hwsim
|
||||
generate_module_dependencies
|
||||
|
||||
# Create a dummy container "template" with a minimal toolset, which we can
|
||||
# then use as a base for our nspawn/machinectl tests
|
||||
initdir="$container" setup_basic_dirs
|
||||
|
|
|
@ -324,7 +324,7 @@ EOF
|
|||
}
|
||||
|
||||
nspawn_settings_cleanup() {
|
||||
for dev in sd-host-only sd-shared{1,2} sd-macvlan{1,2} sd-ipvlan{1,2}; do
|
||||
for dev in sd-host-only sd-shared{1,2,3} sd-macvlan{1,2} sd-ipvlan{1,2}; do
|
||||
ip link del "$dev" || :
|
||||
done
|
||||
|
||||
|
@ -332,7 +332,7 @@ nspawn_settings_cleanup() {
|
|||
}
|
||||
|
||||
testcase_nspawn_settings() {
|
||||
local root container dev private_users
|
||||
local root container dev private_users wlan_names='' wlan_checks=''
|
||||
|
||||
mkdir -p /run/systemd/nspawn
|
||||
root="$(mktemp -d /var/lib/machines/testsuite-13.nspawn-settings.XXX)"
|
||||
|
@ -341,10 +341,17 @@ testcase_nspawn_settings() {
|
|||
rm -f "/etc/systemd/nspawn/$container.nspawn"
|
||||
mkdir -p "$root/tmp" "$root"/opt/{tmp,inaccessible,also-inaccessible}
|
||||
|
||||
for dev in sd-host-only sd-shared{1,2} sd-macvlan{1,2} sd-macvlanloong sd-ipvlan{1,2} sd-ipvlanlooong; do
|
||||
# add virtual wlan interfaces
|
||||
if modprobe mac80211_hwsim radios=2; then
|
||||
wlan_names='wlan0 wlan1:wl-renamed1'
|
||||
wlan_checks='ip link | grep wlan0\nip link | grep wl-renamed1'
|
||||
fi
|
||||
|
||||
for dev in sd-host-only sd-shared{1,2,3} sd-macvlan{1,2} sd-macvlanloong sd-ipvlan{1,2} sd-ipvlanlooong; do
|
||||
ip link add "$dev" type dummy
|
||||
done
|
||||
udevadm settle
|
||||
ip link property add dev sd-shared3 altname sd-altname3 altname sd-altname-tooooooooooooo-long
|
||||
ip link
|
||||
trap nspawn_settings_cleanup RETURN
|
||||
|
||||
|
@ -394,7 +401,7 @@ Private=yes
|
|||
VirtualEthernet=yes
|
||||
VirtualEthernetExtra=my-fancy-veth1
|
||||
VirtualEthernetExtra=fancy-veth2:my-fancy-veth2
|
||||
Interface=sd-shared1 sd-shared2:sd-shared2
|
||||
Interface=sd-shared1 sd-shared2:sd-renamed2 sd-shared3:sd-altname3 ${wlan_names}
|
||||
MACVLAN=sd-macvlan1 sd-macvlan2:my-macvlan2 sd-macvlanloong
|
||||
IPVLAN=sd-ipvlan1 sd-ipvlan2:my-ipvlan2 sd-ipvlanlooong
|
||||
Zone=sd-zone0
|
||||
|
@ -437,12 +444,17 @@ ip link | grep host0@
|
|||
ip link | grep my-fancy-veth1@
|
||||
ip link | grep my-fancy-veth2@
|
||||
ip link | grep sd-shared1
|
||||
ip link | grep sd-shared2
|
||||
ip link | grep sd-renamed2
|
||||
ip link | grep sd-shared3
|
||||
ip link | grep sd-altname3
|
||||
ip link | grep sd-altname-tooooooooooooo-long
|
||||
ip link | grep mv-sd-macvlan1@
|
||||
ip link | grep my-macvlan2@
|
||||
ip link | grep iv-sd-ipvlan1@
|
||||
ip link | grep my-ipvlan2@
|
||||
EOF
|
||||
echo -e "$wlan_checks" >>"$root/entrypoint.sh"
|
||||
|
||||
timeout 30 systemd-nspawn --directory="$root"
|
||||
|
||||
# And now for stuff that needs to run separately
|
||||
|
|
Loading…
Reference in a new issue