diff --git a/ddapm_test_agent/agent.py b/ddapm_test_agent/agent.py index fd16c040..3118a005 100644 --- a/ddapm_test_agent/agent.py +++ b/ddapm_test_agent/agent.py @@ -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: @@ -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"] diff --git a/releasenotes/notes/fix-getting-tested-integrations-multiple-session-tokens-4ee41d545754f87f.yaml b/releasenotes/notes/fix-getting-tested-integrations-multiple-session-tokens-4ee41d545754f87f.yaml new file mode 100644 index 00000000..d8de0fbb --- /dev/null +++ b/releasenotes/notes/fix-getting-tested-integrations-multiple-session-tokens-4ee41d545754f87f.yaml @@ -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.