Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
harrryr committed Jul 4, 2024
1 parent 431ab46 commit 548cbf9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def apply_instrumentation_patches() -> None:
from gevent import monkey

monkey.patch_all()
elif gevent_patch_module != "none":
elif gevent_patch_module == "none":
pass
else:
module_list = [module.strip() for module in gevent_patch_module.split(",")]

# pylint: disable=import-outside-toplevel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def test_instrumentation_patch(self):
def _run_patch_behaviour_tests(self):
# Test setup
self.method_patches[GET_DISTRIBUTION_PATCH].return_value = "CorrectDistributionObject"
# Test setup to check whether only these two modules get patched by gevent monkey
os.environ[AWS_GEVENT_PATCH_MODULES] = "os, ssl"
# Test setup to not patch gevent
os.environ[AWS_GEVENT_PATCH_MODULES] = "none"

# Validate unpatched upstream behaviour - important to detect upstream changes that may break instrumentation
self._test_unpatched_botocore_instrumentation()
Expand All @@ -71,6 +71,15 @@ def _run_patch_behaviour_tests(self):

# Validate patched upstream behaviour - important to detect downstream changes that may break instrumentation
self._test_patched_botocore_instrumentation()
self._test_unpatched_gevent_instrumentation()

# Test setup to check whether only these two modules get patched by gevent monkey
os.environ[AWS_GEVENT_PATCH_MODULES] = "os, ssl"

# Apply patches
apply_instrumentation_patches()

# Validate that os and ssl gevent monkey patch modules were patched
self._test_patched_gevent_os_ssl_instrumentation()

# Set the value to 'all' so that all the remaining gevent monkey patch modules are patched
Expand Down

0 comments on commit 548cbf9

Please sign in to comment.