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

refactor: upgrade all integration tests to asyncio async await #667

Merged
merged 21 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
65ef465
update get_notification call part of send notification to async
taddes Mar 21, 2024
0a2c75b
autouse for asyncio mode for pytest-asyncio test collector event loop
taddes Mar 23, 2024
ec916db
async await updates for all tests
taddes Mar 23, 2024
1302411
convert httpx calls to async context managers
taddes Apr 1, 2024
4b83ec5
verify if one extra value now in queue to solve variance in result be…
taddes Apr 2, 2024
333d8de
update timeout to possibly resolve ci error
taddes Apr 2, 2024
97c8232
update to disconnct for client
taddes Apr 2, 2024
ac6737b
sentry method to clear queue explicitly
taddes Apr 15, 2024
a7d735f
additional calls to sentry queue clear
taddes Apr 15, 2024
703ea17
change to moz_ping, add new method to test low level ping and await f…
taddes Apr 16, 2024
9ad20d0
move access of events from queue into context manager. Divergent resu…
taddes Apr 16, 2024
382b00e
refactor no output to try and fix ci breakage. Passes locally
taddes Apr 16, 2024
04212fd
alter timeout
taddes Apr 16, 2024
d2aca0f
add pytest-order to run sentry test first, alter text and add note on…
taddes Apr 16, 2024
3593708
added note for test order
taddes Apr 16, 2024
c1bbc09
alteration of timeout for queue get to resolve runtime ci flake
taddes Apr 17, 2024
c4f89cf
added note context on increased timeout in autoconnect sentry test
taddes Apr 17, 2024
b723f40
rebase and update lockfile
taddes Apr 18, 2024
334f4f8
refactor review comments
taddes Apr 19, 2024
d7d3958
remove extraneous comment
taddes Apr 19, 2024
1f44987
remove websocket ping test and asyncio dep from rev comments
taddes Apr 19, 2024
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
9 changes: 5 additions & 4 deletions tests/integration/async_push_test_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module containing Test Client for autopush-rs integration tests."""

import asyncio
import json
import logging
Expand Down Expand Up @@ -236,7 +237,7 @@ async def send_notification(
# Pull the sent notification immediately if connected.
# Calls `get_notification` to get response from websocket.
if self.ws and self.ws.is_client: # check back on this after integration
return object.__getattribute__(self, "get_notification")(timeout)
return await object.__getattribute__(self, "get_notification")(timeout)
else:
return resp

Expand Down Expand Up @@ -272,13 +273,13 @@ async def get_broadcast(self, timeout=1): # pragma: no cover
log.error(f"Error: {ex}")
return None

async def ping(self):
"""Test websocket ping."""
async def moz_ping(self):
"""Send a very small message and await response."""
if not self.ws:
raise Exception("WebSocket client not available as expected.")

log.debug("Send: {}")
await self.ws.ping("{}")
await self.ws.send("{}")
result = await self.ws.recv()
log.debug(f"Recv: {result}")
return result
Expand Down
1 change: 1 addition & 0 deletions tests/integration/push_test_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module containing Test Client for autopush-rs integration tests."""

import json
import logging
import random
Expand Down
Loading