1
0
mirror of https://github.com/lxc/python3-lxc.git synced 2026-02-05 18:48:46 +01:00

4 Commits

Author SHA1 Message Date
Austin Rhodes
fd8f7d1ff0 Update configuration for examples/api_test.py
This example script is guaranteed to fail on modern Ubuntu releases due to outdated configuration. These changes allow the script to pass:

- Fixes container.create arguments to request Noble image instead of Xenial, as Xenial images are no longer available

- Changes cgroups key strings to use cgroups v2 nomenclature ('max' instead of 'limit_in_bytes', 'peak' instead of 'max_usage_in_bytes')

Signed-off-by: Austin Rhodes <austin.rhodes@canonical.com>
2025-12-09 18:17:26 -05:00
Po-Hsu Lin
37ac09d7a4 api_test: fix possible infinite loop when trying to get the ip address
If the the ips can not be correctly obtained with container.get_ips()
this while loop will never ends.

Fix this by using:
  while not ips and count != 30

So that even if the ips is empty, the loop will get terminated after
30 attempts (30 seconds later). This retry limit was bumped from 10
to 30 to give it a chance to get the ip address.

If the ip address cannot be obtained, this test will failed with:
  Traceback (most recent call last):
    File "/usr/share/doc/python3-lxc/examples/api_test.py", line 131, in <module>
      assert(len(ips) > 0)
  AssertionError

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
2021-11-25 16:22:33 +08:00
You-Sheng Yang
69c41ef513 api_test: fix interfaces comparison failure
When the host has kernel module sit or ipip inserted, additional network
interfaces sit0 and/or tunl0 would appear inside the container by
default as well, which fails the api_test.

This change append sit0/tunl0 to expected interfaces when applicable.

Closes: #2
Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
2019-09-18 17:23:41 +08:00
Christian Brauner
8c49ddee6f initial commit
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-14 18:34:35 +01:00