Skip to content

Commit

Permalink
Fixing conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
theonlyway committed Aug 9, 2016
2 parents 6ed91e6 + fb658a3 commit b5b758e
Show file tree
Hide file tree
Showing 6 changed files with 221 additions and 0 deletions.
Binary file modified DSCResources/xDSCSEPVIE/xDSCSEPVIE.psm1
Binary file not shown.
21 changes: 21 additions & 0 deletions LICENSE.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Anthony Waye

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Builds
|Master | Development |
|:------:|:------:|:-------:|:-------:|
[![Build status](https://ci.appveyor.com/api/projects/status/i6plr1mrpa1pl6xx/branch/master?svg=true)](https://ci.appveyor.com/project/theonlyway/xdscsepvie/branch/master)|[![Build status](https://ci.appveyor.com/api/projects/status/i6plr1mrpa1pl6xx?svg=true)](https://ci.appveyor.com/project/theonlyway/xdscsepvie)|

# xDSCSEPVIE #

## Overview ##
Expand Down
114 changes: 114 additions & 0 deletions Tests/xDSCSEPVIE.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
Import-Module -Name .\DSCResources\xDSCSEPVIE\xDSCSEPVIE.psm1

$Global:DSCModuleName = 'xDSCSEPVIE'
$Global:DSCResourceName = 'xDSCSEPVIE'

InModuleScope -ModuleName xDSCSEPVIE -ScriptBlock {
$VIELocation = 'C:\Temp\doesntmatter.exe'

$global:mockedVolume = [pscustomobject] @{
FileSystemLabel = 'myLabel'
DriveLetter = 'C'
DriveType = 'Fixed'
}
$global:mockedCSV = @()
$global:mockedCSV += [pscustomobject] @{
DriveLetter = 'C'
DateScanned = (Get-Date -Format dd/MM/yyyy)
}
$global:mockedCSV += [pscustomobject] @{
DriveLetter = 'GG'
DateScanned = (Get-Date -Format dd/MM/yyyy)
}

Describe -Name 'Testing if functions return correct objects' -Fixture {
Mock -CommandName Import-CSV -MockWith {
$global:mockedCSV
}
Mock -CommandName Get-Volume -MockWith {
$global:mockedVolume
}
Mock -CommandName Test-Path -MockWith {
return $true
}
It -name 'Get-TargetResource returns a hashtable' -test {
Get-TargetResource -VIELocation $VIELocation | Should Be 'System.Collections.Hashtable'
}

It -name 'Test-TargetResource returns true or false' -test {
(Test-TargetResource -VIELocation $VIELocation -Ensure Present).GetType() -as [string] | Should Be 'bool'
}
}

Describe -Name "Testing $($Global:DSCResourceName)\Get-TargetResource present/absent logic" -Fixture {
foreach ($drivetest in $global:mockedCSV )
{
if ($drivetest.driveLetter -in $global:mockedVolume.driveLetter)
{
Mock -CommandName Import-CSV -MockWith {
$drivetest
}
Mock -CommandName Get-Volume -MockWith {
$global:mockedVolume
}
Mock -CommandName Test-Path -MockWith {
return $true
}
It -name "Get-TargetResource should return present for drive letter ($($drivetest.driveletter))" -test {
(Get-TargetResource -VIELocation $VIELocation).Values | Should Be 'Present'
}
}
else
{
Mock -CommandName Import-CSV -MockWith {
$drivetest
}
Mock -CommandName Get-Volume -MockWith {
$global:mockedVolume
}
Mock -CommandName Test-Path -MockWith {
return $true
}
It -name "Get-TargetResource should return absent for drive letter ($($drivetest.driveletter))" -test {
(Get-TargetResource -VIELocation $VIELocation).Values | Should Be 'absent'
}
}
}
}

Describe -Name "Testing $($Global:DSCResourceName)\Get-TargetResource present/absent logic" -Fixture {
foreach ($drivetest in $global:mockedCSV )
{
if ($drivetest.driveLetter -in $global:mockedVolume.driveLetter)
{
Mock -CommandName Import-CSV -MockWith {
$drivetest
}
Mock -CommandName Get-Volume -MockWith {
$global:mockedVolume
}
Mock -CommandName Test-Path -MockWith {
return $true
}
It -name "Test-TargetResource should return true for drive letter ($($drivetest.driveletter))" -test {
Test-TargetResource -VIELocation $VIELocation -Ensure Present | Should Be 'True'
}
}
else
{
Mock -CommandName Import-CSV -MockWith {
$drivetest
}
Mock -CommandName Get-Volume -MockWith {
$global:mockedVolume
}
Mock -CommandName Test-Path -MockWith {
return $true
}
It -name "Test-TargetResource should return false for drive letter ($($drivetest.driveletter))" -test {
Test-TargetResource -VIELocation $VIELocation -Ensure Absent | Should Be 'True'
}
}
}
}
}
81 changes: 81 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# See http://www.appveyor.com/docs/appveyor-yml for many more options

# Skip on updates to the readme.
# We can force this by adding [skip ci] or [ci skip] anywhere in commit message

skip_commits:
message: /updated readme.*|update readme.*s/

#---------------------------------#
# environment configuration #
#---------------------------------#
version: '2.6.{build}'
os: WMF 5
pull_requests:
do_not_increment_build_number: true
environment:
my_secvariable:
secure: exKd6wdRVbZTS5qJV/Lkvr/NcaVHK6paUkVAjTWyT4AAlcB7pMLOi9gZfscByrA7
install:
- ps: |
$VerbosePreference = 'SilentlyContinue'
$env:psmodulepath = $env:psmodulepath + ';' + 'C:\projects'
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name Pester -Repository PSGallery -Force
#---------------------------------#
# build configuration #
#---------------------------------#

build: false

#---------------------------------#
# test configuration #
#---------------------------------#

test_script:
- ps: $res = Invoke-Pester -Path '.\Tests' -OutputFormat NUnitXml -OutputFile TestsResults.xml -PassThru
- ps: (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestsResults.xml))
- ps: if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed."}


#---------------------------------#
# deployment configuration #
#---------------------------------#

# scripts to run before deployment
deploy_script:
- ps: |
Write-Verbose -Message 'Creating project artifact' -Verbose
$stagingDirectory = (Resolve-Path -Path ..).Path
$manifest = Join-Path -Path $pwd -ChildPath '*.psd1' -Resolve
(Get-Content $manifest -Raw).Replace('2.6', $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest
$zipFilePath = Join-Path -Path $stagingDirectory -ChildPath "$env:APPVEYOR_PROJECT_NAME-$env:APPVEYOR_BUILD_VERSION.zip"
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFilePath)
@(
# You can add other artifacts here
$zipFilePath
) | ForEach-Object -Process {
Write-Verbose -Message "Pushing package $_ as Appveyor artifact" -Verbose
Push-AppveyorArtifact $_
}
if($Env:APPVEYOR_REPO_TAG -eq 'true')
{
if(Get-Command -Name Get-PackageProvider -ErrorAction SilentlyContinue)
{
Get-PackageProvider -Name NuGet -ForceBootstrap
$module = Join-Path -Path $pwd -ChildPath '\DSCResources\*\*.psm1' -Resolve
Import-Module $module
Publish-Module -Name $env:APPVEYOR_PROJECT_NAME -NuGetApiKey $env:my_secvariable
}
else
{
Write-Verbose -Message 'PSGallery not supported' -Verbose
}
}
else
{
Write-Verbose -Message 'Commit is not a tag, skipping deploy!' -Verbose
}
Binary file modified xDSCSEPVIE.psd1
Binary file not shown.

0 comments on commit b5b758e

Please sign in to comment.