Skip to content

Conversation

@akrem-chabchoub
Copy link
Contributor

@akrem-chabchoub akrem-chabchoub commented Oct 15, 2025

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

The main issue was in the agent test where inconsistent timing would sometimes cause the test to fail.
This has been addressed by using synctest to wrap code that will create a bubble to help preventing timing issues.

Testing

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

#5232

Screenshots (if appropriate):

@akrem-chabchoub akrem-chabchoub marked this pull request as ready for review October 15, 2025 20:13
Copilot AI review requested due to automatic review settings October 15, 2025 20:13
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 addresses timing issues in the storage incentives agent test by integrating Go's testing/synctest package to create deterministic test execution. The main change wraps the test logic in synctest.Test() to prevent flaky test failures caused by inconsistent timing.

  • Adds synctest integration to create deterministic test timing
  • Includes additional validation to ensure expected contract calls occur
  • Removes unnecessary empty line for code cleanup

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 137 to 139
if len(contract.callsList) == 0 {
t.Fatal("expected calls but got none")
}
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

This validation contradicts the test logic above. When tc.expectedCalls is false (lines 129-135), the test expects no calls and fails if any are found. Adding this check means tests with expectedCalls: false will always fail since they expect zero calls but this code requires at least one call.

Copilot uses AI. Check for mistakes.
@akrem-chabchoub akrem-chabchoub force-pushed the tests/storage-incentives branch from 5b02541 to f3e6c8d Compare October 15, 2025 20:33
@gacevicljubisa gacevicljubisa requested a review from janos October 21, 2025 11:45
@akrem-chabchoub akrem-chabchoub added this to the v2.7.0 milestone Oct 22, 2025
@bcsorvasi bcsorvasi linked an issue Oct 22, 2025 that may be closed by this pull request
@akrem-chabchoub akrem-chabchoub merged commit 9c7116d into master Nov 3, 2025
21 of 22 checks passed
@akrem-chabchoub akrem-chabchoub deleted the tests/storage-incentives branch November 3, 2025 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use the new testing/synctest package from golang 1.25 in tests

5 participants