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

NH-62591 Add temp switches for unit tests while c-lib <13 #249

Merged
merged 1 commit into from
Dec 11, 2023
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
14 changes: 10 additions & 4 deletions tests/unit/test_apm_config/test_apm_config_get_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@
OboeAPI as NoopOboeApi,
)
from solarwinds_apm.extension import oboe as Extension
from solarwinds_apm.extension.oboe import (
Context,
OboeAPI,
)
from solarwinds_apm.extension.oboe import Context

try:
# c-lib <14 does not have OboeAPI
# TODO remove the except after upgrading
# https://swicloud.atlassian.net/browse/NH-68264
from solarwinds_apm.extension.oboe import OboeAPI
except ImportError:
from solarwinds_apm.apm_noop import OboeAPI as OboeAPI


# pylint: disable=unused-import
from .fixtures.env_vars import fixture_mock_env_vars
Expand Down
18 changes: 14 additions & 4 deletions tests/unit/test_sampler/test_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,20 @@ def test_calculate_liboboe_decision_is_lambda(
"getTracingDecision": mock_get_tracing_decision
}
)
mock_oboe_api_component = mocker.patch(
"solarwinds_apm.extension.oboe.OboeAPI.__init__",
return_value=mock_oboe_api
)
try:
mock_oboe_api_component = mocker.patch(
"solarwinds_apm.extension.oboe.OboeAPI.__init__",
return_value=mock_oboe_api
)
except ModuleNotFoundError:
# c-lib <14 does not have OboeAPI
# TODO remove the except after upgrading
# https://swicloud.atlassian.net/browse/NH-68264
mock_oboe_api_component = mocker.patch(
"solarwinds_apm.apm_noop.OboeAPI.__init__",
return_value=mock_oboe_api
)

mock_apm_config.configure_mock(
**{
"agent_enabled": True,
Expand Down