Skip to content

Commit

Permalink
testing: Add responses workaround for focal/impish (#1403)
Browse files Browse the repository at this point in the history
The responses workaround relies on an internal variable, and the
internals changed between Bionic and Focal, so the workaround needs
to be updated as well.
  • Loading branch information
TheRealFalcon authored Apr 26, 2022
1 parent 02f213b commit 655d76b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/unittests/sources/test_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,14 +540,20 @@ def test_network_config_cached_property_refreshed_on_upgrade(self, m_dhcp):
self.assertTrue(ds.get_data())

# Workaround https://github.com/getsentry/responses/issues/212
# Can be removed when requests < 0.17.0 is no longer tested
# i.e. after Focal is EOL
if hasattr(responses.mock, "_urls"):
# Can be removed when Bionic is EOL
for index, url in enumerate(responses.mock._urls):
if url["url"].startswith(
"http://169.254.169.254/2009-04-04/meta-data/"
):
del responses.mock._urls[index]
elif hasattr(responses.mock, "_matches"):
# Can be removed when Focal and Impish are EOL
for index, response in enumerate(responses.mock._matches):
if response.url.startswith(
"http://169.254.169.254/2009-04-04/meta-data/"
):
del responses.mock._matches[index]

# Provide new revision of metadata that contains network data
register_mock_metaserver(
Expand Down

0 comments on commit 655d76b

Please sign in to comment.