Skip to content

Fix flaky ProduceDifferentLengths test#162

Merged
kudima03 merged 2 commits into
kudima03:mainfrom
StanislavKozachenko:fix/flaky-string-collection-test
May 25, 2026
Merged

Fix flaky ProduceDifferentLengths test#162
kudima03 merged 2 commits into
kudima03:mainfrom
StanislavKozachenko:fix/flaky-string-collection-test

Conversation

@StanislavKozachenko
Copy link
Copy Markdown
Contributor

Closes #161

];

Assert.Equal(lengths.Count, lengths.Distinct().Count());
Assert.True(lengths.Distinct().Count() > 1);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Previous test ensures: All element lengths are different

        Assert.Equal(lengths.Count, lengths.Distinct().Count());

Current test ensures: At least 1 element length is different from the others

        Assert.True(lengths.Distinct().Count() > 1);

It means test case degradation

Probably you should use such way (pseudocode):

Suggested change
Assert.True(lengths.Distinct().Count() > 1);
Assert.InRange(lengths.Distinct().Count(), 49, 50);

@kudima03 kudima03 self-assigned this May 25, 2026
@StanislavKozachenko StanislavKozachenko force-pushed the fix/flaky-string-collection-test branch from cb7f4cd to df6e180 Compare May 25, 2026 11:56
@kudima03
Copy link
Copy Markdown
Owner

@StanislavKozachenko Thanks for contribution!

@kudima03 kudima03 merged commit 5f6827f into kudima03:main May 25, 2026
1 check failed
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.

ProduceDifferentLengths test is flaky

2 participants