Skip to content

Commit d489c90

Browse files
authored
Merge pull request #2 from sanderstad/development
First stable release module
2 parents c7a52e0 + 6094407 commit d489c90

File tree

8 files changed

+156
-43
lines changed

8 files changed

+156
-43
lines changed

appveyor.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# See http://www.appveyor.com/docs/appveyor-yml for many more options
2+
version: 0.1.{build}
3+
4+
cache:
5+
- C:\ProgramData\chocolatey\bin -> appveyor.yml
6+
- C:\ProgramData\chocolatey\lib -> appveyor.yml
7+
- C:\Program Files\WindowsPowerShell\Modules\PSScriptAnalyzer -> appveyor.yml
8+
- C:\Program Files\WindowsPowerShell\Modules\Pester -> appveyor.yml
9+
- C:\Program Files\WindowsPowerShell\Modules\PSFramework -> appveyor.yml
10+
- C:\Program Files\WindowsPowerShell\Modules\dbatools -> appveyor.yml
11+
12+
shallow_clone: true
13+
14+
environment:
15+
environment: development
16+
version: 0.1.$(appveyor_build_number)
17+
appveyor_rdp_password: Psd@tabaseclone2018
18+
19+
matrix:
20+
fast_finish: true
21+
22+
build_script:
23+
# grab appveyor lab files and needed requirements for tests in CI
24+
- ps: .\tests\appveyor\preparation.ps1
25+
26+
test_script:
27+
# Test with PowerShell and Pester
28+
- ps: .\tests\pester.ps1
29+
30+
#on_finish:
31+
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

internal/scripts/preimport.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ $supportedVersions = @(
1010
'Microsoft Windows 10 Enterprise',
1111
'Microsoft Windows 10 Education',
1212
'Microsoft Windows Server 2012 R2 Standard',
13-
'Microsoft Windows Server 2012 R2 Enterprise'
13+
'Microsoft Windows Server 2012 R2 Enterprise',
14+
'Microsoft Windows Server 2012 R2 Datacenter'
1415
)
1516

1617
# Get the OS details

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## PSDatabaseClone
2-
<img src="https://www.sqlstad.nl/wp-content/uploads/2018/07/PSDatabaseClone_Logo_128.png" align="left" with="128px" height="131px"/> PSDatabaseClone is a PowerShell module for creating SQL Server database images and clones.
2+
<img src="https://psdatabaseclone.org/wp-content/uploads/2018/07/PSDatabaseClone_Logo_128.png" align="left" with="128px" height="131px"/> PSDatabaseClone is a PowerShell module for creating SQL Server database images and clones.
33
It enables administrator to supply environments with database copies that are a fraction of the original size.
44

55
Do you have any ideas for new commands? Please propose them as <a href="https://psdatabaseclone.io/issues" target="_blank">issues</a> and let us know what you'd like to see. Bug reports should also be filed under this repository's issues section.

tests/appveyor/preparation.ps1

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
Add-AppveyorTest -Name "appveyor.prep" -Framework NUnit -FileName "appveyor.prep.ps1" -Outcome Running
2+
$sw = [system.diagnostics.stopwatch]::startNew()
3+
4+
# Importing constants
5+
$rootPath = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
6+
. "$rootPath\tests\constants.ps1"
7+
8+
# Get PSScriptAnalyzer (to check warnings)
9+
Write-Host -Object "appveyor.prep: Install PSScriptAnalyzer" -ForegroundColor DarkGreen
10+
Install-Module -Name PSScriptAnalyzer -Force -SkipPublisherCheck | Out-Null
11+
12+
# Get Pester (to run tests)
13+
Write-Host -Object "appveyor.prep: Install Pester" -ForegroundColor DarkGreen
14+
choco install pester | Out-Null
15+
16+
# Get dbatools
17+
Write-Host -Object "appveyor.prep: Install dbatools" -ForegroundColor DarkGreen
18+
Install-Module -Name dbatools -Force | Out-Null
19+
20+
# Get PSFramework
21+
Write-Host -Object "appveyor.prep: Install PSFramework" -ForegroundColor DarkGreen
22+
Install-Module -Name PSFramework -Force | Out-Null
23+
24+
# Get Hyper-V-PowerShell
25+
#Write-Host -Object "appveyor.prep: Install Hyper-V-PowerShell" -ForegroundColor DarkGreen
26+
#Install-WindowsFeature -Name Hyper-V-PowerShell | Out-Null
27+
#Install-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature | Out-Null
28+
29+
# Creating config files
30+
Write-Host -Object "appveyor.prep: Creating configurations files" -ForegroundColor DarkGreen
31+
$configPath = "C:\projects\config"
32+
33+
$null = New-Item -Path "$configPath\hosts.json" -Force:$Force
34+
$null = New-Item -Path "$configPath\images.json" -Force:$Force
35+
$null = New-Item -Path "$configPath\clones.json" -Force:$Force
36+
37+
# Creating folder
38+
Write-Host -Object "appveyor.prep: Creating image and clone directories" -ForegroundColor DarkGreen
39+
$imageFolder = "C:\projects\images"
40+
$null = New-Item -Path $imageFolder -ItemType Directory -Force:$Force
41+
42+
$cloneFolder = "C:\projects\clones"
43+
$null = New-Item -Path $cloneFolder -ItemType Directory -Force:$Force
44+
45+
# Setting configurations
46+
Write-Host -Object "appveyor.prep: Setting configurations" -ForegroundColor DarkGreen
47+
Set-PSFConfig -Module PSDatabaseClone -Name setup.status -Value $true -Validation bool
48+
Set-PSFConfig -Module PSDatabaseClone -Name informationstore.mode -Value 'File'
49+
Set-PSFConfig -Module PSDatabaseClone -Name informationstore.path -Value "$configPath" -Validation string
50+
51+
# Registering configurations
52+
Write-Host -Object "appveyor.prep: Registering configurations" -ForegroundColor DarkGreen
53+
Get-PSFConfig -FullName psdatabaseclone.setup.status | Register-PSFConfig -Scope SystemDefault
54+
Get-PSFConfig -FullName psdatabaseclone.informationstore.mode | Register-PSFConfig -Scope SystemDefault
55+
Get-PSFConfig -FullName psdatabaseclone.informationstore.path | Register-PSFConfig -Scope SystemDefault
56+
57+
$sw.Stop()
58+
Update-AppveyorTest -Name "appveyor.prep" -Framework NUnit -FileName "appveyor.prep.ps1" -Outcome Passed -Duration $sw.ElapsedMilliseconds

tests/constants.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ else {
1414
$script:instance1_detailed = "localhost,1433\sql2008r2sp2" #Just to make sure things parse a port properly
1515
$script:appveyorlabrepo = "C:\github\appveyor-lab"
1616
$instances = @($script:instance1, $script:instance2)
17+
18+
$script:jsonfolder = "C:\projects\config"
19+
$script:imagefolder = "C:\projects\images"
20+
$script:clonefolder = "C:\projects\clones"
1721
}

tests/functions/New-PSDCVhdDisk.Tests.ps1

Lines changed: 0 additions & 39 deletions
This file was deleted.

tests/pester.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ foreach ($file in (Get-ChildItem "$PSScriptRoot\general" -Filter "*.Tests.ps1"))
4444
}
4545
}
4646

47-
Write-PSFMessage -Level Important -Message "Proceeding with individual tests"
47+
<# Write-PSFMessage -Level Important -Message "Proceeding with individual tests"
4848
foreach ($file in (Get-ChildItem "$PSScriptRoot\functions" -Recurse -File -Filter "*Tests.ps1"))
4949
{
5050
Write-PSFMessage -Level Significant -Message " Executing $($file.Name)"
@@ -64,7 +64,7 @@ foreach ($file in (Get-ChildItem "$PSScriptRoot\functions" -Recurse -File -Filte
6464
}
6565
}
6666
}
67-
}
67+
} #>
6868

