Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
d5d6197
MGMT-22783: add pytest e2e test suite for vmaas
omer-vishlitzky Mar 22, 2026
52e0f5a
MGMT-22635: add VMaaS networking tests and test infrastructure improv…
omer-vishlitzky Apr 14, 2026
d24a7e9
Merge pull request #24 from osac-project/MGMT-22635-vmaas-networking
openshift-merge-bot[bot] Apr 15, 2026
09d5843
MGMT-22635: fix test defaults for CI environment
omer-vishlitzky Apr 21, 2026
b348835
Merge pull request #29 from omer-vishlitzky/MGMT-22635-fix-test-defaults
openshift-merge-bot[bot] Apr 22, 2026
486bb39
MGMT-23845: renames fulfillment-cli to osac in osac-test-infra
wgordon17 Apr 28, 2026
b80fcff
NO_ISSUE: remove unused code and refactor tests structure to have bet…
omer-vishlitzky May 5, 2026
40bcfc6
Merge pull request #34 from omer-vishlitzky/main
openshift-merge-bot[bot] May 6, 2026
e8d7cb9
OSAC-150: add E2E test for explicit cluster configuration fields
tzvatot May 10, 2026
8649af1
Merge pull request #36 from tzvatot/OSAC-150/explicit-fields-e2e
openshift-merge-bot[bot] May 11, 2026
c53c191
fix gRPC deletion race after CR removal
omer-vishlitzky May 12, 2026
ccc3a3f
NO-ISSUE: add JWT auth, multi-tenant, and SecurityGroup E2E tests
omer-vishlitzky May 13, 2026
60aa3bd
Merge pull request #39 from osac-project/add-jwt-auth-smoke-tests
openshift-merge-bot[bot] May 18, 2026
b5d080e
MGMT-22635: add CaaS test coverage and test-caas Makefile target
omer-vishlitzky May 20, 2026
98024a1
Merge pull request #43 from omer-vishlitzky/caas-ci-tests
openshift-merge-bot[bot] May 21, 2026
51089e5
bump deletion timeouts from 300s to 600s
omer-vishlitzky May 26, 2026
71535b5
Merge pull request #47 from omer-vishlitzky/bump-delete-timeout
openshift-merge-bot[bot] May 26, 2026
617b8ce
helpers: fail fast when provision job or phase enters Failed
omer-vishlitzky May 26, 2026
4a4b4fe
Merge pull request #48 from omer-vishlitzky/fix/fail-fast-provision-wait
openshift-merge-bot[bot] May 26, 2026
7b6ae5a
fix: use Provisioned condition instead of job state in wait_for_provi…
akshaynadkarni May 27, 2026
219dd4c
fix: fast-fail on terminal Failed phase during provision wait
akshaynadkarni May 27, 2026
9cde32a
Merge pull request #49 from akshaynadkarni/fix/wait-for-provision-con…
openshift-merge-bot[bot] May 27, 2026
cf2608d
fix: harden CaaS tests against fragile assertions and hypershift dele…
omer-vishlitzky May 27, 2026
c1f3061
NO-ISSUE: Ensure tenant organizations exist before E2E tests
jhernand May 29, 2026
36d5aca
Remove 'shared' from the list of organizations to create
jhernand May 29, 2026
2346d72
Match grpcurl status code precisely in ensure_organization
jhernand May 29, 2026
d945373
Merge pull request #53 from jhernand/feat/ensure-tenant-organizations
openshift-merge-bot[bot] May 29, 2026
4decc39
Revert "NO-ISSUE: Ensure tenant organizations exist before E2E tests"
omer-vishlitzky May 30, 2026
2debb59
Merge pull request #54 from osac-project/revert-53-feat/ensure-tenant…
openshift-merge-bot[bot] May 31, 2026
3a6c696
OSAC-1169: force-clear orphaned agent labels during cluster deletion
omer-vishlitzky Jun 1, 2026
de870f9
Merge pull request #56 from omer-vishlitzky/osac-1169-fix-agent-label…
openshift-merge-bot[bot] Jun 1, 2026
4f7cb54
OSAC-1169: use non-blocking delete in CaaS test fixtures
omer-vishlitzky Jun 1, 2026
466a42d
Merge pull request #57 from omer-vishlitzky/osac-1169-fix-agent-label…
openshift-merge-bot[bot] Jun 2, 2026
0fa855b
Ensure tenant organizations exist before E2E tests
omer-vishlitzky Jun 3, 2026
a0cd449
Preserve exception chain in ensure_organization
omer-vishlitzky Jun 3, 2026
d3674a6
Merge pull request #59 from osac-project/fix-ensure-organizations-via…
openshift-merge-bot[bot] Jun 3, 2026
b0722e7
OSAC-768: Add network attachment support for VMaaS tests (#45)
ori-amizur Jun 3, 2026
8eab409
OSAC-206: Scaffold out publicip pool creation and deletion using grpc…
DakCrowder May 5, 2026
656afc0
OSAC-206: Write capacity tests for public ips, group tests in subdir
DakCrowder May 13, 2026
3e87f2f
OSAC-206: Reduce poll tretries
DakCrowder Jun 1, 2026
d873966
OSAC-206: Refactor capacity tests to share state but greatly reduce r…
DakCrowder Jun 2, 2026
add6d8f
OSAC-206: Bump delete wait timeouts to be consistent with other delet…
DakCrowder Jun 3, 2026
350c1e1
Merge pull request #42 from DakCrowder/publicip-lifecycle
openshift-merge-bot[bot] Jun 4, 2026
e460d6e
Increase PublicIP allocation timeout from 120s to 300s
omer-vishlitzky Jun 5, 2026
a2abfc0
Increase PublicIP allocation timeout from 120s to 300s
omer-vishlitzky Jun 5, 2026
755e6ab
NO_ISSUE: don't treat Failed phase as terminal in wait_for_cluster_ready
omer-vishlitzky Jun 6, 2026
d6cceff
Merge pull request #62 from omer-vishlitzky/NO_ISSUE-wait-for-provisi…
openshift-merge-bot[bot] Jun 7, 2026
54dd86d
OSAC-1383: force-cleanup orphaned CAPI Machine pre-terminate hooks du…
omer-vishlitzky Jun 10, 2026
b0619c8
Merge pull request #65 from omer-vishlitzky/fix-preterminate-hook-cle…
openshift-merge-bot[bot] Jun 10, 2026
98e97fa
OSAC-839: E2E integration tests for PublicIPAttachment lifecycle
DakCrowder Jun 9, 2026
b872d35
OSAC-706: add E2E tests for catalog item lifecycle
tzvatot May 20, 2026
1db95d0
OSAC-706: address code review findings
tzvatot Jun 9, 2026
36a27fb
OSAC-1548: add E2E tests for ComputeInstanceCatalogItem lifecycle
alosadagrande Jun 16, 2026
57eee2e
Add update, unpublish transition, and field_definitions E2E tests
alosadagrande Jun 19, 2026
deadbc8
OSAC-1593: add console e2e tests
sk-ilya Jun 24, 2026
cfad165
OSAC-77: Add E2E test for tenant storage onboarding lifecycle
zszabo-rh Jun 26, 2026
2120e01
Revert formatting-only changes to existing helper/client code
zszabo-rh Jun 26, 2026
4535a3e
Remove unused Organization CRUD methods from GRPCClient
zszabo-rh Jun 26, 2026
0055a97
Address CodeRabbit review findings
zszabo-rh Jun 26, 2026
3bdddfb
OSAC-1532: update E2E test client to use Tenants API
DakCrowder Jun 26, 2026
06f0fef
Merge pull request #70 from alosadagrande/OSAC-58/compute-instance-ca…
openshift-merge-bot[bot] Jun 28, 2026
eecd7dd
NO-ISSUE: parallelize test execution with pytest-xdist
sk-ilya Jun 24, 2026
76a6410
NO_ISSUE: don't treat Failed phase as terminal in wait helpers (#111)
omer-vishlitzky Jun 28, 2026
124957f
Merge pull request #96 from sk-ilya/parallelize-tests
openshift-merge-bot[bot] Jun 29, 2026
9693c7c
Merge pull request #110 from DakCrowder/OSAC-1532-use-tenants-api
openshift-merge-bot[bot] Jun 29, 2026
1e00b6d
NO-ISSUE: Request organization scope in JWT tokens for E2E tests
CrystalChun Jun 29, 2026
3020343
Merge pull request #107 from zszabo-rh/feat/OSAC-77-storage-e2e
openshift-merge-bot[bot] Jun 29, 2026
4006769
NO-ISSUE: Add users to Keycloak organizations during E2E test setup
CrystalChun Jun 29, 2026
45d0743
Fix PublicIPPool ready race between K8s CR and gRPC server
eliorerz Jul 1, 2026
ae3ba8b
Merge pull request #131 from CrystalChun/update-after-org-changes
openshift-merge-bot[bot] Jul 1, 2026
d9cfd7c
NO-ISSUE: Update tests to use valid user with valid tenant (#147)
CrystalChun Jul 1, 2026
ac190b1
OSAC-1221: add InstanceType E2E tests (#104)
ygalblum Jul 6, 2026
cc4b571
OSAC-2116: migrate E2E tests from cores/memory_gib to instance_type
ygalblum Jul 7, 2026
d0a1752
Add retry logic to get_jwt() for Keycloak startup flakiness
Jul 9, 2026
baacc82
Address security and timeout concerns in get_jwt()
Jul 9, 2026
770a50a
Merge pull request #181 from htayrie-rh/fix/keycloak-e2e-retry-logic
openshift-merge-bot[bot] Jul 9, 2026
6714a84
OSAC-1123: add CaaS cluster storage E2E test
akshaynadkarni Jun 30, 2026
311b5e7
OSAC-1123: increase cluster ready timeout to 60 minutes
akshaynadkarni Jul 8, 2026
ed51b61
OSAC-2092: Rename public-ip E2E tests to external-ip
ori-amizur Jul 8, 2026
d488d16
OSAC-1123: address review feedback on CaaS storage E2E test
akshaynadkarni Jul 13, 2026
5df5fac
Merge pull request #138 from akshaynadkarni/feat/OSAC-1123-caas-stora…
openshift-merge-bot[bot] Jul 14, 2026
891dfdd
OSAC-1561: add BareMetalInstance and BareMetalHost E2E test utilities
carbonin Jun 26, 2026
e0634bd
OSAC-1561: add BMaaS E2E lifecycle and power management tests
carbonin Jun 25, 2026
39ea9f3
OSAC-2801: Add CaaS/Netris e2e job
eliorerz Jul 21, 2026
fa2cd7c
OSAC-1586: add E2E test for cluster deletion feedback
vladikr Jul 15, 2026
7ff4a0c
OSAC-1586: add lightweight E2E test for cluster deletion feedback
vladikr Jul 16, 2026
3a3c10b
OSAC-1586: improve cleanup and error handling in E2E tests
vladikr Jul 23, 2026
adb3c8a
OSAC-1586: consolidate deletion feedback test and handle timing race
vladikr Jul 29, 2026
aeeba03
fix(OSAC-2789): assign per-worker log files and merge sorted e2e logs
amej Jul 29, 2026
177314d
Merge pull request #257 from amej/OSAC-2789-log-file-timestamps
openshift-merge-bot[bot] Jul 29, 2026
97712fe
Merge pull request #227 from vladikr/feat/OSAC-1586-cluster-delete-e2e
openshift-merge-bot[bot] Jul 29, 2026
49e1d5b
OSAC-3499: Bump BareMetalInstance deletion timeout past the operator'…
eliorerz Aug 2, 2026
0b69429
OSAC-3263: Update all objects in e2e to have a name
CrystalChun Aug 3, 2026
6b8e0a7
OSAC-3161: add gpu parameter to GRPCClient.create_instance_type
Tzif-Morgen Aug 5, 2026
8118afd
OSAC-1330: Update E2E tests for typed resource references (#296)
htayrie-rh Aug 5, 2026
625ddb9
Merge pull request #316 from Tzif-Morgen/feat/OSAC-3161-gpu-instancet…
openshift-merge-bot[bot] Aug 6, 2026
2ad4d16
OSAC-3402: Add E2E test for bare metal instance restart (#302)
mennyaboush Aug 11, 2026
5f3506d
OSAC-3434: Add VMaaS metering lifecycle E2E tests (#301)
omer-vishlitzky Aug 11, 2026
19035c3
NO-ISSUE: fix E2E flakes — retry metering HTTP, serialize BMaaS tests
omer-vishlitzky Aug 12, 2026
52c4f2c
NO-ISSUE: revert bmaas xdist_group — loadfile ignores group markers
omer-vishlitzky Aug 12, 2026
0b84c38
Revert "OSAC-3402: Add E2E test for bare metal instance restart (#302)"
omer-vishlitzky Aug 12, 2026
19cecf5
OSAC-1330: add references E2E test suite infrastructure
Aug 6, 2026
98c8db6
OSAC-3114: add E2E tests for IAM resource references
Aug 6, 2026
612ad64
OSAC-1330: discover cluster version from environment for cluster crea…
danielerez Aug 10, 2026
c30e00d
OSAC-3438: Add CaaS metering lifecycle E2E tests
omer-vishlitzky Aug 11, 2026
da3b4fe
fix: restore billing validation, merge CaaS tests into existing lifec…
omer-vishlitzky Aug 11, 2026
dd6b9fa
fix: validate topLevelDims for CaaS created/deleted events
omer-vishlitzky Aug 11, 2026
8c76bbe
fix: add scaling test with updated.v1 assertion
omer-vishlitzky Aug 12, 2026
f2bfde0
fix: suppress spurious warning on fixture teardown verify()
omer-vishlitzky Aug 12, 2026
94c6e94
fix JWT token expiry in gRPC test clients
omer-vishlitzky Aug 13, 2026
91511bb
fix review findings: TTL cache, pipefail, SHELL directive
omer-vishlitzky Aug 13, 2026
1db55f2
OSAC-2166: E2E tests for version-based cluster provisioning
sk-ilya Aug 6, 2026
0b5340e
OSAC-3837: add GPU flags to E2E CLI wrapper and test CLI instance typ…
Tzif-Morgen Aug 9, 2026
ecf3987
OSAC-3837: add private CLI support for E2E instance type tests
Tzif-Morgen Aug 16, 2026
7888676
OSAC-3721: add jwt_grpc_tenant1_admin gRPC fixture
slintes Aug 14, 2026
186249c
OSAC-3721: add DiskImage CRUD methods to GRPCClient
slintes Aug 14, 2026
a46e47d
OSAC-3553: gate bmaas e2e on gRPC readiness + retry first tenant create
carbonin Aug 14, 2026
069ea09
OSAC-3725: add ComputeInstance DiskImage integration E2E tests
slintes Aug 17, 2026
7e9432c
OSAC-3402: Add BMI restart E2E test in lifecycle file for sequential …
Aug 13, 2026
8d76ffc
OSAC-1060: Switch grpc and cli fixtures from SA token to JWT
danielerez Aug 18, 2026
a795518
OSAC-1060: Make JWT realm, client-id, and username configurable
danielerez Aug 20, 2026
992b174
OSAC-1980: update E2E tests for public NetworkClass removal
SiddarthR56 Aug 19, 2026
c273b97
OSAC-1980: keep network_class optional until backend removal lands
SiddarthR56 Aug 19, 2026
29ab7af
OSAC-4234: require explicit template id and assert template-side disk…
slintes Aug 21, 2026
0313183
OSAC-1980: drop remaining public NetworkClass E2E usage
SiddarthR56 Aug 21, 2026
bb558f4
OSAC-4205: Add NIC metadata E2E assertions to BMaaS lifecycle tests
adriengentil Aug 21, 2026
32ea39c
OSAC-4205: cross-check BMI MACs against BareMetalHost hardware inventory
adriengentil Aug 21, 2026
1babeff
OSAC-4205: drop test_baremetal_instance_tenant_isolation
adriengentil Aug 21, 2026
a53647c
OSAC-4205: check BMI CR MACs in _assert_nic_metadata, drop invariant …
adriengentil Aug 21, 2026
7702626
OSAC-4205: verify NIC chain BMH → BMI CR → gRPC API → CLI in order
adriengentil Aug 21, 2026
84e1a21
OSAC-4205: remove redundant MAC pattern check on BMH MACs
adriengentil Aug 21, 2026
067a35a
OSAC-4205: fix missing newline at end of file
adriengentil Aug 21, 2026
79acec1
OSAC-4205: fix CLI describe call — use user-defined name not K8s CR name
adriengentil Aug 21, 2026
e3210ae
OSAC-4205: soften CLI describe assertion — log warning if OSAC-4204 n…
adriengentil Aug 21, 2026
9ee4571
Revert "OSAC-4205: soften CLI describe assertion — log warning if OSA…
adriengentil Aug 21, 2026
80d074a
OSAC-4205: address CodeRabbit findings — lowercase API MACs, scope CL…
adriengentil Aug 21, 2026
487c9d9
NO-ISSUE: BMaaS inventory exhaustion e2e + sanity/regression markers
dmurugap Aug 21, 2026
618b019
WIP: NO-ISSUE: BMaaS & Netris Automations (#379)
danmanor Aug 24, 2026
45a7835
OSAC-3593: migrate bmaas e2e test suite from osac-test-infra
redhat-chai-bot Aug 24, 2026
e2e6d8a
OSAC-3593: add pyproject.toml with pytest configuration from osac-tes…
redhat-chai-bot Aug 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[project]
name = "osac-e2e"
version = "0.1.0"
description = "OSAC end-to-end test infrastructure"
requires-python = ">=3.11"
dependencies = [
"pytest>=8.0",
"pytest-xdist>=3.0",
"pyyaml>=6.0",
"websocket-client>=1.6",
]

[tool.setuptools.packages.find]
include = ["tests*"]

[tool.pytest.ini_options]
testpaths = ["tests"]
pythonpath = ["."]
addopts = "-n 4 --dist loadfile"
markers = [
"sanity: fast/essential e2e coverage for PR checks",
"regression: heavier or cross-flow e2e for periodic runs",
]
log_level = "INFO"
log_cli = true
log_cli_date_format = "%Y-%m-%dT%H:%M:%S%z"
log_cli_format = "%(asctime)s %(levelname)-8s %(message)s"
log_cli_level = "INFO"
log_file = "/tmp/test-output/e2e.log"
log_file_date_format = "%Y-%m-%dT%H:%M:%S%z"
log_file_format = "%(asctime)s %(levelname)-8s %(name)s %(message)s"
log_file_level = "INFO"
log_file_mode = "a"

[tool.basedpyright]
reportUnusedCallResult = false
reportAny = false
reportExplicitAny = false

[tool.ruff]
target-version = "py311"
line-length = 120

[tool.ruff.format]
skip-magic-trailing-comma = true

[tool.ruff.lint.isort]
split-on-trailing-comma = false

[tool.ruff.lint]
select = ["E", "F", "W", "I", "UP", "ANN", "B", "SIM", "RUF"]

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["ANN101", "ANN201"]
Empty file added tests/__init__.py
Empty file.
Empty file added tests/bmaas/__init__.py
Empty file.
62 changes: 62 additions & 0 deletions tests/bmaas/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
from __future__ import annotations

import subprocess
import tempfile
import uuid
from collections.abc import Generator
from pathlib import Path

import pytest

from tests.core.grpc_client import GRPCClient
from tests.core.runner import env


@pytest.fixture(scope="session")
def bmi_template() -> str:
return env("OSAC_BMI_TEMPLATE", "bm-host-provisioning")


@pytest.fixture(scope="session")
def bmh_namespace() -> str:
return env("OSAC_BMH_NAMESPACE", "host-inventory")


@pytest.fixture(scope="session")
def test_run_id() -> str:
return str(uuid.uuid4())[:8]


@pytest.fixture(scope="session")
def ssh_public_key() -> Generator[str, None, None]:
with tempfile.TemporaryDirectory() as tmpdir:
key_path = Path(tmpdir) / "bmi-test-key"
subprocess.run(
["ssh-keygen", "-t", "ed25519", "-f", str(key_path), "-N", "", "-C", "bmi-e2e-test"],
capture_output=True,
check=True,
)
yield (key_path.with_suffix(".pub")).read_text().strip()


@pytest.fixture(scope="session")
def catalog_item(private_grpc: GRPCClient, bmi_template: str, test_run_id: str) -> Generator[str, None, None]:
name = f"e2e-bmaas-{test_run_id}"
print(f"\nCreating BareMetalInstanceCatalogItem: {name}")
item_id: str = private_grpc.create_baremetal_instance_catalog_item(
name=name,
title=f"E2E BMaaS Test ({test_run_id})",
description="Temporary catalog item for BMaaS E2E tests",
template=bmi_template,
field_definitions=[{"path": "ssh_public_key", "display_name": "SSH Public Key", "editable": True}],
)
print(f"CatalogItem created: {item_id}")

yield item_id

try:
print(f"\nDeleting BareMetalInstanceCatalogItem {item_id}...")
private_grpc.delete_baremetal_instance_catalog_item(item_id=item_id)
print(f"CatalogItem {item_id} deleted")
except Exception as e:
print(f"WARNING: Failed to delete catalog item {item_id}: {e}")
1 change: 1 addition & 0 deletions tests/bmaas/networking/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from __future__ import annotations
106 changes: 106 additions & 0 deletions tests/bmaas/networking/bmi_ssh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
from __future__ import annotations

import logging
import subprocess

log = logging.getLogger(__name__)

_SSH_OPTS = [
"-o",
"ConnectTimeout=10",
"-o",
"StrictHostKeyChecking=no",
"-o",
"UserKnownHostsFile=/dev/null",
"-i",
"/root/.ssh/id_rsa",
]


def get_bmc_ip(bmh_name: str) -> str:
domiflist = subprocess.run(["virsh", "domiflist", bmh_name], capture_output=True, text=True, timeout=10, check=True)
bmc_mac = ""
for line in domiflist.stdout.splitlines():
if "bmc-net" in line:
bmc_mac = line.split()[4]
break
if not bmc_mac:
raise RuntimeError(f"No bmc-net interface found for VM {bmh_name}")

leases = subprocess.run(
["virsh", "net-dhcp-leases", "bmc-net"], capture_output=True, text=True, timeout=10, check=True
)
for line in leases.stdout.splitlines():
if bmc_mac in line:
ip_with_prefix = line.split()[4]
return ip_with_prefix.split("/")[0]
raise RuntimeError(f"No DHCP lease found for MAC {bmc_mac} on bmc-net")


def ssh_bmi(bmc_ip: str, command: str, timeout: int = 30) -> subprocess.CompletedProcess[str]:
return subprocess.run(
["ssh", *_SSH_OPTS, f"fedora@{bmc_ip}", command], capture_output=True, text=True, timeout=timeout, check=True
)


def ssh_bmi_unchecked(bmc_ip: str, command: str, timeout: int = 30) -> tuple[str, int]:
try:
result = subprocess.run(
["ssh", *_SSH_OPTS, f"fedora@{bmc_ip}", command],
capture_output=True,
text=True,
timeout=timeout,
check=False,
)
except subprocess.TimeoutExpired:
log.warning("ssh_bmi_unchecked(%s): subprocess timed out after %ds", bmc_ip, timeout)
return f"ssh timed out after {timeout}s", 255
return (result.stdout.strip() + "\n" + result.stderr.strip()).strip(), result.returncode


def arping(bmc_ip: str, target_ip: str, interface: str = "ens5", count: int = 3) -> bool:
_, rc = ssh_bmi_unchecked(bmc_ip, f"arping -c {count} -I {interface} {target_ip}", timeout=30)
return rc == 0


def ping(bmc_ip: str, target_ip: str, count: int = 3, wait: int = 3) -> bool:
_, rc = ssh_bmi_unchecked(bmc_ip, f"ping -c {count} -W {wait} {target_ip}", timeout=30)
return rc == 0


def curl_status(bmc_ip: str, url: str, timeout: int = 15) -> int:
output, rc = ssh_bmi_unchecked(
bmc_ip,
f"curl -s -o /dev/null -w '%{{http_code}}' --connect-timeout {timeout} {url}",
timeout=timeout + 30,
)
log.info("curl_status(%s, %s): ssh_rc=%d, output=%r", bmc_ip, url, rc, output[-200:])
for line in output.strip().splitlines():
line = line.strip()
if line.isdigit() and len(line) == 3:
return int(line)
log.warning("curl_status: no HTTP status code found in output, returning 0")
return 0


def ssh_via_external_ip(external_ip: str, command: str = "hostname", timeout: int = 15) -> str:
result = subprocess.run(
[
"ssh",
"-o",
f"ConnectTimeout={timeout}",
"-o",
"StrictHostKeyChecking=no",
"-o",
"UserKnownHostsFile=/dev/null",
"-i",
"/root/.ssh/id_rsa",
f"fedora@{external_ip}",
command,
],
capture_output=True,
text=True,
timeout=timeout + 10,
check=True,
)
return result.stdout.strip()
55 changes: 55 additions & 0 deletions tests/bmaas/networking/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from __future__ import annotations

import uuid
from pathlib import Path

import pytest

from tests.core.grpc_client import GRPCClient
from tests.core.runner import env


@pytest.fixture(scope="session")
def external_ip_pool_name() -> str:
return env("OSAC_EXTERNAL_IP_POOL", "tenant-external-pool")


@pytest.fixture(scope="session")
def external_ip_pool_cidr() -> str:
return env("OSAC_EXTERNAL_IP_POOL_CIDR", "198.51.100.24/29")


@pytest.fixture(scope="session")
def auto_eip_catalog_item_name() -> str:
return env("OSAC_BMI_AUTO_EIP_CATALOG_ITEM", "ci-bm-auto-eip")


@pytest.fixture(scope="session")
def mgmt_cluster_ip() -> str:
return env("OSAC_MGMT_CLUSTER_IP", "192.168.40.2")


@pytest.fixture(scope="session")
def net_test_run_id() -> str:
return uuid.uuid4().hex[:8]


@pytest.fixture(scope="session")
def bmi_template() -> str:
return env("OSAC_BMI_TEMPLATE", "bm-host-provisioning")


@pytest.fixture(scope="session")
def bmh_namespace() -> str:
return env("OSAC_BMH_NAMESPACE", "host-inventory")


@pytest.fixture(scope="session")
def catalog_item_name() -> str:
return env("OSAC_BMI_CATALOG_ITEM", "ci-bm-default")


@pytest.fixture(scope="session")
def net_ssh_public_key() -> str:
key_path = Path(env("OSAC_BMI_SSH_PUBLIC_KEY", "/root/.ssh/id_rsa.pub"))
return key_path.read_text().strip()
Loading
Loading