Skip to content

Commit

Permalink
tests: split mctp_mctp_endpoint_obj helper into control & common inte…
Browse files Browse the repository at this point in the history
…rfaces

We currently have a test helper:

  mctpd_mctp_endpoint_obj(dbus, path)

which returns the au.com.codeconstruct.MCTP.Endpoint1 interface proxy
for an endpoint.

However, an upcoming test will need the xyz.openbmc_project.MCTP
interface, so split into _common and _control helpers.

Signed-off-by: Jeremy Kerr <[email protected]>
  • Loading branch information
jk-ozlabs committed Nov 7, 2024
1 parent 089dc53 commit 91dbd23
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
18 changes: 16 additions & 2 deletions tests/mctp_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,23 @@ async def mctpd_mctp_iface_obj(dbus, iface):
)
return await obj.get_interface('au.com.codeconstruct.MCTP.BusOwner1')

async def mctpd_mctp_endpoint_obj(dbus, path):
async def mctpd_mctp_endpoint_obj(dbus, path, iface):
obj = await dbus.get_proxy_object(
'au.com.codeconstruct.MCTP1',
path,
)
return await obj.get_interface('au.com.codeconstruct.MCTP.Endpoint1')
return await obj.get_interface(iface)

async def mctpd_mctp_endpoint_control_obj(dbus, path):
return await mctpd_mctp_endpoint_obj(
dbus,
path,
'au.com.codeconstruct.MCTP.Endpoint1'
)

async def mctpd_mctp_endpoint_common_obj(dbus, path):
return await mctpd_mctp_endpoint_obj(
dbus,
path,
'xyz.openbmc_project.MCTP.Endpoint'
)
7 changes: 5 additions & 2 deletions tests/test_mctpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import uuid
import asyncdbus

from mctp_test_utils import mctpd_mctp_iface_obj, mctpd_mctp_endpoint_obj
from mctp_test_utils import (
mctpd_mctp_iface_obj,
mctpd_mctp_endpoint_control_obj
)
from conftest import Endpoint, MCTPSockAddr

# DBus constant symbol suffixes:
Expand Down Expand Up @@ -117,7 +120,7 @@ async def test_remove_endpoint(dbus, mctpd):

assert(len(mctpd.system.neighbours) == 1)

ep = await mctpd_mctp_endpoint_obj(dbus, path)
ep = await mctpd_mctp_endpoint_control_obj(dbus, path)

await ep.call_remove()
assert(len(mctpd.system.neighbours) == 0)
Expand Down

0 comments on commit 91dbd23

Please sign in to comment.