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

SqlServerDsc: Change in integration tests to speed up tests #1001

Closed
johlju opened this issue Jan 7, 2018 · 0 comments · Fixed by #1006
Closed

SqlServerDsc: Change in integration tests to speed up tests #1001

johlju opened this issue Jan 7, 2018 · 0 comments · Fixed by #1006
Labels
enhancement The issue is an enhancement request.

Comments

@johlju
Copy link
Member

johlju commented Jan 7, 2018

Details of the scenario you tried and the problem that is occurring:
Integration tests uses the following two It-blocks.

It 'Should be able to call Get-DscConfiguration without throwing' {
    { Get-DscConfiguration -Verbose -ErrorAction Stop } | Should -Not -Throw
}

It 'Should have set the resource and all the parameters should match' {
    $currentConfiguration = Get-DscConfiguration

    $resourceCurrentState = $currentConfiguration | Where-Object -FilterScript {
        $_.ConfigurationName -eq $configurationName
    } | Where-Object -FilterScript {
        $_.ResourceId -eq $resourceId
    }`

    ...
}

The integration tests for resource SqlSetup runs Get-DscConfiguration a few times which impacts the time it take to pass the test run. We are getting close to the (AppVeyor) time limit of 60 minutes, currently around ~50 minutes.

I suggest that we change the integration tests to the following instead (if possible), saving one call to Get-DscConfiguration for each test.

It 'Should be able to call Get-DscConfiguration without throwing' {
    {
        $script:currentConfiguration = Get-DscConfiguration -Verbose -ErrorAction Stop
    } | Should -Not -Throw
}

It 'Should have set the resource and all the parameters should match' {
    $resourceCurrentState = $script:currentConfiguration | Where-Object -FilterScript {
        $_.ConfigurationName -eq $configurationName
    } | Where-Object -FilterScript {
        $_.ResourceId -eq $resourceId
    }`

    ...
}

The DSC configuration that is using the resource (as detailed as possible):
n/a

Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
n/a

What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
n/a

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Dev

@johlju johlju added enhancement The issue is an enhancement request. in progress The issue is being actively worked on by someone. labels Jan 7, 2018
johlju added a commit to johlju/SqlServerDsc that referenced this issue Jan 7, 2018
- Refactor integration tests slightly to improve run time performance (issue dsccommunity#1001).
johlju added a commit to johlju/SqlServerDsc that referenced this issue Jan 7, 2018
johlju added a commit to johlju/SqlServerDsc that referenced this issue Jan 7, 2018
- Refactor integration tests slightly to improve run time performance (issue dsccommunity#1001).
johlju added a commit to johlju/SqlServerDsc that referenced this issue Jan 7, 2018
- Refactor integration tests slightly to improve run time performance (issue dsccommunity#1001).
johlju added a commit to johlju/SqlServerDsc that referenced this issue Jan 7, 2018
johlju added a commit to johlju/SqlServerDsc that referenced this issue Jan 7, 2018
johlju added a commit to johlju/SqlServerDsc that referenced this issue Jan 7, 2018
johlju added a commit that referenced this issue Jan 8, 2018
- Changes to SqlAlwaysOnService
  - Refactor integration tests slightly to improve run time performance (issue #1001).
- Changes to SqlDatabaseDefaultLocation
  - Refactor integration tests slightly to improve run time performance (issue #1001).
- Changes to SqlRS
  - Refactor integration tests slightly to improve run time performance (issue #1001).
- Changes to SqlSetup
  - Refactor integration tests slightly to improve run time performance (issue #1001).
- Changes to SqlServiceAccount
  - Refactor integration tests slightly to improve run time performance (issue #1001).
- Changes to SqlServerLogin
  - Refactor integration tests slightly to improve run time performance (issue #1001).
- Changes to SqlServerDatabaseMail
  - Refactor integration tests slightly to improve run time performance (issue #1001).
@johlju johlju removed the in progress The issue is being actively worked on by someone. label Jan 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant