Skip to content

Commit

Permalink
test: add test for device overriding on copy
Browse files Browse the repository at this point in the history
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
  • Loading branch information
hamistao committed Mar 18, 2024
1 parent 3e0736b commit 7f58952
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/suites/container_devices_nic_bridged.sh
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,25 @@ test_container_devices_nic_bridged() {
lxc config device get foo eth0 ipv4.address | grep -Fx '192.0.2.233'
lxc config device get foo eth0 ipv6.address | grep -Fx '2001:db8::3'
lxc start foo
lxc config show foo --expanded

# Test container can be copied with device override to fix conflict.
lxc copy foo foo-copy --device eth0,ipv4.address=192.0.2.234 --device eth0,ipv6.address=2001:db8::4 --device eth0,host_name=veth0 --device eth0,ipv4.routes=192.0.2.17/32 --device eth0,ipv4.routes=2001:db8::14/128
lxc config device get foo-copy eth0 ipv4.address | grep -Fx '192.0.2.234'
lxc config device get foo-copy eth0 ipv6.address | grep -Fx '2001:db8::4'
lxc config device get foo-copy eth0 ipv4.routes | grep -Fx '192.0.2.17/32'
lxc config show foo-copy --expanded
lxc start foo-copy
lxc delete -f foo-copy

# Test snapshot can be copied with device override to fix conflict.
lxc snapshot foo tester
lxc copy foo/tester snap-copy --device eth0,ipv4.address=192.0.2.235 --device eth0,ipv6.address=2001:db8::5 --device eth0,host_name=veth1 --device eth0,ipv4.routes=192.0.2.18/32 --device eth0,ipv4.routes=2001:db8::15/128
lxc config device get snap eth0 ipv4.address | grep -Fx '192.0.2.235'
lxc config device get snap eth0 ipv6.address | grep -Fx '2001:db8::5'
lxc config device get snap eth0 ipv4.routes | grep -Fx '192.0.2.18/32'
lxc start snap-copy
lxc delete -f snap-copy
lxc delete -f foo

# Test container with conflicting addresses rebuilds DHCP lease if original conflicting instance is removed.
Expand Down

0 comments on commit 7f58952

Please sign in to comment.