Skip to content

test(interfaces): Test completion of veth peers #1395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion test/fixtures/shared/bin/ifconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

# Dummy "ifconfig -a" emulator
# Dummy "ifconfig -a" emulator, from net-tools 1.60, ifconfig 1.42 (2001-04-13)

cat <<EOF
eth0 Link encap:Ethernet HWaddr 33:33:33:33:33:33
Expand All @@ -21,4 +21,21 @@ lo Link encap:Local Loopback
TX packets:129059 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7456154 (7.1 MiB) TX bytes:7456154 (7.1 MiB)

peer1 Link encap:Ethernet HWaddr 33:33:33:33:33:33
inet6 addr: fe80::000:0000:0000:0000/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1146 (1.1 Kb) TX bytes:1146 (1.1 Kb)

peer2 Link encap:Ethernet HWaddr 33:33:33:33:33:33
inet6 addr: fe80::000:0000:0000:0000/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1146 (1.1 Kb) TX bytes:1146 (1.1 Kb)

EOF
12 changes: 12 additions & 0 deletions test/fixtures/shared/bin/ip
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ for arg in "$@"; do
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
link/ether 33:33:33:33:33:33 brd ff:ff:ff:ff:ff:ff link-netnsid 0
5: peer2@peer1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 33:33:33:33:33:33 brd ff:ff:ff:ff:ff:ff
6: peer1@peer2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 33:33:33:33:33:33 brd ff:ff:ff:ff:ff:ff
EOF
exit 0
;;
Expand All @@ -27,6 +31,14 @@ EOF
valid_lft forever preferred_lft forever
inet6 fe80::000:0000:0000:0000/64 scope link
valid_lft forever preferred_lft forever
5: peer2@peer1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 33:33:33:33:33:33 brd ff:ff:ff:ff:ff:ff
inet6 fe80::000:0000:0000:0000/64 scope link
valid_lft forever preferred_lft forever
6: peer1@peer2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 33:33:33:33:33:33 brd ff:ff:ff:ff:ff:ff
inet6 fe80::000:0000:0000:0000/64 scope link
valid_lft forever preferred_lft forever
EOF
exit 0
;;
Expand Down
5 changes: 4 additions & 1 deletion test/t/unit/test_unit_compgen_available_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@ def test_2_correct_interfaces(self, bash, functions, remove_one_tool):
"_comp__test_compgen available_interfaces",
want_output=True,
)
assert all(iface in output for iface in ["<eth0>", "<lo>"])
assert all(
iface in output
for iface in ["<eth0>", "<lo>", "<peer1>", "<peer2>"]
)