-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: adds testing and begin interface creation
- Loading branch information
Showing
6 changed files
with
107 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bats -*- bats -*- | ||
# | ||
# macvlan driver test | ||
# | ||
|
||
load helpers | ||
|
||
function setup() { | ||
basic_setup | ||
} | ||
|
||
@test "simple WireGuard setup" { | ||
run_netavark --file ${TESTSDIR}/testfiles/wireguard.json setup $(get_container_netns_path) | ||
result="$output" | ||
|
||
# mac=$(jq -r '.podman.interfaces.wg-test.mac_address' <<< "$result" ) | ||
# check that interface exists | ||
run_in_container_netns ip -j --details link show wg-test | ||
link_info="$output" | ||
assert_json "$link_info" ".[].address" "==" "$mac" "MAC matches container mac" | ||
assert_json "$link_info" '.[].flags[] | select(.=="UP")' "==" "UP" "Container interface is up" | ||
assert_json "$link_info" ".[].linkinfo.info_kind" "==" "macvlan" "Container interface is a macvlan device" | ||
|
||
ipaddr="10.88.0.2/16" | ||
run_in_container_netns ip addr show eth0 | ||
assert "$output" "=~" "$ipaddr" "IP address matches container address" | ||
assert_json "$result" ".podman.interfaces.eth0.subnets[0].ipnet" "==" "$ipaddr" "Result contains correct IP address" | ||
|
||
# check gateway assignment | ||
run_in_container_netns ip r | ||
assert "$output" "=~" "default via 10.88.0.1" "gateway must be there in default route" | ||
assert_json "$result" ".podman.interfaces.eth0.subnets[0].gateway" == "10.88.0.1" "Result contains gateway address" | ||
|
||
run_in_container_netns cat /proc/sys/net/ipv6/conf/eth0/autoconf | ||
assert "0" "autoconf is disabled" | ||
|
||
run_netavark --file ${TESTSDIR}/testfiles/macvlan.json teardown $(get_container_netns_path) | ||
assert "" "no errors" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters