diff options
| author | Christian Hopps <chopps@labn.net> | 2021-05-20 19:22:14 -0400 |
|---|---|---|
| committer | Christian Hopps <chopps@gmail.com> | 2021-06-06 18:03:17 +0000 |
| commit | deca28a33bcd913abeaf03017c52b1d2e9fd50e7 (patch) | |
| tree | cac3453ef98cab1e6180430a2f2addc0b6a6efdf /tests/lib/test_grpc.py | |
| parent | 6198bc98bea5034277de2ef1bec34929c9346894 (diff) | |
tests: add grpc unit test
Test uses staticd which required some C++ header protections.
Additionally, the test also runs in the ubuntu20 docker container as
grpc is supported there by the packaging system.
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'tests/lib/test_grpc.py')
| -rw-r--r-- | tests/lib/test_grpc.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/lib/test_grpc.py b/tests/lib/test_grpc.py new file mode 100644 index 0000000000..06ae6c05dd --- /dev/null +++ b/tests/lib/test_grpc.py @@ -0,0 +1,23 @@ +import inspect +import os +import subprocess +import pytest +import frrtest + +class TestGRPC(object): + program = "./test_grpc" + + @pytest.mark.skipif( + 'S["GRPC_TRUE"]=""\n' not in open("../config.status").readlines(), + reason="GRPC not enabled", + ) + def test_exits_cleanly(self): + basedir = os.path.dirname(inspect.getsourcefile(type(self))) + program = os.path.join(basedir, self.program) + proc = subprocess.Popen( + [frrtest.binpath(program)], stdin=subprocess.PIPE, stdout=subprocess.PIPE + ) + output, _ = proc.communicate() + self.exitcode = proc.wait() + if self.exitcode != 0: + raise frrtest.TestExitNonzero(self) |
