Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix opm registry serve command #700

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 1 addition & 5 deletions iib/workers/tasks/opm_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,10 @@ def opm_serve(
return result


@create_port_filelocks(port_purposes=["opm_port", "opm_pprof_port"])
@create_port_filelocks(port_purposes=["opm_port"])
def opm_registry_serve(
opm_port: int,
db_path: str,
opm_pprof_port: Optional[int] = None,
) -> Tuple[int, subprocess.Popen]:
"""
Locally start OPM registry service, which can be communicated with using gRPC queries.
Expand All @@ -389,9 +388,6 @@ def opm_registry_serve(
'-t',
'/dev/null',
]
if opm_pprof_port:
# by default opm uses the 127.0.0.1:6060
cmd.extend(["--pprof-addr", f"127.0.0.1:{str(opm_pprof_port)}"])

cwd = os.path.dirname(db_path)
result = (
Expand Down
12 changes: 6 additions & 6 deletions tests/test_workers/test_tasks/test_opm_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ def test_func(argument, opm_port, opm_pprof_port=None):
@mock.patch(
'iib.workers.tasks.opm_operations.get_opm_port_stacks',
return_value=(
[[5001, 6001], [5002, 6002]],
['opm_port', 'opm_pprof_port'],
[[5001], [5002]],
['opm_port'],
),
)
@mock.patch('iib.workers.tasks.opm_operations.PortFileLock.lock_acquire')
Expand All @@ -291,8 +291,8 @@ def test_opm_registry_serve(mock_pfl_u, mock_pfl_la, mock_gops, mock_scap):
port, _ = opm_operations.opm_registry_serve(db_path='some_path.db')
assert port == 5001
assert mock_scap.call_count == 1
assert mock_pfl_la.call_count == 2
assert mock_pfl_u.call_count == 2
assert mock_pfl_la.call_count == 1
assert mock_pfl_u.call_count == 1


@pytest.mark.parametrize('is_fbc', (True, False))
Expand Down Expand Up @@ -325,8 +325,8 @@ def test_opm_serve_from_index(
Also test create_port_filelocks working correctly with opm_serve_from_index.
"""
mock_gops.return_value = (
[[5001, 6001], [5002, 6002], [5003, 6003]],
['opm_port', 'opm_pprof_port'],
[[5001], [5002], [5003]],
['opm_port'],
)
my_mock = mock.MagicMock()
mock_ifbc.return_value = is_fbc
Expand Down