Skip to content

Commit eba2847

Browse files
committed
tests: skip VNET tests when if_epair is not loaded
1 parent a1ec49a commit eba2847

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_VNET.py

+16
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2323
# POSSIBILITY OF SUCH DAMAGE.
2424
"""Unit tests for VNET."""
25+
import pytest
2526
import json
2627
import os
2728
import subprocess
@@ -31,6 +32,21 @@
3132

3233
import libioc.Jail
3334

35+
36+
def is_epair_enabled() -> bool:
37+
proc = subprocess.Popen(
38+
["/sbin/kldstat", "-n", "if_epair"],
39+
stdout=subprocess.DEVNULL,
40+
stderr=subprocess.DEVNULL
41+
)
42+
proc.communicate()
43+
return (proc.returncode == 0)
44+
45+
46+
@pytest.mark.skipif(
47+
(is_epair_enabled() is False),
48+
reason="if_epair is not loaded"
49+
)
3450
class TestVNET(object):
3551
"""Run tests for VNET networking."""
3652

0 commit comments

Comments
 (0)