-
Notifications
You must be signed in to change notification settings - Fork 85
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
Support changing host veth name #1125
Merged
+122
−7
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bats -*- bats -*- | ||
# | ||
# bridge driver tests with static veth names | ||
# | ||
|
||
load helpers | ||
|
||
@test bridge - valid veth name { | ||
run_netavark --file ${TESTSDIR}/testfiles/bridge-vethname.json setup $(get_container_netns_path) | ||
|
||
run_in_host_netns ip -j --details link show my-veth | ||
link_info="$output" | ||
assert_json "$link_info" '.[].flags[] | select(.=="UP")' == "UP" "Host veth is up" | ||
assert_json "$link_info" ".[].linkinfo.info_kind" == "veth" "The veth interface is actually a veth" | ||
assert_json "$link_info" ".[].master" "==" "podman0" "veth is part of the correct bridge" | ||
|
||
run_netavark --file ${TESTSDIR}/testfiles/bridge-vethname.json teardown $(get_container_netns_path) | ||
|
||
# check if the interface gets removed | ||
expected_rc=1 run_in_host_netns ip -j --details link show my-veth | ||
assert "$output" "==" 'Device "my-veth" does not exist.' | ||
} | ||
|
||
@test bridge - existing veth name { | ||
expected_rc=1 run_netavark --file ${TESTSDIR}/testfiles/bridge-vethname-exists.json setup $(get_container_netns_path) | ||
assert_json ".error" "create veth pair: interface eth0 already exists on container namespace or podman0 exists on host namespace: Netlink error: File exists (os error 17)" | ||
|
||
expected_rc=1 run_in_host_netns ip -j --details link show my-veth | ||
assert "$output" "==" 'Device "my-veth" does not exist.' | ||
} |
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,32 @@ | ||
{ | ||
"container_id": "6ce776ea58b5", | ||
"container_name": "testcontainer", | ||
"networks": { | ||
"podman": { | ||
"interface_name": "eth0", | ||
"static_ips": [ | ||
"10.88.0.2" | ||
], | ||
"options": { | ||
"host_interface_name": "podman0" | ||
} | ||
} | ||
}, | ||
"network_info": { | ||
"podman": { | ||
"dns_enabled": false, | ||
"driver": "bridge", | ||
"id": "53ce4390f2adb1681eb1a90ec8b48c49c015e0a8d336c197637e7f65e365fa9e", | ||
"internal": false, | ||
"ipv6_enabled": false, | ||
"name": "podman", | ||
"network_interface": "podman0", | ||
"subnets": [ | ||
{ | ||
"gateway": "10.88.0.1", | ||
"subnet": "10.88.0.0/16" | ||
} | ||
] | ||
} | ||
} | ||
} |
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,32 @@ | ||
{ | ||
"container_id": "6ce776ea58b5", | ||
"container_name": "testcontainer", | ||
"networks": { | ||
"podman": { | ||
"interface_name": "eth0", | ||
"static_ips": [ | ||
"10.88.0.2" | ||
], | ||
"options": { | ||
"host_interface_name": "my-veth" | ||
} | ||
} | ||
}, | ||
"network_info": { | ||
"podman": { | ||
"dns_enabled": false, | ||
"driver": "bridge", | ||
"id": "53ce4390f2adb1681eb1a90ec8b48c49c015e0a8d336c197637e7f65e365fa9e", | ||
"internal": false, | ||
"ipv6_enabled": false, | ||
"name": "podman", | ||
"network_interface": "podman0", | ||
"subnets": [ | ||
{ | ||
"gateway": "10.88.0.1", | ||
"subnet": "10.88.0.0/16" | ||
} | ||
] | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please assert your exact expected error message here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gotta say, it's pretty cool that the tests can do this. done.