6969
$testresults | Sort-Object Describe, Context, Name, Result, Message | Format-List
7070

tests/vsts/preparation.ps1

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
Add-AppveyorTest -Name "appveyor.prep" -Framework NUnit -FileName "appveyor.prep.ps1" -Outcome Running
2+
$sw = [system.diagnostics.stopwatch]::startNew()
3+
4+
# Importing constants
5+
$rootPath = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
6+
. "$rootPath\tests\constants.ps1"
7+
8+
# Get PSScriptAnalyzer (to check warnings)
9+
Write-Host -Object "appveyor.prep: Install PSScriptAnalyzer" -ForegroundColor DarkGreen
10+
Install-Module -Name PSScriptAnalyzer -Force -SkipPublisherCheck | Out-Null
11+
12+
# Get Pester (to run tests)
13+
Write-Host -Object "appveyor.prep: Install Pester" -ForegroundColor DarkGreen
14+
choco install pester | Out-Null
15+
16+
# Get dbatools
17+
Write-Host -Object "appveyor.prep: Install dbatools" -ForegroundColor DarkGreen
18+
Install-Module -Name dbatools | Out-Null
19+
20+
# Get PSFramework
21+
Write-Host -Object "appveyor.prep: Install PSFramework" -ForegroundColor DarkGreen
22+
Install-Module -Name PSFramework | Out-Null
23+
24+
# Get Hyper-V-PowerShell
25+
#Write-Host -Object "appveyor.prep: Install Hyper-V-PowerShell" -ForegroundColor DarkGreen
26+
#Install-WindowsFeature -Name Hyper-V-PowerShell | Out-Null
27+
#Install-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature | Out-Null
28+
29+
# Creating config files
30+
Write-Host -Object "appveyor.prep: Creating configurations files" -ForegroundColor DarkGreen
31+
$configPath = "C:\projects\config"
32+
33+
$null = New-Item -Path "$configPath\hosts.json" -Force:$Force
34+
$null = New-Item -Path "$configPath\images.json" -Force:$Force
35+
$null = New-Item -Path "$configPath\clones.json" -Force:$Force
36+
37+
# Creating folder
38+
Write-Host -Object "appveyor.prep: Creating image and clone directories" -ForegroundColor DarkGreen
39+
$imageFolder = "C:\projects\images"
40+
$null = New-Item -Path $imageFolder -ItemType Directory -Force:$Force
41+
42+
$cloneFolder = "C:\projects\clones"
43+
$null = New-Item -Path $cloneFolder -ItemType Directory -Force:$Force
44+
45+
# Setting configurations
46+
Write-Host -Object "appveyor.prep: Setting configurations" -ForegroundColor DarkGreen
47+
Set-PSFConfig -Module PSDatabaseClone -Name setup.status -Value $true -Validation bool
48+
Set-PSFConfig -Module PSDatabaseClone -Name informationstore.mode -Value 'File'
49+
Set-PSFConfig -Module PSDatabaseClone -Name informationstore.path -Value "$configPath" -Validation string
50+
51+
# Registering configurations
52+
Write-Host -Object "appveyor.prep: Registering configurations" -ForegroundColor DarkGreen
53+
Get-PSFConfig -FullName psdatabaseclone.setup.status | Register-PSFConfig -Scope SystemDefault
54+
Get-PSFConfig -FullName psdatabaseclone.informationstore.mode | Register-PSFConfig -Scope SystemDefault
55+
Get-PSFConfig -FullName psdatabaseclone.informationstore.path | Register-PSFConfig -Scope SystemDefault
56+
57+
$sw.Stop()
58+
Update-AppveyorTest -Name "appveyor.prep" -Framework NUnit -FileName "appveyor.prep.ps1" -Outcome Passed -Duration $sw.ElapsedMilliseconds

0 commit comments

Comments
 (0)