Skip to content

Commit

Permalink
Merge "Select host for aggregate which doesn’t contain any instances"
Browse files Browse the repository at this point in the history
  • Loading branch information
MOS CI authored and Gerrit Code Review committed Jan 23, 2025
2 parents 9159624 + ca20357 commit 2b0ef40
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions rockoon/tests/functional/exporter/parallel/test_nova_collector.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from parameterized import parameterized
import pytest
import unittest

from retry import retry

Expand Down Expand Up @@ -417,13 +418,21 @@ def setUp(self):
]

self.aggregate = None
self.aggregate_compute = [
x
for x in self.ocm.oc.compute.services(binary="nova-compute")
if x.get("availability_zone") == "nova"
and "nova-compute-ironic" not in x["host"]
][0]["host"]
compute_services = self.ocm.oc.compute.services(binary="nova-compute")
filtered_services = [
service
for service in compute_services
if service.get("availability_zone") == "nova"
and "nova-compute-ironic" not in service["host"]
and len(self.ocm.compute_get_all_servers(host=service["host"]))
== 0
]
if not filtered_services:
raise unittest.SkipTest(
"There are no nova compute hosts available for aggregate"
)

self.aggregate_compute = filtered_services[0]["host"]
self.server = None

def tearDown(self):
Expand Down

0 comments on commit 2b0ef40

Please sign in to comment.