Skip to content

Commit

Permalink
feat(oracle-rdma-test): add pytest skip if image is not RDMA ready
Browse files Browse the repository at this point in the history
  • Loading branch information
a-dubs committed Feb 18, 2025
1 parent 172b619 commit 23e2d0b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions examples/oracle/oracle-example-cluster-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def cluster() -> Generator[list[OciInstance], None, None]:

class TestOracleClusterBasic:
def test_basic_ping_on_private_ips(self, cluster: list[OciInstance]):
"""
Verifies that the instances in the cluster can reach each other on their private IPs.
"""
# get the private ips of the instances
private_ips = [instance.private_ip for instance in cluster]
# try to ping each instance from each other instance at their private ip
Expand Down Expand Up @@ -97,10 +100,26 @@ def setup_mofed_iptables_rules(instance: OciInstance):
return instance


def ensure_image_is_rdma_ready(instance: OciInstance):
r = instance.execute("ibstatus")
if not r.stdout or not r.ok:
logger.info("Infiniband status: %s", r.stdout + "\n" + r.stderr)
pytest.skip("The image beiing used is not RDMA ready")


class TestOracleClusterRdma:
@pytest.fixture(scope="class")
def mofed_cluster(self, cluster: list[OciInstance]) -> Generator[list[OciInstance], None, None]:
"""
Custom fixture to configure the instances in the cluster for RDMA testing.
This fixture will:
- Ensure the image being used is RDMA ready
- Create a secondary VNIC on the private subnet for each instance in the cluster
- Configure the secondary VNIC for RDMA usage
- Set up the necessary iptables rules for RDMA usage on each instance's secondary NIC
"""
ensure_image_is_rdma_ready(cluster[0])
for instance in cluster:
if instance.secondary_vnic_private_ip:
logger.info(
Expand Down

0 comments on commit 23e2d0b

Please sign in to comment.