diff --git a/.vscode/settings.json b/.vscode/settings.json index c8deeda3c..d1e9663be 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -69,7 +69,8 @@ "DynamicAlloc", "GetxPDTVariable", "Dbcc", - "creplace" + "creplace", + "dbatools" ], "cSpell.ignorePaths": [ ".git" diff --git a/CHANGELOG.md b/CHANGELOG.md index 667eab791..defaf88d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- SqlServerDsc + - Re-enable integration tests for dbatools. + - Bumped dbatools to v2.0.1 for the integration tests. + ## [16.3.1] - 2023-05-06 ### Changed diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 71d7bf092..ade6ce3e9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -239,95 +239,95 @@ stages: testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml' testRunTitle: 'Integration ($(TEST_CONFIGURATION) / $(JOB_VMIMAGE))' - # - job: Test_Integration_dbatools - # displayName: 'Integration (dbatools)' - # dependsOn: Test_Integration - # strategy: - # matrix: - # SQL2016_WIN2022: - # JOB_VMIMAGE: 'windows-2022' - # TEST_CONFIGURATION: 'Integration_SQL2016' - # SQL2017_WIN2022: - # JOB_VMIMAGE: 'windows-2022' - # TEST_CONFIGURATION: 'Integration_SQL2017' - # SQL2019_WIN2022: - # JOB_VMIMAGE: 'windows-2022' - # TEST_CONFIGURATION: 'Integration_SQL2019' - # SQL2022_WIN2022: - # JOB_VMIMAGE: 'windows-2022' - # TEST_CONFIGURATION: 'Integration_SQL2022' - # pool: - # vmImage: $(JOB_VMIMAGE) - # timeoutInMinutes: 0 - # variables: - # SMODefaultModuleName: 'dbatools' - # steps: - # - task: DownloadPipelineArtifact@2 - # displayName: 'Download Build Artifact' - # inputs: - # buildType: 'current' - # artifactName: $(buildArtifactName) - # targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)' - # - task: PowerShell@2 - # name: configureWinRM - # displayName: 'Configure WinRM' - # inputs: - # targetType: 'inline' - # script: 'winrm quickconfig -quiet' - # pwsh: false - # - powershell: | - # Import-Module -Name ./tests/TestHelpers/CommonTestHelper.psm1 - # # Make sure to keep SQLPS so that Invoke-SqlCmd is available. - # Remove-PowerShellModuleFromCI -Name @('SqlServer') - # Remove-Module -Name CommonTestHelper - # name: cleanCIWorker - # displayName: 'Clean CI worker' - # - powershell: | - # ./build.ps1 -Tasks test -CodeCoverageThreshold 0 -PesterTag $(TEST_CONFIGURATION) -PesterPath @( - # # Run the integration tests in a specific group order. - # # Group 1 - # 'tests/Integration/DSC_SqlSetup.Integration.Tests.ps1' - # # Group 2 - # 'tests/Integration/DSC_SqlAgentAlert.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlLogin.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlEndpoint.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlDatabaseMail.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlRSSetup.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlDatabaseDefaultLocation.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlDatabase.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlAlwaysOnService.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlAgentOperator.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlServiceAccount.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlAgentFailsafe.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlTraceFlag.Integration.Tests.ps1' - # # Group 3 - # 'tests/Integration/DSC_SqlRole.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlRS_Default.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlDatabaseUser.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlReplication.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlAudit.Integration.Tests.ps1' - # # Group 4 - # 'tests/Integration/DSC_SqlScript.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlDatabasePermission.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlPermission.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlWindowsFirewall.Integration.Tests.ps1' - # # Group 5 - # 'tests/Integration/DSC_SqlSecureConnection.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlScriptQuery.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlProtocol.Integration.Tests.ps1' - # # Group 6 (tests makes changes that could make SQL Server to loose connectivity) - # 'tests/Integration/DSC_SqlProtocolTcpIp.Integration.Tests.ps1' - # 'tests/Integration/DSC_SqlDatabaseObjectPermission.Integration.Tests.ps1' - # ) - # name: test - # displayName: 'Run Integration Test' - # - task: PublishTestResults@2 - # displayName: 'Publish Test Results' - # condition: succeededOrFailed() - # inputs: - # testResultsFormat: 'NUnit' - # testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml' - # testRunTitle: 'Integration (dbatools) ($(TEST_CONFIGURATION) / $(JOB_VMIMAGE))' + - job: Test_Integration_dbatools + displayName: 'Integration (dbatools)' + dependsOn: Test_Integration + strategy: + matrix: + SQL2016_WIN2022: + JOB_VMIMAGE: 'windows-2022' + TEST_CONFIGURATION: 'Integration_SQL2016' + SQL2017_WIN2022: + JOB_VMIMAGE: 'windows-2022' + TEST_CONFIGURATION: 'Integration_SQL2017' + SQL2019_WIN2022: + JOB_VMIMAGE: 'windows-2022' + TEST_CONFIGURATION: 'Integration_SQL2019' + SQL2022_WIN2022: + JOB_VMIMAGE: 'windows-2022' + TEST_CONFIGURATION: 'Integration_SQL2022' + pool: + vmImage: $(JOB_VMIMAGE) + timeoutInMinutes: 0 + variables: + SMODefaultModuleName: 'dbatools' + steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download Build Artifact' + inputs: + buildType: 'current' + artifactName: $(buildArtifactName) + targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)' + - task: PowerShell@2 + name: configureWinRM + displayName: 'Configure WinRM' + inputs: + targetType: 'inline' + script: 'winrm quickconfig -quiet' + pwsh: false + - powershell: | + Import-Module -Name ./tests/TestHelpers/CommonTestHelper.psm1 + # Make sure to keep SQLPS so that Invoke-SqlCmd is available. + Remove-PowerShellModuleFromCI -Name @('SqlServer') + Remove-Module -Name CommonTestHelper + name: cleanCIWorker + displayName: 'Clean CI worker' + - powershell: | + ./build.ps1 -Tasks test -CodeCoverageThreshold 0 -PesterTag $(TEST_CONFIGURATION) -PesterPath @( + # Run the integration tests in a specific group order. + # Group 1 + 'tests/Integration/DSC_SqlSetup.Integration.Tests.ps1' + # Group 2 + 'tests/Integration/DSC_SqlAgentAlert.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlLogin.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlEndpoint.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlDatabaseMail.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlRSSetup.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlDatabaseDefaultLocation.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlDatabase.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlAlwaysOnService.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlAgentOperator.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlServiceAccount.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlAgentFailsafe.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlTraceFlag.Integration.Tests.ps1' + # Group 3 + 'tests/Integration/DSC_SqlRole.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlRS_Default.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlDatabaseUser.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlReplication.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlAudit.Integration.Tests.ps1' + # Group 4 + 'tests/Integration/DSC_SqlScript.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlDatabasePermission.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlPermission.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlWindowsFirewall.Integration.Tests.ps1' + # Group 5 + 'tests/Integration/DSC_SqlSecureConnection.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlScriptQuery.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlProtocol.Integration.Tests.ps1' + # Group 6 (tests makes changes that could make SQL Server to loose connectivity) + 'tests/Integration/DSC_SqlProtocolTcpIp.Integration.Tests.ps1' + 'tests/Integration/DSC_SqlDatabaseObjectPermission.Integration.Tests.ps1' + ) + name: test + displayName: 'Run Integration Test' + - task: PublishTestResults@2 + displayName: 'Publish Test Results' + condition: succeededOrFailed() + inputs: + testResultsFormat: 'NUnit' + testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml' + testRunTitle: 'Integration (dbatools) ($(TEST_CONFIGURATION) / $(JOB_VMIMAGE))' - job: Test_Integration_RS displayName: 'Integration Reporting Services' @@ -405,64 +405,64 @@ stages: testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml' testRunTitle: 'Integration RS ($(TEST_CONFIGURATION) / $(JOB_VMIMAGE))' - # - job: Test_Integration_RS_dbatools - # displayName: 'Integration Reporting Services (dbatools)' - # dependsOn: Test_Integration_RS - # strategy: - # matrix: - # SQL2016_WIN2022: - # JOB_VMIMAGE: 'windows-2022' - # TEST_CONFIGURATION: 'Integration_SQL2016' - # SQL2017_WIN2022: - # JOB_VMIMAGE: 'windows-2022' - # TEST_CONFIGURATION: 'Integration_SQL2017' - # SQL2019_WIN2022: - # JOB_VMIMAGE: 'windows-2022' - # TEST_CONFIGURATION: 'Integration_SQL2019' - # SQL2022_WIN2022: - # JOB_VMIMAGE: 'windows-2022' - # TEST_CONFIGURATION: 'Integration_SQL2022' - # variables: - # SKIP_DATABASE_ENGINE_DEFAULT_INSTANCE: true - # SKIP_ANALYSIS_MULTI_INSTANCE: true - # SKIP_ANALYSIS_TABULAR_INSTANCE: true - # SMODefaultModuleName: 'dbatools' - # pool: - # vmImage: $(JOB_VMIMAGE) - # timeoutInMinutes: 0 - # steps: - # - task: DownloadPipelineArtifact@2 - # displayName: 'Download Build Artifact' - # inputs: - # buildType: 'current' - # artifactName: $(buildArtifactName) - # targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)' - # - task: PowerShell@2 - # name: configureWinRM - # displayName: 'Configure WinRM' - # inputs: - # targetType: 'inline' - # script: 'winrm quickconfig -quiet' - # pwsh: false - # - powershell: | - # ./build.ps1 -Tasks test -CodeCoverageThreshold 0 -PesterTag $(TEST_CONFIGURATION) -PesterPath @( - # # Run the integration tests in a specific group order. - # # Group 1 - # 'tests/Integration/DSC_SqlSetup.Integration.Tests.ps1' - # # Group 2 - # 'tests/Integration/DSC_SqlRSSetup.Integration.Tests.ps1' - # # Group 3 - # 'tests/Integration/DSC_SqlRS.Integration.Tests.ps1' - # ) - # name: test - # displayName: 'Run Reporting Services Integration Test' - # - task: PublishTestResults@2 - # displayName: 'Publish Test Results' - # condition: succeededOrFailed() - # inputs: - # testResultsFormat: 'NUnit' - # testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml' - # testRunTitle: 'Integration RS (dbatools) ($(TEST_CONFIGURATION) / $(JOB_VMIMAGE))' + - job: Test_Integration_RS_dbatools + displayName: 'Integration Reporting Services (dbatools)' + dependsOn: Test_Integration_RS + strategy: + matrix: + SQL2016_WIN2022: + JOB_VMIMAGE: 'windows-2022' + TEST_CONFIGURATION: 'Integration_SQL2016' + SQL2017_WIN2022: + JOB_VMIMAGE: 'windows-2022' + TEST_CONFIGURATION: 'Integration_SQL2017' + SQL2019_WIN2022: + JOB_VMIMAGE: 'windows-2022' + TEST_CONFIGURATION: 'Integration_SQL2019' + SQL2022_WIN2022: + JOB_VMIMAGE: 'windows-2022' + TEST_CONFIGURATION: 'Integration_SQL2022' + variables: + SKIP_DATABASE_ENGINE_DEFAULT_INSTANCE: true + SKIP_ANALYSIS_MULTI_INSTANCE: true + SKIP_ANALYSIS_TABULAR_INSTANCE: true + SMODefaultModuleName: 'dbatools' + pool: + vmImage: $(JOB_VMIMAGE) + timeoutInMinutes: 0 + steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download Build Artifact' + inputs: + buildType: 'current' + artifactName: $(buildArtifactName) + targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)' + - task: PowerShell@2 + name: configureWinRM + displayName: 'Configure WinRM' + inputs: + targetType: 'inline' + script: 'winrm quickconfig -quiet' + pwsh: false + - powershell: | + ./build.ps1 -Tasks test -CodeCoverageThreshold 0 -PesterTag $(TEST_CONFIGURATION) -PesterPath @( + # Run the integration tests in a specific group order. + # Group 1 + 'tests/Integration/DSC_SqlSetup.Integration.Tests.ps1' + # Group 2 + 'tests/Integration/DSC_SqlRSSetup.Integration.Tests.ps1' + # Group 3 + 'tests/Integration/DSC_SqlRS.Integration.Tests.ps1' + ) + name: test + displayName: 'Run Reporting Services Integration Test' + - task: PublishTestResults@2 + displayName: 'Publish Test Results' + condition: succeededOrFailed() + inputs: + testResultsFormat: 'NUnit' + testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml' + testRunTitle: 'Integration RS (dbatools) ($(TEST_CONFIGURATION) / $(JOB_VMIMAGE))' - job: Code_Coverage displayName: 'Publish Code Coverage' diff --git a/tests/Integration/DSC_SqlSetup.config.ps1 b/tests/Integration/DSC_SqlSetup.config.ps1 index 05d35b55b..c746210c0 100644 --- a/tests/Integration/DSC_SqlSetup.config.ps1 +++ b/tests/Integration/DSC_SqlSetup.config.ps1 @@ -37,7 +37,7 @@ else SupportedFeatures = 'SQLENGINE,REPLICATION' SqlServerModuleVersion = '22.0.59' - DbatoolsModuleVersion = '2.0.0-preview7' + DbatoolsModuleVersion = '2.0.1' } } @@ -55,7 +55,7 @@ else SupportedFeatures = 'SQLENGINE,REPLICATION,CONN,BC,SDK' SqlServerModuleVersion = '21.1.18256' - DbatoolsModuleVersion = '2.0.0-preview7' + DbatoolsModuleVersion = '2.0.1' } } @@ -69,7 +69,7 @@ else SupportedFeatures = 'SQLENGINE,REPLICATION,CONN,BC,SDK' SqlServerModuleVersion = '21.1.18256' - DbatoolsModuleVersion = '2.0.0-preview7' + DbatoolsModuleVersion = '2.0.1' } } @@ -83,7 +83,7 @@ else SupportedFeatures = 'SQLENGINE,REPLICATION,CONN,BC,SDK' SqlServerModuleVersion = '21.1.18256' - DbatoolsModuleVersion = '2.0.0-preview7' + DbatoolsModuleVersion = '2.0.1' } } }