Skip to content

Commit

Permalink
Merge pull request #2 from sanderstad/development
Browse files Browse the repository at this point in the history
First stable release module
  • Loading branch information
sanderstad authored Jul 27, 2018
2 parents c7a52e0 + 6094407 commit d489c90
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 43 deletions.
31 changes: 31 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -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'))
3 changes: 2 additions & 1 deletion internal/scripts/preimport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## PSDatabaseClone
<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.
<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.
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 <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.
Expand Down
58 changes: 58 additions & 0 deletions tests/appveyor/preparation.ps1
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions tests/constants.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
39 changes: 0 additions & 39 deletions tests/functions/New-PSDCVhdDisk.Tests.ps1

This file was deleted.

4 changes: 2 additions & 2 deletions tests/pester.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand All @@ -64,7 +64,7 @@ foreach ($file in (Get-ChildItem "$PSScriptRoot\functions" -Recurse -File -Filte
}
}
}
}
} #>

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

Expand Down
58 changes: 58 additions & 0 deletions tests/vsts/preparation.ps1
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d489c90

Please sign in to comment.