Skip to content

Commit

Permalink
Skip Ceph when rados bindings is not available
Browse files Browse the repository at this point in the history
The rados python bindings (the python3-rados
distro package) is only available for the
python version that the distro ships.
  • Loading branch information
tobias-urdin committed Oct 10, 2024
1 parent 351eae6 commit a574ee4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pifpaf/tests/test_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@
"unkillable.py")


# NOTE(tobias-urdin): The rados python bindings is only installed
# for the python version that the distro ships.
def _has_rados():
try:
import rados
return True
except ImportError:
return False


class TestDrivers(testtools.TestCase):
def setUp(self):
super(TestDrivers, self).setUp()
Expand Down Expand Up @@ -441,6 +451,7 @@ def test_gnocchi_with_existing_s3rver(self):
r = requests.get("http://localhost:%d/" % port)
self.assertEqual(200, r.status_code)

@testtools.skipUnless(_has_rados(), "Rados not found")
@testtools.skipUnless(shutil.which("gnocchi-api"),
"Gnocchi not found")
@testtools.skipUnless(shutil.which("ceph-mon"),
Expand Down Expand Up @@ -502,6 +513,7 @@ def test_keystone(self):
r = requests.get(os.getenv("PIFPAF_KEYSTONE_HTTP_URL"))
self.assertEqual(300, r.status_code)

@testtools.skipUnless(_has_rados(), "Rados not found")
@testtools.skipUnless(shutil.which("ceph-mon"),
"Ceph Monitor not found")
@testtools.skipUnless(shutil.which("ceph-osd"),
Expand Down

0 comments on commit a574ee4

Please sign in to comment.