Skip to content

Conversation

@PIRO-V
Copy link
Member

@PIRO-V PIRO-V commented Oct 22, 2025

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings October 22, 2025 16:07
@PIRO-V PIRO-V requested review from axisc, hmlam and sjkwak as code owners October 22, 2025 16:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a unit test to verify AMQP link negotiation behavior when the client sets max_message_size=0 (unlimited) and the server responds with a specific limit (20MB). The test ensures the link correctly adopts the server's limit as the final maximum message size.

Key Changes:

  • Added test case test_max_message_size_negotiation_with_client_unlimited to validate AMQP attach frame negotiation
  • Imported additional dependencies (Source, Target, Mock, patch, LINK_MAX_MESSAGE_SIZE) to support the new test

"""
Test AMQP attach frame negotiation where client sends max_message_size=0 (unlimited)
and server responds with its limit (20MB), resulting in final size of 20MB.
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring has trailing whitespace on line 94 and an unnecessary blank line 95. Remove the trailing whitespace and the blank line before the closing triple quotes.

Suggested change

Copilot uses AI. Check for mistakes.
3,
name="test_link",
role=False, # Sender role
source_address="test_source",
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test uses hardcoded string values (test_source, test_target, test_link) that are duplicated in both the Link instantiation and the mock attach frame. Consider defining these as constants at the beginning of the test function to improve maintainability and reduce the risk of inconsistencies.

Copilot uses AI. Check for mistakes.
)

# Verifying that client sends 0 (unlimited) in attach frame
assert link.max_message_size == 0, f"Expected client max_message_size=0, got {link._max_message_size}"
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertion message references link._max_message_size (private attribute) but the assertion checks link.max_message_size (public property). The error message should reference the same attribute being tested: change {link._max_message_size} to {link.max_message_size}.

Suggested change
assert link.max_message_size == 0, f"Expected client max_message_size=0, got {link._max_message_size}"
assert link.max_message_size == 0, f"Expected client max_message_size=0, got {link.max_message_size}"

Copilot uses AI. Check for mistakes.
Comment on lines +118 to +131
"test_link",
3,
False,
0,
1,
Source(address="test_source"),
Target(address="test_target"),
None,
False,
None,
20 * 1024 * 1024,
None,
None,
None, ]
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mock attach frame list lacks comments explaining what each positional element represents. Add inline comments describing each field (e.g., name, handle, role, snd_settle_mode, rcv_settle_mode, source, target, unsettled, incomplete_unsettled, initial_delivery_count, max_message_size, offered_capabilities, desired_capabilities, properties) to improve test readability and maintainability.

Suggested change
"test_link",
3,
False,
0,
1,
Source(address="test_source"),
Target(address="test_target"),
None,
False,
None,
20 * 1024 * 1024,
None,
None,
None, ]
"test_link", # name
3, # handle
False, # role (False = sender, True = receiver)
0, # snd_settle_mode
1, # rcv_settle_mode
Source(address="test_source"),# source
Target(address="test_target"),# target
None, # unsettled
False, # incomplete_unsettled
None, # initial_delivery_count
20 * 1024 * 1024, # max_message_size
None, # offered_capabilities
None, # desired_capabilities
None, # properties
]

Copilot uses AI. Check for mistakes.
20 * 1024 * 1024,
None,
None,
None, ]
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are multiple spaces before the closing bracket. This appears to be inconsistent whitespace that should be removed for cleaner formatting.

Suggested change
None, ]
None, ]

Copilot uses AI. Check for mistakes.
expected_final_size = SERVER_MAX_MESSAGE_SIZE
# Verifying remote_max_message_size is set correctly
assert link.remote_max_message_size == expected_final_size, \
f"Expected remote_max_message_size={SERVER_MAX_MESSAGE_SIZE}, got {link.remote_max_message_size}"
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertion message uses SERVER_MAX_MESSAGE_SIZE directly instead of the expected_final_size variable that was just defined. For consistency and clarity, the message should reference expected_final_size to match what's being tested.

Suggested change
f"Expected remote_max_message_size={SERVER_MAX_MESSAGE_SIZE}, got {link.remote_max_message_size}"
f"Expected remote_max_message_size={expected_final_size}, got {link.remote_max_message_size}"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant