Fix flaky tests for azsdk-cli by removing non-deterministic behavior#47
Closed
Fix flaky tests for azsdk-cli by removing non-deterministic behavior#47
Conversation
…xpected output Co-authored-by: benbp <1020379+benbp@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix flaky tests for azsdk cli
Fix flaky tests for azsdk-cli by removing non-deterministic behavior
Jul 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes two flaky tests in the azsdk-cli test suite that were causing inconsistent failures in the CI pipeline:
Issues Fixed
1. TestSimpleFailCase - Random Exit Code Generation
The test was using
new Random().Next(2)to generate a random expected exit code (0 or 1), but the actual implementation always returns exit code 1. This created a race condition where the test would:Before:
After:
2. TestWindows - Incorrect Expected Output
The test expected "Result: nul" but the actual output was "Result: null", causing consistent failures on Windows platforms.
Before:
After:
Testing
The fixes eliminate non-deterministic behavior while preserving the core functionality being tested.
Fixes #46.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.