Skip to content

Tests for ValidateNotNull, ValidateNotNullOrEmpty are timing sensitive and unreliable. #5627

Closed

Description

Tests in the ValidateAttributeTests.ps1 attempt to estimate the time it takes for these attributes to be applied and tests the various attributes to ensure they complete within the estimated time.

In CI, these tests can take 2-3 times longer than the estimate causing test failures.

See Context "ValidateNotNull, ValidateNotNullOrEmpty and Not-Null-Or-Empty check for Mandatory parameter" in the referenced file.

The following logic is used to calculate a baseline measurement:

Use the running time of 'MandatoryFunc -Value $byteArray' as the baseline time

$baseline = (Measure-Command { MandatoryFunc -Value $byteArray }).Milliseconds

Running time should be less than 'expected'

$expected = $baseline + 20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    WG-Quality-Testissues in a test or in test infrastructure

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions