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

SqlAG: unit tests converted to Pester 5 #1987

Merged
merged 9 commits into from
Dec 15, 2023
Merged

Conversation

Sidoran
Copy link
Contributor

@Sidoran Sidoran commented Dec 14, 2023

Pull Request (PR) description

Convert SqlAG unit tests to Pester 5 plus add missed parameters to a SQLAG Test and Get functions.
Fix unit test for the SQLAGReplica

This Pull Request (PR) fixes the following issues

Task list

  • Added an entry to the change log under the Unreleased section of the
    file CHANGELOG.md. Entry should say what was changed and how that
    affects users (if applicable), and reference the issue being resolved
    (if applicable).
  • Resource documentation updated in the resource's README.md.
  • Resource parameter descriptions updated in schema.mof.
  • Comment-based help updated, including parameter descriptions.
  • Localization strings updated.
  • Examples updated.
  • Unit tests updated. See DSC Community Testing Guidelines.
  • Integration tests updated (where possible). See DSC Community Testing Guidelines.
  • Code changes adheres to DSC Community Style Guidelines.

This change is Reviewable

@Sidoran Sidoran requested review from johlju and a team as code owners December 14, 2023 16:24
Copy link

codecov bot commented Dec 14, 2023

Codecov Report

Merging #1987 (2331b9d) into main (e9639fd) will increase coverage by 2%.
Report is 1 commits behind head on main.
The diff coverage is 100%.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##           main   #1987    +/-   ##
=====================================
+ Coverage    92%     94%    +2%     
=====================================
  Files        93      93            
  Lines      7840    7844     +4     
=====================================
+ Hits       7214    7424   +210     
+ Misses      626     420   -206     
Flag Coverage Δ
unit 94% <100%> (+2%) ⬆️
Files Coverage Δ
source/DSCResources/DSC_SqlAG/DSC_SqlAG.psm1 96% <100%> (+96%) ⬆️

@johlju johlju added the needs review The pull request needs a code review. label Dec 14, 2023
Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

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

Looking good, than you for this! Just a tiny comment.

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Sidoran)


source/DSCResources/DSC_SqlAG/DSC_SqlAG.psm1 line 755 at r1 (raw file):

            <#
                Add properties compatible with SQL Server 2016 or later versions
                DtcSupportEnabled is enabled at the creation of the Availability Group only, hence it will not be checked in this block

We should remove this comment from the code as well.

Code quote:

DtcSupportEnabled is enabled at the creation of the Availability Group only, hence it will not be checked in this block

@johlju johlju added waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. and removed needs review The pull request needs a code review. labels Dec 14, 2023
@Sidoran
Copy link
Contributor Author

Sidoran commented Dec 14, 2023

@johlju, Looks like starting from the SQL 2016 SP2, we can change the DtcSupportEnabled option for the existing Availability group proof
I removed the comment as you suggested.
I also have a question. During this task, I tried to find a way to work with the code coverage in VSCode and see which lines are covered by tests and which are not. Unfortunately, I have not found a working solution. Can you please suggest a way or guide me to a manual on how to display code coverage in VSCode for the SQLServerDSC?

@johlju
Copy link
Member

johlju commented Dec 15, 2023

I haven't tested using code coverage in VS Code. I always run the code coverage in command line using Invoke-Pester. But there is this if you want to try using it in VS Code: https://gist.github.com/nohwnd/efc339339dc328d93e0fe000249aea25

@johlju johlju added needs review The pull request needs a code review. and removed waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. labels Dec 15, 2023
Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Sidoran)

@johlju johlju merged commit a9f8f26 into dsccommunity:main Dec 15, 2023
36 checks passed
@johlju johlju removed the needs review The pull request needs a code review. label Dec 15, 2023
@Sidoran Sidoran deleted the SQLAG_test branch December 25, 2023 17:54
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.

SqlAG: Refactor unit tests to support Pester 5 SqlAg: DtcSupportEnabled should be updatable
2 participants