Skip to content

Commit

Permalink
Get all integration requests if session token is none (#141)
Browse files Browse the repository at this point in the history
Currently, the test agent will only return tested integrations for a specific token, and there is no way to get all tested integrations if multiple tokens were used. This PR changes that to allow for getting all tested integrations if no session token is included.

Co-authored-by: Kyle Verhoog <kyle@verhoog.ca>
  • Loading branch information
wconti27 and Kyle-Verhoog authored Oct 12, 2023
1 parent 34e41d9 commit c72b457
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ddapm_test_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,14 @@ async def _tracestats_by_session(self, token: Optional[str]) -> List[v06StatsPay
return stats

async def _integration_requests_by_session(
self, token: Optional[str], include_sent_integrations: Optional[bool] = False
self,
token: Optional[str],
include_sent_integrations: Optional[bool] = False,
) -> List[Request]:
"""Get all requests with an associated tested Integration."""
integration_requests: List[Request] = []
for req in self._requests_by_session(token):
requests = self._requests if token is None else self._requests_by_session(token)
for req in requests:
# see if the request was to update with a newly tested integration
if req.match_info.handler == self.handle_put_tested_integrations:
if "integration" not in req:
Expand Down Expand Up @@ -520,11 +523,10 @@ async def handle_get_tested_integrations(self, request: Request) -> web.Response
aggregated_text = ""
seen_integrations = set()
req_headers = {}
token = _session_token(request)

# get all requests associated with an integration
reqs = await self._integration_requests_by_session(
token=_session_token(request), include_sent_integrations=True
)
reqs = await self._integration_requests_by_session(token=token, include_sent_integrations=True)
for req in reqs:
integration = req["integration"]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
Add fix for getting tested integrations when multiple session tokens are used. When no session token is included for a [GET] request to
``/test/integrations/tested_versions``, all tested integrations are returned now.

0 comments on commit c72b457

Please sign in to comment.