Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqlAGDatabase: Unit tests fails intermittent #1532

Closed
johlju opened this issue May 7, 2020 · 1 comment · Fixed by #1533 or #1534
Closed

SqlAGDatabase: Unit tests fails intermittent #1532

johlju opened this issue May 7, 2020 · 1 comment · Fixed by #1533 or #1534
Labels
blocking release The issue or pull request is blocking the next release. Higher priority than label 'High priority'. tests The issue or pull request is about tests only.

Comments

@johlju
Copy link
Member

johlju commented May 7, 2020

This test failed on a recent build. Tracking if this happens again.

  Describing SqlAGDatabase\Set-TargetResource

    Context When Ensure is Present
      .... # Some tests remove for readability

      [+] Should throw the correct error when it fails to add the database to the primary replica 19.9s
      [+] Should throw the correct error when it fails to add the database to the primary replica 25.73s

    Context When Ensure is Absent
      [+] Should remove the specified databases to the availability group(s) 8.83s
      [+] Should remove the specified databases to the availability group(s) when the primary replica is on another server 8.46s
      [-] Should throw the correct error when it fails to remove the database from the availability group 2.72s
        Expected an exception, with message 'The operation on the database 'DB2' failed with the following errors: Failed to remove the database from the availability group.' to be thrown, but the message was 'The operation on the database '3rdTypeOfDatabase' failed with the following errors: Failed to remove the database from the availability group..'. from D:\a\1\s\output\SqlServerDsc\14.0.0\DSCResources\DSC_SqlAGDatabase\DSC_SqlAGDatabase.psm1:604 char:9
            +         throw ($script:localizedData.AlterAvailabilityGroupDatabaseMe …
            +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        1092:                     { Set-TargetResource @mockSetTargetResourceParameters } | Should -Throw 'The operation on the database ''DB2'' failed with the following errors: Failed to remove the database from the availability group.'
        at <ScriptBlock>, D:\a\1\s\tests\Unit\DSC_SqlAGDatabase.Tests.ps1: line 1092

@johlju johlju added help wanted The issue is up for grabs for anyone in the community. tests The issue or pull request is about tests only. blocking release The issue or pull request is blocking the next release. Higher priority than label 'High priority'. in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels May 7, 2020
@johlju johlju changed the title SQLAGDatabase: Unit tests failes intermittent SqlAGDatabase: Unit tests failes intermittent May 7, 2020
@johlju johlju changed the title SqlAGDatabase: Unit tests failes intermittent SqlAGDatabase: Unit tests fails intermittent May 7, 2020
@johlju johlju removed the in progress The issue is being actively worked on by someone. label May 7, 2020
@johlju johlju reopened this May 7, 2020
@johlju
Copy link
Member Author

johlju commented May 7, 2020

I think the unit tests need to be refactored. They are to complicated to read as they are now, and that might be the reason that it fails intermittently in PowerShell 7.

@johlju johlju added help wanted The issue is up for grabs for anyone in the community. in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels May 7, 2020
johlju added a commit that referenced this issue May 8, 2020
- SqlAGDatabase
  - Fixed unit tests that failed intermittently when running unit tests
    in PowerShell 7 (issue #1532).
  - Minor code style issue changes.
@johlju johlju removed the in progress The issue is being actively worked on by someone. label Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocking release The issue or pull request is blocking the next release. Higher priority than label 'High priority'. tests The issue or pull request is about tests only.
Projects
None yet
1 participant