diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..a82ff93
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,31 @@
+# See http://www.appveyor.com/docs/appveyor-yml for many more options
+version: 0.1.{build}
+
+cache:
+- C:\ProgramData\chocolatey\bin -> appveyor.yml
+- C:\ProgramData\chocolatey\lib -> appveyor.yml
+- C:\Program Files\WindowsPowerShell\Modules\PSScriptAnalyzer -> appveyor.yml
+- C:\Program Files\WindowsPowerShell\Modules\Pester -> appveyor.yml
+- C:\Program Files\WindowsPowerShell\Modules\PSFramework -> appveyor.yml
+- C:\Program Files\WindowsPowerShell\Modules\dbatools -> appveyor.yml
+
+shallow_clone: true
+
+environment:
+ environment: development
+ version: 0.1.$(appveyor_build_number)
+ appveyor_rdp_password: Psd@tabaseclone2018
+
+matrix:
+ fast_finish: true
+
+build_script:
+# grab appveyor lab files and needed requirements for tests in CI
+- ps: .\tests\appveyor\preparation.ps1
+
+test_script:
+# Test with PowerShell and Pester
+- ps: .\tests\pester.ps1
+
+#on_finish:
+# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
\ No newline at end of file
diff --git a/internal/scripts/preimport.ps1 b/internal/scripts/preimport.ps1
index 1748d1a..1706e4a 100644
--- a/internal/scripts/preimport.ps1
+++ b/internal/scripts/preimport.ps1
@@ -10,7 +10,8 @@ $supportedVersions = @(
'Microsoft Windows 10 Enterprise',
'Microsoft Windows 10 Education',
'Microsoft Windows Server 2012 R2 Standard',
- 'Microsoft Windows Server 2012 R2 Enterprise'
+ 'Microsoft Windows Server 2012 R2 Enterprise',
+ 'Microsoft Windows Server 2012 R2 Datacenter'
)
# Get the OS details
diff --git a/readme.md b/readme.md
index a58d3e2..12b7587 100644
--- a/readme.md
+++ b/readme.md
@@ -1,5 +1,5 @@
## PSDatabaseClone
- PSDatabaseClone is a PowerShell module for creating SQL Server database images and clones.
+ PSDatabaseClone is a PowerShell module for creating SQL Server database images and clones.
It enables administrator to supply environments with database copies that are a fraction of the original size.
Do you have any ideas for new commands? Please propose them as issues and let us know what you'd like to see. Bug reports should also be filed under this repository's issues section.
diff --git a/tests/appveyor/preparation.ps1 b/tests/appveyor/preparation.ps1
new file mode 100644
index 0000000..4698734
--- /dev/null
+++ b/tests/appveyor/preparation.ps1
@@ -0,0 +1,58 @@
+Add-AppveyorTest -Name "appveyor.prep" -Framework NUnit -FileName "appveyor.prep.ps1" -Outcome Running
+$sw = [system.diagnostics.stopwatch]::startNew()
+
+# Importing constants
+$rootPath = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
+. "$rootPath\tests\constants.ps1"
+
+# Get PSScriptAnalyzer (to check warnings)
+Write-Host -Object "appveyor.prep: Install PSScriptAnalyzer" -ForegroundColor DarkGreen
+Install-Module -Name PSScriptAnalyzer -Force -SkipPublisherCheck | Out-Null
+
+# Get Pester (to run tests)
+Write-Host -Object "appveyor.prep: Install Pester" -ForegroundColor DarkGreen
+choco install pester | Out-Null
+
+# Get dbatools
+Write-Host -Object "appveyor.prep: Install dbatools" -ForegroundColor DarkGreen
+Install-Module -Name dbatools -Force | Out-Null
+
+# Get PSFramework
+Write-Host -Object "appveyor.prep: Install PSFramework" -ForegroundColor DarkGreen
+Install-Module -Name PSFramework -Force | Out-Null
+
+# Get Hyper-V-PowerShell
+#Write-Host -Object "appveyor.prep: Install Hyper-V-PowerShell" -ForegroundColor DarkGreen
+#Install-WindowsFeature -Name Hyper-V-PowerShell | Out-Null
+#Install-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature | Out-Null
+
+# Creating config files
+Write-Host -Object "appveyor.prep: Creating configurations files" -ForegroundColor DarkGreen
+$configPath = "C:\projects\config"
+
+$null = New-Item -Path "$configPath\hosts.json" -Force:$Force
+$null = New-Item -Path "$configPath\images.json" -Force:$Force
+$null = New-Item -Path "$configPath\clones.json" -Force:$Force
+
+# Creating folder
+Write-Host -Object "appveyor.prep: Creating image and clone directories" -ForegroundColor DarkGreen
+$imageFolder = "C:\projects\images"
+$null = New-Item -Path $imageFolder -ItemType Directory -Force:$Force
+
+$cloneFolder = "C:\projects\clones"
+$null = New-Item -Path $cloneFolder -ItemType Directory -Force:$Force
+
+# Setting configurations
+Write-Host -Object "appveyor.prep: Setting configurations" -ForegroundColor DarkGreen
+Set-PSFConfig -Module PSDatabaseClone -Name setup.status -Value $true -Validation bool
+Set-PSFConfig -Module PSDatabaseClone -Name informationstore.mode -Value 'File'
+Set-PSFConfig -Module PSDatabaseClone -Name informationstore.path -Value "$configPath" -Validation string
+
+# Registering configurations
+Write-Host -Object "appveyor.prep: Registering configurations" -ForegroundColor DarkGreen
+Get-PSFConfig -FullName psdatabaseclone.setup.status | Register-PSFConfig -Scope SystemDefault
+Get-PSFConfig -FullName psdatabaseclone.informationstore.mode | Register-PSFConfig -Scope SystemDefault
+Get-PSFConfig -FullName psdatabaseclone.informationstore.path | Register-PSFConfig -Scope SystemDefault
+
+$sw.Stop()
+Update-AppveyorTest -Name "appveyor.prep" -Framework NUnit -FileName "appveyor.prep.ps1" -Outcome Passed -Duration $sw.ElapsedMilliseconds
\ No newline at end of file
diff --git a/tests/constants.ps1 b/tests/constants.ps1
index f9553e7..ea581db 100644
--- a/tests/constants.ps1
+++ b/tests/constants.ps1
@@ -14,4 +14,8 @@ else {
$script:instance1_detailed = "localhost,1433\sql2008r2sp2" #Just to make sure things parse a port properly
$script:appveyorlabrepo = "C:\github\appveyor-lab"
$instances = @($script:instance1, $script:instance2)
+
+ $script:jsonfolder = "C:\projects\config"
+ $script:imagefolder = "C:\projects\images"
+ $script:clonefolder = "C:\projects\clones"
}
diff --git a/tests/functions/New-PSDCVhdDisk.Tests.ps1 b/tests/functions/New-PSDCVhdDisk.Tests.ps1
deleted file mode 100644
index fe69548..0000000
--- a/tests/functions/New-PSDCVhdDisk.Tests.ps1
+++ /dev/null
@@ -1,39 +0,0 @@
-$moduleRoot = (Resolve-Path "$PSScriptRoot\..\..").Path
-$commandname = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "")
-$rootPath = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
-
-. "$rootPath\tests\constants.ps1"
-
-Describe "$commandname Unit Tests" {
-
- BeforeAll {
- # Get a random value for the database name
- $random = Get-Random
-
- $name = "Test_VHD_$($random)"
- $destination = "$moduleRoot\tests"
- $path = "$destination\$name.vhdx"
- }
-
- Context "Create VHD with -FileName parameter" {
- $null = New-PSDCVhdDisk -Destination $destination -FileName "$name.vhdx" -ErrorAction Ignore
-
- It "Should be true" {
- (Test-Path -Path $path) | Should Be $true
- }
-
- Remove-Item -Path $path -Force
- }
-
- Context "Create VHD with -Name parameter" {
- $null = New-PSDCVhdDisk -Destination $destination -Name $name -ErrorAction Ignore
-
- It "Should be true" {
- (Test-Path -Path $path) | Should Be $true
-
- }
-
- Remove-Item -Path $path -Force
- }
-
-}
diff --git a/tests/pester.ps1 b/tests/pester.ps1
index e3e33dd..3538a4f 100644
--- a/tests/pester.ps1
+++ b/tests/pester.ps1
@@ -44,7 +44,7 @@ foreach ($file in (Get-ChildItem "$PSScriptRoot\general" -Filter "*.Tests.ps1"))
}
}
-Write-PSFMessage -Level Important -Message "Proceeding with individual tests"
+<# Write-PSFMessage -Level Important -Message "Proceeding with individual tests"
foreach ($file in (Get-ChildItem "$PSScriptRoot\functions" -Recurse -File -Filter "*Tests.ps1"))
{
Write-PSFMessage -Level Significant -Message " Executing $($file.Name)"
@@ -64,7 +64,7 @@ foreach ($file in (Get-ChildItem "$PSScriptRoot\functions" -Recurse -File -Filte
}
}
}
-}
+} #>
$testresults | Sort-Object Describe, Context, Name, Result, Message | Format-List
diff --git a/tests/vsts/preparation.ps1 b/tests/vsts/preparation.ps1
new file mode 100644
index 0000000..d5ae70b
--- /dev/null
+++ b/tests/vsts/preparation.ps1
@@ -0,0 +1,58 @@
+Add-AppveyorTest -Name "appveyor.prep" -Framework NUnit -FileName "appveyor.prep.ps1" -Outcome Running
+$sw = [system.diagnostics.stopwatch]::startNew()
+
+# Importing constants
+$rootPath = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
+. "$rootPath\tests\constants.ps1"
+
+# Get PSScriptAnalyzer (to check warnings)
+Write-Host -Object "appveyor.prep: Install PSScriptAnalyzer" -ForegroundColor DarkGreen
+Install-Module -Name PSScriptAnalyzer -Force -SkipPublisherCheck | Out-Null
+
+# Get Pester (to run tests)
+Write-Host -Object "appveyor.prep: Install Pester" -ForegroundColor DarkGreen
+choco install pester | Out-Null
+
+# Get dbatools
+Write-Host -Object "appveyor.prep: Install dbatools" -ForegroundColor DarkGreen
+Install-Module -Name dbatools | Out-Null
+
+# Get PSFramework
+Write-Host -Object "appveyor.prep: Install PSFramework" -ForegroundColor DarkGreen
+Install-Module -Name PSFramework | Out-Null
+
+# Get Hyper-V-PowerShell
+#Write-Host -Object "appveyor.prep: Install Hyper-V-PowerShell" -ForegroundColor DarkGreen
+#Install-WindowsFeature -Name Hyper-V-PowerShell | Out-Null
+#Install-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature | Out-Null
+
+# Creating config files
+Write-Host -Object "appveyor.prep: Creating configurations files" -ForegroundColor DarkGreen
+$configPath = "C:\projects\config"
+
+$null = New-Item -Path "$configPath\hosts.json" -Force:$Force
+$null = New-Item -Path "$configPath\images.json" -Force:$Force
+$null = New-Item -Path "$configPath\clones.json" -Force:$Force
+
+# Creating folder
+Write-Host -Object "appveyor.prep: Creating image and clone directories" -ForegroundColor DarkGreen
+$imageFolder = "C:\projects\images"
+$null = New-Item -Path $imageFolder -ItemType Directory -Force:$Force
+
+$cloneFolder = "C:\projects\clones"
+$null = New-Item -Path $cloneFolder -ItemType Directory -Force:$Force
+
+# Setting configurations
+Write-Host -Object "appveyor.prep: Setting configurations" -ForegroundColor DarkGreen
+Set-PSFConfig -Module PSDatabaseClone -Name setup.status -Value $true -Validation bool
+Set-PSFConfig -Module PSDatabaseClone -Name informationstore.mode -Value 'File'
+Set-PSFConfig -Module PSDatabaseClone -Name informationstore.path -Value "$configPath" -Validation string
+
+# Registering configurations
+Write-Host -Object "appveyor.prep: Registering configurations" -ForegroundColor DarkGreen
+Get-PSFConfig -FullName psdatabaseclone.setup.status | Register-PSFConfig -Scope SystemDefault
+Get-PSFConfig -FullName psdatabaseclone.informationstore.mode | Register-PSFConfig -Scope SystemDefault
+Get-PSFConfig -FullName psdatabaseclone.informationstore.path | Register-PSFConfig -Scope SystemDefault
+
+$sw.Stop()
+Update-AppveyorTest -Name "appveyor.prep" -Framework NUnit -FileName "appveyor.prep.ps1" -Outcome Passed -Duration $sw.ElapsedMilliseconds
\ No newline at end of file