From c9de1bfd4266eb19a1fa8de8b25a49bcaaac3ead Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Wed, 8 May 2024 20:45:43 +0200 Subject: [PATCH] SqlServerDsc: Split test pipeline into different stages (#2027) - SqlServerDsc - The pipeline test stages has been split into different stages. --- CHANGELOG.md | 1 + appveyor.yml | 54 ++-- azure-pipelines.yml | 270 +++++++++++------- ...Install-SqlDscServer.Integration.Tests.ps1 | 48 ++++ tests/Integration/Commands/README.md | 93 ++++++ .../DSC_SqlAgentAlert.Integration.Tests.ps1 | 0 .../DSC_SqlAgentAlert.config.ps1 | 0 ...DSC_SqlAgentFailsafe.Integration.Tests.ps1 | 0 .../DSC_SqlAgentFailsafe.config.ps1 | 0 ...DSC_SqlAgentOperator.Integration.Tests.ps1 | 0 .../DSC_SqlAgentOperator.config.ps1 | 0 ...C_SqlAlwaysOnService.Integration.Tests.ps1 | 2 +- .../DSC_SqlAlwaysOnService.config.ps1 | 0 .../DSC_SqlAudit.Integration.Tests.ps1 | 0 .../{ => Resources}/DSC_SqlAudit.config.ps1 | 0 .../DSC_SqlDatabase.Integration.Tests.ps1 | 0 .../DSC_SqlDatabase.config.ps1 | 0 ...abaseDefaultLocation.Integration.Tests.ps1 | 0 .../DSC_SqlDatabaseDefaultLocation.config.ps1 | 0 .../DSC_SqlDatabaseMail.Integration.Tests.ps1 | 0 .../DSC_SqlDatabaseMail.config.ps1 | 0 ...baseObjectPermission.Integration.Tests.ps1 | 0 ...DSC_SqlDatabaseObjectPermission.config.ps1 | 0 ...qlDatabasePermission.Integration.Tests.ps1 | 0 .../DSC_SqlDatabasePermission.config.ps1 | 0 .../DSC_SqlDatabaseUser.Integration.Tests.ps1 | 0 .../DSC_SqlDatabaseUser.config.ps1 | 0 .../DSC_SqlEndpoint.Integration.Tests.ps1 | 0 .../DSC_SqlEndpoint.config.ps1 | 0 .../DSC_SqlLogin.Integration.Tests.ps1 | 0 .../{ => Resources}/DSC_SqlLogin.config.ps1 | 0 .../DSC_SqlPermission.Integration.Tests.ps1 | 0 .../DSC_SqlPermission.config.ps1 | 0 .../DSC_SqlProtocol.Integration.Tests.ps1 | 0 .../DSC_SqlProtocol.config.ps1 | 0 ...DSC_SqlProtocolTcpIp.Integration.Tests.ps1 | 0 .../DSC_SqlProtocolTcpIp.config.ps1 | 0 .../DSC_SqlRS.Integration.Tests.ps1 | 2 +- .../{ => Resources}/DSC_SqlRS.config.ps1 | 0 .../DSC_SqlRSSetup.Integration.Tests.ps1 | 2 +- .../{ => Resources}/DSC_SqlRSSetup.config.ps1 | 0 .../DSC_SqlRS_Default.Integration.Tests.ps1 | 2 +- .../DSC_SqlRS_Default.config.ps1 | 0 .../DSC_SqlReplication.Integration.Tests.ps1 | 0 .../DSC_SqlReplication.config.ps1 | 0 .../DSC_SqlRole.Integration.Tests.ps1 | 0 .../{ => Resources}/DSC_SqlRole.config.ps1 | 0 .../DSC_SqlScript.Integration.Tests.ps1 | 0 .../{ => Resources}/DSC_SqlScript.config.ps1 | 0 .../DSC_SqlScriptQuery.Integration.Tests.ps1 | 0 .../DSC_SqlScriptQuery.config.ps1 | 0 ..._SqlSecureConnection.Integration.Tests.ps1 | 2 +- .../DSC_SqlSecureConnection.config.ps1 | 0 ...SC_SqlServiceAccount.Integration.Tests.ps1 | 0 .../DSC_SqlServiceAccount.config.ps1 | 0 .../DSC_SqlSetup.Integration.Tests.ps1 | 2 +- .../{ => Resources}/DSC_SqlSetup.config.ps1 | 0 .../DSC_SqlTraceFlag.Integration.Tests.ps1 | 0 .../DSC_SqlTraceFlag.config.ps1 | 0 ...C_SqlWindowsFirewall.Integration.Tests.ps1 | 0 .../DSC_SqlWindowsFirewall.config.ps1 | 0 tests/Integration/{ => Resources}/README.md | 0 62 files changed, 347 insertions(+), 131 deletions(-) create mode 100644 tests/Integration/Commands/Install-SqlDscServer.Integration.Tests.ps1 create mode 100644 tests/Integration/Commands/README.md rename tests/Integration/{ => Resources}/DSC_SqlAgentAlert.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlAgentAlert.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlAgentFailsafe.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlAgentFailsafe.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlAgentOperator.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlAgentOperator.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlAlwaysOnService.Integration.Tests.ps1 (99%) rename tests/Integration/{ => Resources}/DSC_SqlAlwaysOnService.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlAudit.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlAudit.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlDatabase.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlDatabase.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlDatabaseDefaultLocation.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlDatabaseDefaultLocation.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlDatabaseMail.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlDatabaseMail.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlDatabaseObjectPermission.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlDatabaseObjectPermission.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlDatabasePermission.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlDatabasePermission.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlDatabaseUser.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlDatabaseUser.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlEndpoint.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlEndpoint.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlLogin.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlLogin.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlPermission.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlPermission.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlProtocol.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlProtocol.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlProtocolTcpIp.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlProtocolTcpIp.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlRS.Integration.Tests.ps1 (99%) rename tests/Integration/{ => Resources}/DSC_SqlRS.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlRSSetup.Integration.Tests.ps1 (99%) rename tests/Integration/{ => Resources}/DSC_SqlRSSetup.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlRS_Default.Integration.Tests.ps1 (99%) rename tests/Integration/{ => Resources}/DSC_SqlRS_Default.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlReplication.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlReplication.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlRole.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlRole.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlScript.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlScript.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlScriptQuery.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlScriptQuery.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlSecureConnection.Integration.Tests.ps1 (99%) rename tests/Integration/{ => Resources}/DSC_SqlSecureConnection.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlServiceAccount.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlServiceAccount.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlSetup.Integration.Tests.ps1 (99%) rename tests/Integration/{ => Resources}/DSC_SqlSetup.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlTraceFlag.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlTraceFlag.config.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlWindowsFirewall.Integration.Tests.ps1 (100%) rename tests/Integration/{ => Resources}/DSC_SqlWindowsFirewall.config.ps1 (100%) rename tests/Integration/{ => Resources}/README.md (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index df12b800a..9d2f04a99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 To run the meta task `docs` the SMO assemblies must be loaded into the session, either by importing SqlServer module or loading SMO stubs. - QA test improved to speed up quality testing. + - The pipeline test stages has been split into different stages. - SqlAG - Converted unit test to Pester 5 - DtcSupportEnabled option in Set-TargetResource and TestTargetResource diff --git a/appveyor.yml b/appveyor.yml index ffa55bc2a..0c7aff356 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -77,38 +77,38 @@ test_script: ./build.ps1 -Tasks test -CodeCoverageThreshold 0 -PesterTag $env:TEST_CONFIGURATION -PesterPath @( ### Run the integration tests in a specific group order. ## Group 1 - 'tests/Integration/DSC_SqlSetup.Integration.Tests.ps1' + 'tests/Integration/Resources/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' + #'tests/Integration/Resources/DSC_SqlAgentAlert.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlLogin.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlEndpoint.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlDatabaseMail.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlRSSetup.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlDatabaseDefaultLocation.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlDatabase.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlAlwaysOnService.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlAgentOperator.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlServiceAccount.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlAgentFailsafe.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlTraceFlag.Integration.Tests.ps1' ## Group 3 - #'tests/Integration/DSC_SqlRole.Integration.Tests.ps1' - 'tests/Integration/DSC_SqlRS.Integration.Tests.ps1' - #'tests/Integration/DSC_SqlDatabaseUser.Integration.Tests.ps1' - #'tests/Integration/DSC_SqlReplication.Integration.Tests.ps1' - #'tests/Integration/DSC_SqlAudit.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlRole.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlRS.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlDatabaseUser.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlReplication.Integration.Tests.ps1' + #'tests/Integration/Resources/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' + #'tests/Integration/Resources/DSC_SqlScript.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlDatabasePermission.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlPermission.Integration.Tests.ps1' + #'tests/Integration/DResources/SC_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' + #'tests/Integration/Resources/DSC_SqlSecureConnection.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlScriptQuery.Integration.Tests.ps1' + #'tests/Integration/Resources/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' + #'tests/Integration/Resources/DSC_SqlProtocolTcpIp.Integration.Tests.ps1' + #'tests/Integration/Resources/DSC_SqlDatabaseObjectPermission.Integration.Tests.ps1' ) deploy: off diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d3db63d44..ff3ab3306 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -69,7 +69,8 @@ stages: publishLocation: 'pipeline' parallel: true - - stage: Test + - stage: Quality_Test_and_Unit_Test + displayName: 'Quality Test and Unit Test' dependsOn: Build jobs: - job: Test_HQRM @@ -156,6 +157,112 @@ stages: artifactName: $(testArtifactName) parallel: true + - job: Code_Coverage + displayName: 'Publish Code Coverage' + dependsOn: Test_Unit + condition: succeededOrFailed() + pool: + vmImage: 'ubuntu-latest' + timeoutInMinutes: 0 + steps: + - pwsh: | + $repositoryOwner,$repositoryName = $env:BUILD_REPOSITORY_NAME -split '/' + echo "##vso[task.setvariable variable=RepositoryOwner;isOutput=true]$repositoryOwner" + echo "##vso[task.setvariable variable=RepositoryName;isOutput=true]$repositoryName" + name: dscBuildVariable + displayName: 'Set Environment Variables' + - task: DownloadPipelineArtifact@2 + displayName: 'Download Build Artifact' + inputs: + buildType: 'current' + artifactName: $(buildArtifactName) + targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)' + - task: DownloadPipelineArtifact@2 + displayName: 'Download Test Artifact' + inputs: + buildType: 'current' + artifactName: $(testArtifactName) + targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)' + - task: PublishCodeCoverageResults@1 + displayName: 'Publish Code Coverage to Azure DevOps' + inputs: + codeCoverageTool: 'JaCoCo' + summaryFileLocation: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml' + pathToSources: '$(Build.SourcesDirectory)/$(sourceFolderName)/' + - script: | + bash <(curl -s https://codecov.io/bash) -f "./$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml" -F unit + displayName: 'Publish Code Coverage to Codecov.io' + + - stage: Integration_Test_Commands + displayName: 'Integration Test Commands' + dependsOn: Build + jobs: + - job: Test_Integration + displayName: 'Commands' + strategy: + matrix: + SQL2016_WIN2019: + JOB_VMIMAGE: 'windows-2019' + TEST_CONFIGURATION: 'Integration_SQL2016' + SQL2016_WIN2022: + JOB_VMIMAGE: 'windows-2022' + TEST_CONFIGURATION: 'Integration_SQL2016' + SQL2017_WIN2019: + JOB_VMIMAGE: 'windows-2019' + TEST_CONFIGURATION: 'Integration_SQL2017' + SQL2017_WIN2022: + JOB_VMIMAGE: 'windows-2022' + TEST_CONFIGURATION: 'Integration_SQL2017' + SQL2019_WIN2019: + JOB_VMIMAGE: 'windows-2019' + TEST_CONFIGURATION: 'Integration_SQL2019' + SQL2019_WIN2022: + JOB_VMIMAGE: 'windows-2022' + TEST_CONFIGURATION: 'Integration_SQL2019' + SQL2022_WIN2019: + JOB_VMIMAGE: 'windows-2019' + TEST_CONFIGURATION: 'Integration_SQL2022' + SQL2022_WIN2022: + JOB_VMIMAGE: 'windows-2022' + TEST_CONFIGURATION: 'Integration_SQL2022' + pool: + vmImage: $(JOB_VMIMAGE) + timeoutInMinutes: 0 + steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download Build Artifact' + inputs: + buildType: 'current' + artifactName: $(buildArtifactName) + targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)' + - powershell: | + Import-Module -Name ./tests/TestHelpers/CommonTestHelper.psm1 + Remove-PowerShellModuleFromCI -Name @('SqlServer', 'SQLPS') + 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/Commands/Install-SqlDscServer.Integration.Tests.ps1' + # Group 2 + #'tests/Integration/Commands/Install-SqlDscReportingServices.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 ($(TEST_CONFIGURATION) / $(JOB_VMIMAGE))' + + - stage: Integration_Test_Resources + displayName: 'Integration Test Resources' + dependsOn: Build + jobs: - job: Test_Integration displayName: 'Integration' strategy: @@ -211,38 +318,38 @@ stages: ./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' + 'tests/Integration/Resources/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' + 'tests/Integration/Resources/DSC_SqlAgentAlert.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlLogin.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlEndpoint.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlDatabaseMail.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlRSSetup.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlDatabaseDefaultLocation.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlDatabase.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlAlwaysOnService.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlAgentOperator.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlServiceAccount.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlAgentFailsafe.Integration.Tests.ps1' + 'tests/Integration/Resources/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' + 'tests/Integration/Resources/DSC_SqlRole.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlRS_Default.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlDatabaseUser.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlReplication.Integration.Tests.ps1' + 'tests/Integration/Resources/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' + 'tests/Integration/Resources/DSC_SqlScript.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlDatabasePermission.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlPermission.Integration.Tests.ps1' + 'tests/Integration/Resources/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' + 'tests/Integration/Resources/DSC_SqlSecureConnection.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlScriptQuery.Integration.Tests.ps1' + 'tests/Integration/Resources/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' + 'tests/Integration/Resources/DSC_SqlProtocolTcpIp.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlDatabaseObjectPermission.Integration.Tests.ps1' ) name: test displayName: 'Run Integration Test' @@ -301,38 +408,38 @@ stages: ./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' + 'tests/Integration/Resources/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' + 'tests/Integration/Resources/DSC_SqlAgentAlert.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlLogin.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlEndpoint.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlDatabaseMail.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlRSSetup.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlDatabaseDefaultLocation.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlDatabase.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlAlwaysOnService.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlAgentOperator.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlServiceAccount.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlAgentFailsafe.Integration.Tests.ps1' + 'tests/Integration/Resources/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' + 'tests/Integration/Resources/DSC_SqlRole.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlRS_Default.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlDatabaseUser.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlReplication.Integration.Tests.ps1' + 'tests/Integration/Resources/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' + 'tests/Integration/Resources/DSC_SqlScript.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlDatabasePermission.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlPermission.Integration.Tests.ps1' + 'tests/Integration/Resources/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' + 'tests/Integration/Resources/DSC_SqlSecureConnection.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlScriptQuery.Integration.Tests.ps1' + 'tests/Integration/Resources/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' + 'tests/Integration/Resources/DSC_SqlProtocolTcpIp.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlDatabaseObjectPermission.Integration.Tests.ps1' ) name: test displayName: 'Run Integration Test' @@ -404,11 +511,11 @@ stages: ./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' + 'tests/Integration/Resources/DSC_SqlSetup.Integration.Tests.ps1' # Group 2 - 'tests/Integration/DSC_SqlRSSetup.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlRSSetup.Integration.Tests.ps1' # Group 3 - 'tests/Integration/DSC_SqlRS.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlRS.Integration.Tests.ps1' ) name: test displayName: 'Run Reporting Services Integration Test' @@ -463,11 +570,11 @@ stages: ./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' + 'tests/Integration/Resources/DSC_SqlSetup.Integration.Tests.ps1' # Group 2 - 'tests/Integration/DSC_SqlRSSetup.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlRSSetup.Integration.Tests.ps1' # Group 3 - 'tests/Integration/DSC_SqlRS.Integration.Tests.ps1' + 'tests/Integration/Resources/DSC_SqlRS.Integration.Tests.ps1' ) name: test displayName: 'Run Reporting Services Integration Test' @@ -479,44 +586,11 @@ stages: testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml' testRunTitle: 'Integration RS (dbatools) ($(TEST_CONFIGURATION) / $(JOB_VMIMAGE))' - - job: Code_Coverage - displayName: 'Publish Code Coverage' - dependsOn: Test_Unit - condition: succeededOrFailed() - pool: - vmImage: 'ubuntu-latest' - timeoutInMinutes: 0 - steps: - - pwsh: | - $repositoryOwner,$repositoryName = $env:BUILD_REPOSITORY_NAME -split '/' - echo "##vso[task.setvariable variable=RepositoryOwner;isOutput=true]$repositoryOwner" - echo "##vso[task.setvariable variable=RepositoryName;isOutput=true]$repositoryName" - name: dscBuildVariable - displayName: 'Set Environment Variables' - - task: DownloadPipelineArtifact@2 - displayName: 'Download Build Artifact' - inputs: - buildType: 'current' - artifactName: $(buildArtifactName) - targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)' - - task: DownloadPipelineArtifact@2 - displayName: 'Download Test Artifact' - inputs: - buildType: 'current' - artifactName: $(testArtifactName) - targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)' - - task: PublishCodeCoverageResults@1 - displayName: 'Publish Code Coverage to Azure DevOps' - inputs: - codeCoverageTool: 'JaCoCo' - summaryFileLocation: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml' - pathToSources: '$(Build.SourcesDirectory)/$(sourceFolderName)/' - - script: | - bash <(curl -s https://codecov.io/bash) -f "./$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml" -F unit - displayName: 'Publish Code Coverage to Codecov.io' - - stage: Deploy - dependsOn: Test + dependsOn: + - Quality_Test_and_Unit_Test + - Integration_Test_Commands + - Integration_Test_Resources condition: | and( succeeded(), diff --git a/tests/Integration/Commands/Install-SqlDscServer.Integration.Tests.ps1 b/tests/Integration/Commands/Install-SqlDscServer.Integration.Tests.ps1 new file mode 100644 index 000000000..ddb0517f7 --- /dev/null +++ b/tests/Integration/Commands/Install-SqlDscServer.Integration.Tests.ps1 @@ -0,0 +1,48 @@ +[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Suppressing this rule because Script Analyzer does not understand Pester syntax.')] +param () + +BeforeDiscovery { + try + { + if (-not (Get-Module -Name 'DscResource.Test')) + { + # Assumes dependencies has been resolved, so if this module is not available, run 'noop' task. + if (-not (Get-Module -Name 'DscResource.Test' -ListAvailable)) + { + # Redirect all streams to $null, except the error stream (stream 2) + & "$PSScriptRoot/../../build.ps1" -Tasks 'noop' 2>&1 4>&1 5>&1 6>&1 > $null + } + + # If the dependencies has not been resolved, this will throw an error. + Import-Module -Name 'DscResource.Test' -Force -ErrorAction 'Stop' + } + } + catch [System.IO.FileNotFoundException] + { + throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks build" first.' + } +} + +Describe 'Install-SqlDscServer' -Tag @('Integration_SQL2016', 'Integration_SQL2017', 'Integration_SQL2019', 'Integration_SQL2022') { + Context 'When using Install parameter set' { + Context 'When installing database engine default instance' { + It 'Should run the command without throwing' { + { + # Set splatting parameters for Install-SqlDscServer + $installSqlDscServerParameters = @{ + Install = $true + AcceptLicensingTerms = $true + InstanceName = 'MSSQLSERVER' + Features = 'SQLENGINE' + SqlSysAdminAccounts = @('MyAdminAccount') + MediaPath = 'E:\' + Verbose = $true + ErrorAction = 'Stop' + } + + # Install-SqlDscServer @installSqlDscServerParameters + } | Should -Not -Throw + } + } + } +} diff --git a/tests/Integration/Commands/README.md b/tests/Integration/Commands/README.md new file mode 100644 index 000000000..7682dc9ac --- /dev/null +++ b/tests/Integration/Commands/README.md @@ -0,0 +1,93 @@ +# Integration tests for SqlServerDsc + +## Debugging + +Currently there are no possible to debug the commands on the service Appveyor +since it has not been configured in the `appveyor.yml`. + +## SqlServer module + +There is a difference what module version of [_SqlServer_](https://www.powershellgallery.com/packages/SqlServer) +is used for what SQL Server release. The integration tests for SqlSetup_ +installs the required module version. + +SQL Server release | SqlServer module version +--- | --- +SQL Server 2016 | 21.1.18256 +SQL Server 2017 | 21.1.18256 +SQL Server 2019 | 21.1.18256 +SQL Server 2022 | 22.2.0 + +## Depends On + +For it to be easier to write integration tests for a command that depends +on other command, each commands integration test should have run order number. + +If an integration test is dependent on one or more integration test +then the run order for the new integration tests should be set to +a higher run order number than the highest run order of the dependent +integration tests. + +**Below are the integration tests listed in the run order, and with the dependency +to each other. Dependencies are made to speed up the testing.** + +Command | Run order # | Depends on # | Use instance +--- | --- | --- | --- +Install-SqlDscServer | 1 | - | - + +## Integration Tests + +### `Install-SqlDscServer` + +Installs all the [instances](#instances). + +## Instances + +These instances is available for integration tests. + +Instance | Feature | State +--- | --- | --- +DSCSQLTEST | SQLENGINE | - | Running +MSSQLSERVER | SQLENGINE | - | Stopped + +All running Database Engine instances also have a SQL Server Agent that is started. + +The instance DSCSQLTEST support mixed authentication mode, and will have +both Named Pipes and TCP/IP protocol enabled. + +> [!NOTE] +> Some services are stopped to save memory on the build worker. See the +> column *State*. + +### Instance properties + +- **Collation:** Finnish\_Swedish\_CI\_AS +- **InstallSharedDir:** C:\Program Files\Microsoft SQL Server +- **InstallSharedWOWDir:** C:\Program Files (x86)\Microsoft SQL Server + +## Users + +The following local users are created and can be used by integration tests. + + +User | Password | Permission | Description +--- | --- | --- | --- +.\SqlInstall | P@ssw0rd1 | Local Windows administrator. Administrator of Database Engine instance DSCSQLTEST\*. | Runs Setup for the default instance. +.\SqlAdmin | P@ssw0rd1 | Administrator of all SQL Server instances. | +.\svc-SqlPrimary | yig-C^Equ3 | Local user. | Runs the SQL Server Agent service. +.\svc-SqlAgentPri | yig-C^Equ3 | Local user. | Runs the SQL Server Agent service. +.\svc-SqlSecondary | yig-C^Equ3 | Local user. | Used by other tests, but created here. +.\svc-SqlAgentSec | yig-C^Equ3 | Local user. | Used by other tests. + +Login | Password | Permission | Description +--- | --- | --- | --- +sa | P@ssw0rd1 | sysadmin | Administrator of the Database Engine instances DSCSQLTEST. | + + +## Image media (ISO) + +The path to the image media is set in the environment variable `$env:IsoImagePath` +and the drive letter used to mount the image media is save in `$env:IsoDriveLetter`. + +This information can be used by integration tests that depends on +the image media. diff --git a/tests/Integration/DSC_SqlAgentAlert.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlAgentAlert.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlAgentAlert.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlAgentAlert.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlAgentAlert.config.ps1 b/tests/Integration/Resources/DSC_SqlAgentAlert.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlAgentAlert.config.ps1 rename to tests/Integration/Resources/DSC_SqlAgentAlert.config.ps1 diff --git a/tests/Integration/DSC_SqlAgentFailsafe.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlAgentFailsafe.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlAgentFailsafe.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlAgentFailsafe.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlAgentFailsafe.config.ps1 b/tests/Integration/Resources/DSC_SqlAgentFailsafe.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlAgentFailsafe.config.ps1 rename to tests/Integration/Resources/DSC_SqlAgentFailsafe.config.ps1 diff --git a/tests/Integration/DSC_SqlAgentOperator.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlAgentOperator.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlAgentOperator.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlAgentOperator.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlAgentOperator.config.ps1 b/tests/Integration/Resources/DSC_SqlAgentOperator.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlAgentOperator.config.ps1 rename to tests/Integration/Resources/DSC_SqlAgentOperator.config.ps1 diff --git a/tests/Integration/DSC_SqlAlwaysOnService.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlAlwaysOnService.Integration.Tests.ps1 similarity index 99% rename from tests/Integration/DSC_SqlAlwaysOnService.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlAlwaysOnService.Integration.Tests.ps1 index bf85d29ae..b75f120ab 100644 --- a/tests/Integration/DSC_SqlAlwaysOnService.Integration.Tests.ps1 +++ b/tests/Integration/Resources/DSC_SqlAlwaysOnService.Integration.Tests.ps1 @@ -31,7 +31,7 @@ BeforeDiscovery { } BeforeAll { - Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\TestHelpers\CommonTestHelper.psm1') + Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\..\TestHelpers\CommonTestHelper.psm1') # Need to define the variables here which will be used in Pester Run. $script:dscModuleName = 'SqlServerDsc' diff --git a/tests/Integration/DSC_SqlAlwaysOnService.config.ps1 b/tests/Integration/Resources/DSC_SqlAlwaysOnService.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlAlwaysOnService.config.ps1 rename to tests/Integration/Resources/DSC_SqlAlwaysOnService.config.ps1 diff --git a/tests/Integration/DSC_SqlAudit.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlAudit.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlAudit.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlAudit.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlAudit.config.ps1 b/tests/Integration/Resources/DSC_SqlAudit.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlAudit.config.ps1 rename to tests/Integration/Resources/DSC_SqlAudit.config.ps1 diff --git a/tests/Integration/DSC_SqlDatabase.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlDatabase.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlDatabase.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlDatabase.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlDatabase.config.ps1 b/tests/Integration/Resources/DSC_SqlDatabase.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlDatabase.config.ps1 rename to tests/Integration/Resources/DSC_SqlDatabase.config.ps1 diff --git a/tests/Integration/DSC_SqlDatabaseDefaultLocation.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlDatabaseDefaultLocation.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlDatabaseDefaultLocation.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlDatabaseDefaultLocation.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlDatabaseDefaultLocation.config.ps1 b/tests/Integration/Resources/DSC_SqlDatabaseDefaultLocation.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlDatabaseDefaultLocation.config.ps1 rename to tests/Integration/Resources/DSC_SqlDatabaseDefaultLocation.config.ps1 diff --git a/tests/Integration/DSC_SqlDatabaseMail.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlDatabaseMail.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlDatabaseMail.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlDatabaseMail.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlDatabaseMail.config.ps1 b/tests/Integration/Resources/DSC_SqlDatabaseMail.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlDatabaseMail.config.ps1 rename to tests/Integration/Resources/DSC_SqlDatabaseMail.config.ps1 diff --git a/tests/Integration/DSC_SqlDatabaseObjectPermission.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlDatabaseObjectPermission.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlDatabaseObjectPermission.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlDatabaseObjectPermission.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlDatabaseObjectPermission.config.ps1 b/tests/Integration/Resources/DSC_SqlDatabaseObjectPermission.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlDatabaseObjectPermission.config.ps1 rename to tests/Integration/Resources/DSC_SqlDatabaseObjectPermission.config.ps1 diff --git a/tests/Integration/DSC_SqlDatabasePermission.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlDatabasePermission.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlDatabasePermission.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlDatabasePermission.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlDatabasePermission.config.ps1 b/tests/Integration/Resources/DSC_SqlDatabasePermission.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlDatabasePermission.config.ps1 rename to tests/Integration/Resources/DSC_SqlDatabasePermission.config.ps1 diff --git a/tests/Integration/DSC_SqlDatabaseUser.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlDatabaseUser.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlDatabaseUser.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlDatabaseUser.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlDatabaseUser.config.ps1 b/tests/Integration/Resources/DSC_SqlDatabaseUser.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlDatabaseUser.config.ps1 rename to tests/Integration/Resources/DSC_SqlDatabaseUser.config.ps1 diff --git a/tests/Integration/DSC_SqlEndpoint.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlEndpoint.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlEndpoint.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlEndpoint.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlEndpoint.config.ps1 b/tests/Integration/Resources/DSC_SqlEndpoint.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlEndpoint.config.ps1 rename to tests/Integration/Resources/DSC_SqlEndpoint.config.ps1 diff --git a/tests/Integration/DSC_SqlLogin.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlLogin.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlLogin.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlLogin.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlLogin.config.ps1 b/tests/Integration/Resources/DSC_SqlLogin.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlLogin.config.ps1 rename to tests/Integration/Resources/DSC_SqlLogin.config.ps1 diff --git a/tests/Integration/DSC_SqlPermission.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlPermission.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlPermission.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlPermission.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlPermission.config.ps1 b/tests/Integration/Resources/DSC_SqlPermission.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlPermission.config.ps1 rename to tests/Integration/Resources/DSC_SqlPermission.config.ps1 diff --git a/tests/Integration/DSC_SqlProtocol.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlProtocol.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlProtocol.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlProtocol.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlProtocol.config.ps1 b/tests/Integration/Resources/DSC_SqlProtocol.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlProtocol.config.ps1 rename to tests/Integration/Resources/DSC_SqlProtocol.config.ps1 diff --git a/tests/Integration/DSC_SqlProtocolTcpIp.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlProtocolTcpIp.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlProtocolTcpIp.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlProtocolTcpIp.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlProtocolTcpIp.config.ps1 b/tests/Integration/Resources/DSC_SqlProtocolTcpIp.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlProtocolTcpIp.config.ps1 rename to tests/Integration/Resources/DSC_SqlProtocolTcpIp.config.ps1 diff --git a/tests/Integration/DSC_SqlRS.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlRS.Integration.Tests.ps1 similarity index 99% rename from tests/Integration/DSC_SqlRS.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlRS.Integration.Tests.ps1 index d3b228a29..ccdac7dea 100644 --- a/tests/Integration/DSC_SqlRS.Integration.Tests.ps1 +++ b/tests/Integration/Resources/DSC_SqlRS.Integration.Tests.ps1 @@ -31,7 +31,7 @@ BeforeDiscovery { } BeforeAll { - Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\TestHelpers\CommonTestHelper.psm1') + Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\..\TestHelpers\CommonTestHelper.psm1') # Need to define the variables here which will be used in Pester Run. $script:dscModuleName = 'SqlServerDsc' diff --git a/tests/Integration/DSC_SqlRS.config.ps1 b/tests/Integration/Resources/DSC_SqlRS.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlRS.config.ps1 rename to tests/Integration/Resources/DSC_SqlRS.config.ps1 diff --git a/tests/Integration/DSC_SqlRSSetup.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlRSSetup.Integration.Tests.ps1 similarity index 99% rename from tests/Integration/DSC_SqlRSSetup.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlRSSetup.Integration.Tests.ps1 index f183a1aed..9f4848047 100644 --- a/tests/Integration/DSC_SqlRSSetup.Integration.Tests.ps1 +++ b/tests/Integration/Resources/DSC_SqlRSSetup.Integration.Tests.ps1 @@ -31,7 +31,7 @@ BeforeDiscovery { } BeforeAll { - Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\TestHelpers\CommonTestHelper.psm1') + Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\..\TestHelpers\CommonTestHelper.psm1') # Need to define the variables here which will be used in Pester Run. $script:dscModuleName = 'SqlServerDsc' diff --git a/tests/Integration/DSC_SqlRSSetup.config.ps1 b/tests/Integration/Resources/DSC_SqlRSSetup.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlRSSetup.config.ps1 rename to tests/Integration/Resources/DSC_SqlRSSetup.config.ps1 diff --git a/tests/Integration/DSC_SqlRS_Default.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlRS_Default.Integration.Tests.ps1 similarity index 99% rename from tests/Integration/DSC_SqlRS_Default.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlRS_Default.Integration.Tests.ps1 index 82bf3a53c..62d275190 100644 --- a/tests/Integration/DSC_SqlRS_Default.Integration.Tests.ps1 +++ b/tests/Integration/Resources/DSC_SqlRS_Default.Integration.Tests.ps1 @@ -31,7 +31,7 @@ BeforeDiscovery { } BeforeAll { - Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\TestHelpers\CommonTestHelper.psm1') + Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\..\TestHelpers\CommonTestHelper.psm1') # Need to define the variables here which will be used in Pester Run. $script:dscModuleName = 'SqlServerDsc' diff --git a/tests/Integration/DSC_SqlRS_Default.config.ps1 b/tests/Integration/Resources/DSC_SqlRS_Default.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlRS_Default.config.ps1 rename to tests/Integration/Resources/DSC_SqlRS_Default.config.ps1 diff --git a/tests/Integration/DSC_SqlReplication.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlReplication.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlReplication.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlReplication.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlReplication.config.ps1 b/tests/Integration/Resources/DSC_SqlReplication.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlReplication.config.ps1 rename to tests/Integration/Resources/DSC_SqlReplication.config.ps1 diff --git a/tests/Integration/DSC_SqlRole.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlRole.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlRole.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlRole.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlRole.config.ps1 b/tests/Integration/Resources/DSC_SqlRole.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlRole.config.ps1 rename to tests/Integration/Resources/DSC_SqlRole.config.ps1 diff --git a/tests/Integration/DSC_SqlScript.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlScript.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlScript.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlScript.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlScript.config.ps1 b/tests/Integration/Resources/DSC_SqlScript.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlScript.config.ps1 rename to tests/Integration/Resources/DSC_SqlScript.config.ps1 diff --git a/tests/Integration/DSC_SqlScriptQuery.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlScriptQuery.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlScriptQuery.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlScriptQuery.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlScriptQuery.config.ps1 b/tests/Integration/Resources/DSC_SqlScriptQuery.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlScriptQuery.config.ps1 rename to tests/Integration/Resources/DSC_SqlScriptQuery.config.ps1 diff --git a/tests/Integration/DSC_SqlSecureConnection.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlSecureConnection.Integration.Tests.ps1 similarity index 99% rename from tests/Integration/DSC_SqlSecureConnection.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlSecureConnection.Integration.Tests.ps1 index 71ede1b37..3e4dd27c3 100644 --- a/tests/Integration/DSC_SqlSecureConnection.Integration.Tests.ps1 +++ b/tests/Integration/Resources/DSC_SqlSecureConnection.Integration.Tests.ps1 @@ -31,7 +31,7 @@ BeforeDiscovery { } BeforeAll { - Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\TestHelpers\CommonTestHelper.psm1') + Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\..\TestHelpers\CommonTestHelper.psm1') # Need to define the variables here which will be used in Pester Run. $script:dscModuleName = 'SqlServerDsc' diff --git a/tests/Integration/DSC_SqlSecureConnection.config.ps1 b/tests/Integration/Resources/DSC_SqlSecureConnection.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlSecureConnection.config.ps1 rename to tests/Integration/Resources/DSC_SqlSecureConnection.config.ps1 diff --git a/tests/Integration/DSC_SqlServiceAccount.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlServiceAccount.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlServiceAccount.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlServiceAccount.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlServiceAccount.config.ps1 b/tests/Integration/Resources/DSC_SqlServiceAccount.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlServiceAccount.config.ps1 rename to tests/Integration/Resources/DSC_SqlServiceAccount.config.ps1 diff --git a/tests/Integration/DSC_SqlSetup.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlSetup.Integration.Tests.ps1 similarity index 99% rename from tests/Integration/DSC_SqlSetup.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlSetup.Integration.Tests.ps1 index 5e27ad3a2..f08af5f64 100644 --- a/tests/Integration/DSC_SqlSetup.Integration.Tests.ps1 +++ b/tests/Integration/Resources/DSC_SqlSetup.Integration.Tests.ps1 @@ -31,7 +31,7 @@ BeforeDiscovery { } BeforeAll { - Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\TestHelpers\CommonTestHelper.psm1') + Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\..\TestHelpers\CommonTestHelper.psm1') # Need to define the variables here which will be used in Pester Run. $script:dscModuleName = 'SqlServerDsc' diff --git a/tests/Integration/DSC_SqlSetup.config.ps1 b/tests/Integration/Resources/DSC_SqlSetup.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlSetup.config.ps1 rename to tests/Integration/Resources/DSC_SqlSetup.config.ps1 diff --git a/tests/Integration/DSC_SqlTraceFlag.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlTraceFlag.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlTraceFlag.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlTraceFlag.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlTraceFlag.config.ps1 b/tests/Integration/Resources/DSC_SqlTraceFlag.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlTraceFlag.config.ps1 rename to tests/Integration/Resources/DSC_SqlTraceFlag.config.ps1 diff --git a/tests/Integration/DSC_SqlWindowsFirewall.Integration.Tests.ps1 b/tests/Integration/Resources/DSC_SqlWindowsFirewall.Integration.Tests.ps1 similarity index 100% rename from tests/Integration/DSC_SqlWindowsFirewall.Integration.Tests.ps1 rename to tests/Integration/Resources/DSC_SqlWindowsFirewall.Integration.Tests.ps1 diff --git a/tests/Integration/DSC_SqlWindowsFirewall.config.ps1 b/tests/Integration/Resources/DSC_SqlWindowsFirewall.config.ps1 similarity index 100% rename from tests/Integration/DSC_SqlWindowsFirewall.config.ps1 rename to tests/Integration/Resources/DSC_SqlWindowsFirewall.config.ps1 diff --git a/tests/Integration/README.md b/tests/Integration/Resources/README.md similarity index 100% rename from tests/Integration/README.md rename to tests/Integration/Resources/README.md