public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob c4cdcf704aa53a26a66271f2b901b3b58f2b330c 1157 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
#! /usr/bin/python3

# SPDX-License-Identifier: GPL-2.0-or-later
#
# tasst - Test A Simple Socket Transport
#         library of test helpers for passt & pasta
#
# tasst/metatest/veth - Test the veth creation helper
#
# These test code from tasst.site, but require additional support from
# tasst.nstool.
#
# Copyright Red Hat
# Author: David Gibson <david@gibson.dropbear.id.au>

import contextlib

import avocado

from tasst import Tasst
from tasst.site import REAL_HOST
from tasst.nstool import UnshareSite


class VethTasst(Tasst):
    """
    Test helpers for creating veths between namespaces

    :avocado: tags=meta
    """

    @contextlib.contextmanager
    def setup_veth(self):
        with UnshareSite(type(self).__name__ + '.1', '-Un') as ns1:
            with UnshareSite(type(self).__name__ + '.2', '-n',
                             parent=ns1, sudo=True) as ns2:
                ns1.veth('veth1', 'veth2', ns2)
                yield (ns1, ns2)

    def test_ifs(self):
        with self.setup_veth() as (ns1, ns2):
            self.assertCountEqual(ns1.ifs(), ['lo', 'veth1'])
            self.assertCountEqual(ns2.ifs(), ['lo', 'veth2'])

debug log:

solving c4cdcf7 ...
found c4cdcf7 in https://archives.passt.top/passt-dev/20230531015849.3229596-12-david@gibson.dropbear.id.au/

applying [1/1] https://archives.passt.top/passt-dev/20230531015849.3229596-12-david@gibson.dropbear.id.au/
diff --git a/avocado/tasst/meta/veth.py b/avocado/tasst/meta/veth.py
new file mode 100644
index 0000000..c4cdcf7

Checking patch avocado/tasst/meta/veth.py...
Applied patch avocado/tasst/meta/veth.py cleanly.

index at:
100644 c4cdcf704aa53a26a66271f2b901b3b58f2b330c	avocado/tasst/meta/veth.py

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).