Skip to content

[nexus] add test_srp_lease to validate SRP client/server interactions - #12588

Merged
jwhui merged 1 commit into
openthread:mainfrom
abtink:test/srp-lease-fuzz
Mar 3, 2026
Merged

[nexus] add test_srp_lease to validate SRP client/server interactions#12588
jwhui merged 1 commit into
openthread:mainfrom
abtink:test/srp-lease-fuzz

Conversation

@abtink

@abtink abtink commented Feb 28, 2026

Copy link
Copy Markdown
Member

This commit adds a new Nexus test test_srp_lease to verify the behavior of the SRP server and client regarding lease expirations and state updates. The test creates a network with an SRP server and multiple client nodes that randomly perform various SRP operations including registering, updating, unregistering, and removing services, as well as abruptly disconnecting. The test then validates that the SRP server correctly updates the host and service states, such as marking them as deleted or fully removing them when their leases expire or when explicitly requested by the clients.

This commit adds a new Nexus test `test_srp_lease` to verify the
behavior of the SRP server and client regarding lease expirations and
state updates. The test creates a network with an SRP server and
multiple client nodes that randomly perform various SRP operations
including registering, updating, unregistering, and removing services,
as well as abruptly disconnecting. The test then validates that the
SRP server correctly updates the host and service states, such as
marking them as deleted or fully removing them when their leases
expire or when explicitly requested by the clients.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a crucial new test case for the SRP (Service Registration Protocol) implementation. The test_srp_lease suite is designed to rigorously validate the SRP server's ability to correctly manage host and service states, particularly in scenarios involving client lease expirations and dynamic registration changes. By simulating a variety of client actions and network conditions, this test enhances the robustness and reliability of the SRP server's state management.

Highlights

  • New SRP Lease Test: Introduced test_srp_lease to validate SRP client and server interactions, specifically focusing on lease expirations and state updates.
  • Comprehensive SRP Behavior Validation: The test simulates various client behaviors including registering, updating, unregistering, removing services, and abrupt disconnections to ensure the SRP server correctly manages host and service states.
  • Server State Verification: Verifies that the SRP server accurately marks hosts and services as deleted or fully removes them upon lease expiration or explicit client requests.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • tests/nexus/CMakeLists.txt
    • Added the new srp_lease test to the list of Nexus tests.
  • tests/nexus/test_srp_lease.cpp
    • Implemented a comprehensive test suite for SRP client/server lease and state management.
Activity
  • No activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new Nexus test, test_srp_lease, to validate SRP client and server interactions, particularly concerning lease expirations and state updates. The test is well-designed, covering a range of scenarios including service registration, updates, unregistration, removal, and abrupt client disconnections. The implementation is robust and effectively verifies the expected server behavior. My review includes a couple of suggestions to further enhance the test's comprehensiveness and correctness.

Comment thread tests/nexus/test_srp_lease.cpp
Comment thread tests/nexus/test_srp_lease.cpp
@github-actions

Copy link
Copy Markdown

Merging #12588 into main

name branch text data bss total
ot-cli-ftd d0237f5 482264 860 66532 549656
d41d0cd 482264 860 66532 549656
+/- +0 +0 +0 +0
ot-ncp-ftd d0237f5 448164 764 61768 510696
d41d0cd 448164 764 61768 510696
+/- +0 +0 +0 +0
ot-cli-mtd d0237f5 374696 764 50964 426424
d41d0cd 374696 764 50964 426424
+/- +0 +0 +0 +0
ot-ncp-mtd d0237f5 355828 764 46232 402824
d41d0cd 355828 764 46232 402824
+/- +0 +0 +0 +0
ot-cli-ftd-br d0237f5 598056 868 136588 735512
d41d0cd 598056 868 136588 735512
+/- +0 +0 +0 +0
ot-rcp d0237f5 63328 568 20804 84700
d41d0cd 63328 568 20804 84700
+/- +0 +0 +0 +0
Library files
name branch text data bss total
libopenthread-ftd.a d0237f5 249820 95 40311 290226
d41d0cd 249820 95 40311 290226
+/- +0 +0 +0 +0
libopenthread-cli-ftd.a d0237f5 61694 0 8091 69785
d41d0cd 61694 0 8091 69785
+/- +0 +0 +0 +0
libopenthread-ncp-ftd.a d0237f5 33581 0 5948 39529
d41d0cd 33581 0 5948 39529
+/- +0 +0 +0 +0
libopenthread-mtd.a d0237f5 168353 0 24775 193128
d41d0cd 168353 0 24775 193128
+/- +0 +0 +0 +0
libopenthread-cli-mtd.a d0237f5 41403 0 8059 49462
d41d0cd 41403 0 8059 49462
+/- +0 +0 +0 +0
libopenthread-ncp-mtd.a d0237f5 25805 0 5948 31753
d41d0cd 25805 0 5948 31753
+/- +0 +0 +0 +0
libopenthread-ftd-br.a d0237f5 366515 100 110327 476942
d41d0cd 366515 100 110327 476942
+/- +0 +0 +0 +0
libopenthread-cli-ftd-br.a d0237f5 80741 0 8131 88872
d41d0cd 80741 0 8131 88872
+/- +0 +0 +0 +0
libopenthread-rcp.a d0237f5 9944 0 5060 15004
d41d0cd 9944 0 5060 15004
+/- +0 +0 +0 +0
libopenthread-radio.a d0237f5 19707 0 238 19945
d41d0cd 19707 0 238 19945
+/- +0 +0 +0 +0

@codecov

codecov Bot commented Feb 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.15%. Comparing base (d0237f5) to head (86450d9).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12588      +/-   ##
==========================================
+ Coverage   74.24%   75.15%   +0.91%     
==========================================
  Files         697      699       +2     
  Lines       94816    94602     -214     
==========================================
+ Hits        70395    71099     +704     
+ Misses      24421    23503     -918     

see 177 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@abtink
abtink marked this pull request as ready for review February 28, 2026 04:28
@jwhui
jwhui merged commit 9d3852d into openthread:main Mar 3, 2026
105 checks passed
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.

2 participants