Skip to content

Fix test_queue_return flaky test and other nits #1118

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

Merged
merged 4 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions azure_functions_worker/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async def connect(cls, host: str, port: int, worker_id: str,
logger.info('Successfully opened gRPC channel to %s:%s ', host, port)
return disp

async def dispatch_forever(self):
async def dispatch_forever(self): # sourcery skip: swap-if-expression
if DispatcherMeta.__current_dispatcher__ is not None:
raise RuntimeError('there can be only one running dispatcher per '
'process')
Expand Down Expand Up @@ -312,10 +312,11 @@ async def _handle__functions_metadata_request(self, request):
status=protos.StatusResult.Success)))

try:
fx_metadata_results = []
indexed_functions = loader.index_function_app(function_path)
logger.info('Indexed function app and found %s functions',
len(indexed_functions))

fx_metadata_results = []
if indexed_functions:
indexed_function_logs: List[str] = []
for func in indexed_functions:
Expand Down Expand Up @@ -596,8 +597,7 @@ async def _handle__close_shared_memory_resources_request(self, request):
try:
for map_name in map_names:
try:
to_delete_resources = \
False if self._function_data_cache_enabled else True
to_delete_resources = not self._function_data_cache_enabled
success = self._shmem_mgr.free_mem_map(map_name,
to_delete_resources)
results[map_name] = success
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def queue_trigger_message_return(msg: func.QueueMessage) -> bytes:
@app.function_name(name="queue_trigger_return")
@app.generic_trigger(arg_name="msg",
type="queueTrigger",
queue_name="testqueue-message-return",
queue_name="testqueue-return",
connection="AzureWebJobsStorage")
@app.generic_output_binding(
arg_name="$return",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"direction": "in",
"name": "msg",
"queueName": "testqueue-message-return",
"connection": "AzureWebJobsStorage",
"connection": "AzureWebJobsStorage"
},
{
"type": "blob",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"direction": "in",
"name": "msg",
"queueName": "testqueue-return",
"connection": "AzureWebJobsStorage",
"connection": "AzureWebJobsStorage"
},
{
"type": "blob",
Expand Down
6 changes: 0 additions & 6 deletions tests/endtoend/test_queue_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class TestQueueFunctions(testutils.WebHostTestCase):
def get_script_dir(cls):
return testutils.E2E_TESTS_FOLDER / 'queue_functions'

@testutils.retryable_test(3, 5)
def test_queue_basic(self):
r = self.webhost.request('POST', 'put_queue',
data='test-message')
Expand All @@ -33,7 +32,6 @@ def test_queue_basic(self):
'time_next_visible', 'pop_receipt', 'dequeue_count'}:
self.assertIsNotNone(msg.get(attr))

@testutils.retryable_test(3, 5)
def test_queue_return(self):
r = self.webhost.request('POST', 'put_queue_return',
data='test-message-return')
Expand All @@ -46,7 +44,6 @@ def test_queue_return(self):
self.assertEqual(r.status_code, 200)
self.assertEqual(r.text, 'test-message-return')

@testutils.retryable_test(3, 5)
def test_queue_message_object_return(self):
r = self.webhost.request('POST', 'put_queue_message_return',
data='test-message-object-return')
Expand All @@ -59,7 +56,6 @@ def test_queue_message_object_return(self):
self.assertEqual(r.status_code, 200)
self.assertEqual(r.text, 'test-message-object-return')

@testutils.retryable_test(3, 5)
def test_queue_untyped_return(self):
r = self.webhost.request('POST', 'put_queue_untyped_return',
data='test-untyped-return')
Expand All @@ -72,7 +68,6 @@ def test_queue_untyped_return(self):
self.assertEqual(r.status_code, 200)
self.assertEqual(r.text, 'test-untyped-return')

@testutils.retryable_test(3, 5)
def test_queue_return_multiple(self):
r = self.webhost.request('POST', 'put_queue_return_multiple',
data='foo')
Expand All @@ -83,7 +78,6 @@ def test_queue_return_multiple(self):
# wait for queue_trigger to process the queue item
time.sleep(1)

@testutils.retryable_test(3, 5)
def test_queue_return_multiple_outparam(self):
r = self.webhost.request('POST', 'put_queue_multiple_out',
data='foo')
Expand Down