From aef82de1490b504d449ce1a2703d10bf6892ab81 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 09:57:22 +0200 Subject: [PATCH 01/46] test Pester5 file --- src/Certificate/New-CSCertAttribute.Tests.ps1 | 22 +++++++++++++++++++ .../50_New-CSCertAttribute.Tests.ps1 | 7 ------ 2 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 src/Certificate/New-CSCertAttribute.Tests.ps1 delete mode 100644 tests/Certificate/50_New-CSCertAttribute.Tests.ps1 diff --git a/src/Certificate/New-CSCertAttribute.Tests.ps1 b/src/Certificate/New-CSCertAttribute.Tests.ps1 new file mode 100644 index 0000000..dbd77a3 --- /dev/null +++ b/src/Certificate/New-CSCertAttribute.Tests.ps1 @@ -0,0 +1,22 @@ +BeforeAll { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Import-Module $ManifestFile -Force +} + +Describe "New-CSCertAttribute" { + Context "Basis Tests" { + It "TShould not throw" { + { + $AttribParams = @{ + Country = 'DE' + State = 'BW' + City = 'KA' + Organization = 'IT' + OrganizationalUnitName = '' + CommonName = 'MyCert' + } + New-CSCertAttribute @AttribParams + } | Should -Not -Throw + } + } +} diff --git a/tests/Certificate/50_New-CSCertAttribute.Tests.ps1 b/tests/Certificate/50_New-CSCertAttribute.Tests.ps1 deleted file mode 100644 index e6f5cb4..0000000 --- a/tests/Certificate/50_New-CSCertAttribute.Tests.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -Describe "New-CSCertAttribute" { - Context "Basis Tests" { - It "Test1: Should not throw " { - { New-CSCertAttribute -Country 'DE' -State 'BW' -City 'KA' -Organization 'IT' -OrganizationalUnitName'' -CommonName 'Mycert' } | Should -Not -Throw - } - } -} -- 2.45.2 From a4fa937780c9c80eed8cd0d3311dfd9ccc8f0c62 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 09:59:46 +0200 Subject: [PATCH 02/46] fix typo --- src/Certificate/New-CSCertAttribute.Tests.ps1 | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Certificate/New-CSCertAttribute.Tests.ps1 b/src/Certificate/New-CSCertAttribute.Tests.ps1 index dbd77a3..9bce109 100644 --- a/src/Certificate/New-CSCertAttribute.Tests.ps1 +++ b/src/Certificate/New-CSCertAttribute.Tests.ps1 @@ -5,18 +5,16 @@ BeforeAll { Describe "New-CSCertAttribute" { Context "Basis Tests" { - It "TShould not throw" { - { - $AttribParams = @{ - Country = 'DE' - State = 'BW' - City = 'KA' - Organization = 'IT' - OrganizationalUnitName = '' - CommonName = 'MyCert' - } - New-CSCertAttribute @AttribParams - } | Should -Not -Throw + It "Should not throw" { + $AttribParams = @{ + Country = 'DE' + State = 'BW' + City = 'KA' + Organization = 'IT' + OrganizationalUnitName = '' + CommonName = 'MyCert' + } + { New-CSCertAttribute @AttribParams } | Should -Not -Throw } } } -- 2.45.2 From 8b456186370f572d3657269d06ecfc8dec6591b1 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 10:03:20 +0200 Subject: [PATCH 03/46] debug --- src/Certificate/New-CSCertAttribute.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Certificate/New-CSCertAttribute.Tests.ps1 b/src/Certificate/New-CSCertAttribute.Tests.ps1 index 9bce109..db7a805 100644 --- a/src/Certificate/New-CSCertAttribute.Tests.ps1 +++ b/src/Certificate/New-CSCertAttribute.Tests.ps1 @@ -11,7 +11,7 @@ Describe "New-CSCertAttribute" { State = 'BW' City = 'KA' Organization = 'IT' - OrganizationalUnitName = '' + OrganizationalUnitName = 'foo' CommonName = 'MyCert' } { New-CSCertAttribute @AttribParams } | Should -Not -Throw -- 2.45.2 From b496eaaa9d71d7d6dba1f1dcb56bdc40fc08daef Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 10:19:27 +0200 Subject: [PATCH 04/46] add workaround for psscript analyzer object reference error --- tools/DroneIO.psm1 | 61 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/tools/DroneIO.psm1 b/tools/DroneIO.psm1 index 4a3dd85..de8ee71 100644 --- a/tools/DroneIO.psm1 +++ b/tools/DroneIO.psm1 @@ -80,6 +80,35 @@ function Invoke-InstallDependencies { } } + +function Start-PSScriptAnalyzer { + [CmdletBinding()] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSUseShouldProcessForStateChangingFunctions', + '', + Justification = 'justification' + )] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSProvideCommentHelp', + '', + Justification = 'internal function' + )] + param () + + process { + $AnalyzerSettings = @{ + Path = './src/' + Recurse = $true + Settings = './tools/PSScriptAnalyzerSettings.psd1' + ReportSummary = $true + ErrorAction = 'Stop' + } + $AnalyzerResults = Invoke-ScriptAnalyzer @AnalyzerSettings + if ( $AnalyzerResults ) { + Write-Output -InputObject $AnalyzerSettings + } + } +} function Invoke-Linter { [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute( @@ -90,16 +119,20 @@ function Invoke-Linter { param () process { - Import-Module -Name PSScriptAnalyzer - $AnalyzerSettings = @{ - Path = './src/' - Recurse = $true - Settings = './tools/PSScriptAnalyzerSettings.psd1' - ReportSummary = $true - ErrorAction = 'Stop' - } try { - $AnalyzerResults = Invoke-ScriptAnalyzer @AnalyzerSettings + $AnalyzerResults = Start-PSScriptAnalyzer + } + catch { + Write-Debug -Message $_.Exception.Message -Debug + if ($_.Exception.Message -match 'Object reference not set') { + Write-Debug -Message 'ReRun PSScriptAnalyzer' -Debug + $AnalyzerResults = Start-PSScriptAnalyzer + } + else { + Write-Error -Message 'PSScriptAnalyzer failer' + } + } + finally { if ( $AnalyzerResults ) { $AnalyzerResults | Sort-Object -Property @( "ScriptName", @@ -113,10 +146,6 @@ function Invoke-Linter { ) -AutoSize | Out-String | Write-Verbose -Verbose } } - catch { - Write-Debug -Message $_.Exception.Message -Debug - Write-Error -Message 'PSScriptAnalyzer failer' - } } } @@ -171,6 +200,12 @@ function Invoke-UnitTest { $PesterConf.Filter.ExcludeTag = $ExcludeTag } $TestResults = Invoke-Pester -Configuration $PesterConf -ErrorAction 'Stop' + + if ($TestResults.FailedCount -gt 0) { + Write-FailureStateFile -StepName 'Pester' + throw ('{0} tests failed!' -f $TestResults.FailedCount) + } + if ($PassThru.IsPresent) { Write-Output -InputObject $TestResults } -- 2.45.2 From 2f554c13d58b5b03ecf8f6a239f18bcd83886443 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 10:21:38 +0200 Subject: [PATCH 05/46] fix typo in output var --- tools/DroneIO.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/DroneIO.psm1 b/tools/DroneIO.psm1 index de8ee71..74cdb73 100644 --- a/tools/DroneIO.psm1 +++ b/tools/DroneIO.psm1 @@ -105,7 +105,7 @@ function Start-PSScriptAnalyzer { } $AnalyzerResults = Invoke-ScriptAnalyzer @AnalyzerSettings if ( $AnalyzerResults ) { - Write-Output -InputObject $AnalyzerSettings + Write-Output -InputObject $AnalyzerResults } } } -- 2.45.2 From ac0431ea178a7502640acfa82cd5d75e22f427db Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 10:24:12 +0200 Subject: [PATCH 06/46] wip --- src/PSModule.Tests.ps1 | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/PSModule.Tests.ps1 b/src/PSModule.Tests.ps1 index 2338087..34dc6e4 100644 --- a/src/PSModule.Tests.ps1 +++ b/src/PSModule.Tests.ps1 @@ -1,14 +1,12 @@ Describe 'Test module meta' { - It 'Test manifest file' { - $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName - Test-ModuleManifest -Path $ManifestFile | Should -Be $true + Context 'Default tests' -Tag 'Default' { + It 'Test manifest file' { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Test-ModuleManifest -Path $ManifestFile | Should -Be $true + } + It 'Import Module' { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + { Import-Module $ManifestFile } | Should -Not -Throw + } } - It 'Import Module' { - $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName - { Import-Module $ManifestFile } | Should -Not -Throw - } - # Dummy test to force pester error - #It 'Force Pester Error' { - # $true | Should -BeFalse - #} } -- 2.45.2 From 5b4d043c7d8f6038bdeaeb7c2f03c540c294368b Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 10:32:25 +0200 Subject: [PATCH 07/46] wip --- src/ModuleRoot.psm1 | 11 +++++++++++ src/PSCredentialStore.psd1 | 2 +- src/PSCredentialStore.psm1 | 16 ---------------- 3 files changed, 12 insertions(+), 17 deletions(-) create mode 100644 src/ModuleRoot.psm1 delete mode 100644 src/PSCredentialStore.psm1 diff --git a/src/ModuleRoot.psm1 b/src/ModuleRoot.psm1 new file mode 100644 index 0000000..abeede9 --- /dev/null +++ b/src/ModuleRoot.psm1 @@ -0,0 +1,11 @@ +#region module-definition + +#endregion module-definition +Set-Variable -Name "CSVersion" -Value "2.0.0" -Option Constant -Scope 'Script' -ErrorAction Stop + +# Get all child items in the Script path and exclude the Deploy script (if present.) +$Functions = Get-ChildItem -Path $PSScriptRoot\*.ps1 -Recurse | Where-Object { $_.BaseName -notmatch '.Tests' } + +foreach ($Item in $Functions) { + . $Item.FullName +} diff --git a/src/PSCredentialStore.psd1 b/src/PSCredentialStore.psd1 index 6947b23..d2f11b7 100644 --- a/src/PSCredentialStore.psd1 +++ b/src/PSCredentialStore.psd1 @@ -1,7 +1,7 @@ @{ # Script module or binary module file associated with this manifest. - RootModule = 'PSCredentialStore.psm1' + RootModule = 'ModuleRoot.psm1' # Version number of this module. ModuleVersion = '0.0.9999' diff --git a/src/PSCredentialStore.psm1 b/src/PSCredentialStore.psm1 deleted file mode 100644 index 978d81d..0000000 --- a/src/PSCredentialStore.psm1 +++ /dev/null @@ -1,16 +0,0 @@ -#region module-definition - -#endregion module-definition -Set-Variable -Name "CSVersion" -Value "2.0.0" -Option Constant -Scope 'Script' -ErrorAction Stop - -#region dot-sourcing -# dot-sourcing all module functions. The export is handled via manifest file. - -$Items = (Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath '*.ps1') -Recurse ).FullName | Where-Object { - $_ -notmatch "(Classes|Init)" -} -foreach ($Item in $Items) { - # Write-Verbose ("dot sourcing file {0}" -f $Item) - . $Item -} -#endregion dot-sourcing -- 2.45.2 From 166efda770c8a88a4de1214127b74c52ef4f9d75 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 10:38:41 +0200 Subject: [PATCH 08/46] stop on error --- .drone.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.drone.yml b/.drone.yml index c042402..4465d46 100644 --- a/.drone.yml +++ b/.drone.yml @@ -22,6 +22,7 @@ steps: commands: - | pwsh -NonInteractive -c "& { + $ErrorActionPreference = 'Stop'; Import-Module './tools/DroneIO.psm1'; Invoke-InstallDependencies; Invoke-Linter @@ -32,6 +33,7 @@ steps: commands: - | pwsh -NonInteractive -c "& { + $ErrorActionPreference = 'Stop'; Import-Module './tools/DroneIO.psm1'; Invoke-InstallDependencies; Invoke-UnitTest -Verbosity 'Detailed' -- 2.45.2 From c3ac2d2fc9a865c33fd7caf62e9ab32872b59264 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 10:41:32 +0200 Subject: [PATCH 09/46] wip --- .drone.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 4465d46..1a870db 100644 --- a/.drone.yml +++ b/.drone.yml @@ -22,10 +22,9 @@ steps: commands: - | pwsh -NonInteractive -c "& { - $ErrorActionPreference = 'Stop'; Import-Module './tools/DroneIO.psm1'; Invoke-InstallDependencies; - Invoke-Linter + Invoke-Linter -ErrorAction 'Stop' }" - name: UnitTests @@ -33,10 +32,9 @@ steps: commands: - | pwsh -NonInteractive -c "& { - $ErrorActionPreference = 'Stop'; Import-Module './tools/DroneIO.psm1'; Invoke-InstallDependencies; - Invoke-UnitTest -Verbosity 'Detailed' + Invoke-UnitTest -Verbosity 'Detailed' -ErrorAction 'Stop' }" - name: coverage -- 2.45.2 From eb791af722549e9bc13dcf67cb3f20e1db26b9ad Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 10:44:52 +0200 Subject: [PATCH 10/46] wip --- src/Certificate/New-CSCertAttribute.Tests.ps1 | 2 +- src/Certificate/New-CSCertificate.Tests.ps1 | 25 +++++++++++++++++++ .../51_New-CSCertificate.Tests.ps1 | 15 ----------- 3 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 src/Certificate/New-CSCertificate.Tests.ps1 delete mode 100644 tests/Certificate/51_New-CSCertificate.Tests.ps1 diff --git a/src/Certificate/New-CSCertAttribute.Tests.ps1 b/src/Certificate/New-CSCertAttribute.Tests.ps1 index db7a805..50a966a 100644 --- a/src/Certificate/New-CSCertAttribute.Tests.ps1 +++ b/src/Certificate/New-CSCertAttribute.Tests.ps1 @@ -4,7 +4,7 @@ BeforeAll { } Describe "New-CSCertAttribute" { - Context "Basis Tests" { + Context "Basis Tests" -Tag 'Unit' { It "Should not throw" { $AttribParams = @{ Country = 'DE' diff --git a/src/Certificate/New-CSCertificate.Tests.ps1 b/src/Certificate/New-CSCertificate.Tests.ps1 new file mode 100644 index 0000000..c02d0c9 --- /dev/null +++ b/src/Certificate/New-CSCertificate.Tests.ps1 @@ -0,0 +1,25 @@ +BeforeAll { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Import-Module $ManifestFile -Force +} + +Describe "New-CSCertificate" { + Context "Basic Tests" -Tag 'Unit' { + It "Should not throw" { + $attribs = @{ + Country = 'DE' + State = 'BW' + City = 'KA' + Organization = 'IT' + OrganizationalUnitName = 'foo' + CommonName = 'MyCert' + } + $CertAttribs = @{ + CRTAttribute = $attribs + KeyName = Join-Path -Path (Get-TempDir) -ChildPath '/foo.key' + CertName = Join-Path -Path (Get-TempDir) -ChildPath '/cert.pfx' + } + { New-CSCertificate @CertAttribs } | Should -Not -Throw + } + } +} diff --git a/tests/Certificate/51_New-CSCertificate.Tests.ps1 b/tests/Certificate/51_New-CSCertificate.Tests.ps1 deleted file mode 100644 index aac7f74..0000000 --- a/tests/Certificate/51_New-CSCertificate.Tests.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -Describe "New-CSCertificate" { - Context "Basic Tests" { - It "Test1: Should not throw" { - - $attribs = New-CSCertAttribute -Country 'DE' -State 'BW' -City 'KA' -Organization 'IT' -OrganizationalUnitName'' -CommonName 'Mycert' - - $CertAttribs = @{ - CRTAttribute = $attribs - KeyName = Join-Path -Path (Get-TempDir) -ChildPath '/foo.key' - CertName = Join-Path -Path (Get-TempDir) -ChildPath '/cert.pfx' - } - { New-CSCertificate @CertAttribs } | Should -Not -Throw - } - } -} -- 2.45.2 From f8cb6f90bbb6230dc4b5031c95992fb6fcf56039 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 10:49:28 +0200 Subject: [PATCH 11/46] wip --- tools/DroneIO.psm1 | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/DroneIO.psm1 b/tools/DroneIO.psm1 index 74cdb73..e763aeb 100644 --- a/tools/DroneIO.psm1 +++ b/tools/DroneIO.psm1 @@ -202,7 +202,6 @@ function Invoke-UnitTest { $TestResults = Invoke-Pester -Configuration $PesterConf -ErrorAction 'Stop' if ($TestResults.FailedCount -gt 0) { - Write-FailureStateFile -StepName 'Pester' throw ('{0} tests failed!' -f $TestResults.FailedCount) } -- 2.45.2 From 981068d0d4ffb79133510e5e2735219334ee7cb8 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 10:52:10 +0200 Subject: [PATCH 12/46] wip --- .drone.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.drone.yml b/.drone.yml index 1a870db..0d5dc6d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -19,6 +19,7 @@ steps: - name: LintTests image: mcr.microsoft.com/powershell:latest + failure: ignore commands: - | pwsh -NonInteractive -c "& { @@ -29,6 +30,7 @@ steps: - name: UnitTests image: mcr.microsoft.com/powershell:latest + failure: ignore commands: - | pwsh -NonInteractive -c "& { -- 2.45.2 From a845c0485159f5688dde034ade762053799bccee Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 10:54:44 +0200 Subject: [PATCH 13/46] wip --- tools/DroneIO.psm1 | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/DroneIO.psm1 b/tools/DroneIO.psm1 index e763aeb..b201ff4 100644 --- a/tools/DroneIO.psm1 +++ b/tools/DroneIO.psm1 @@ -144,6 +144,7 @@ function Invoke-Linter { "RuleName", "Message" ) -AutoSize | Out-String | Write-Verbose -Verbose + throw 'PS Script Analyzer failed!' } } } -- 2.45.2 From e9529bd281e1253971fe6fe7914d5833c452ec05 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 11:05:19 +0200 Subject: [PATCH 14/46] wip --- src/Certificate/New-CSCertificate.Tests.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Certificate/New-CSCertificate.Tests.ps1 b/src/Certificate/New-CSCertificate.Tests.ps1 index c02d0c9..d42d514 100644 --- a/src/Certificate/New-CSCertificate.Tests.ps1 +++ b/src/Certificate/New-CSCertificate.Tests.ps1 @@ -1,6 +1,14 @@ BeforeAll { $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName Import-Module $ManifestFile -Force + + $PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object { + $_.BaseName -notmatch '.Tests' + } + ).FullName + foreach ( $func in $PrivateFunctions) { + . $func + } } Describe "New-CSCertificate" { -- 2.45.2 From b9ebc2ab6e3571df3ce247b0c19d1fa20bf578f4 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 11:19:57 +0200 Subject: [PATCH 15/46] wip --- src/Certificate/New-CSCertificate.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Certificate/New-CSCertificate.Tests.ps1 b/src/Certificate/New-CSCertificate.Tests.ps1 index d42d514..250612f 100644 --- a/src/Certificate/New-CSCertificate.Tests.ps1 +++ b/src/Certificate/New-CSCertificate.Tests.ps1 @@ -23,7 +23,7 @@ Describe "New-CSCertificate" { CommonName = 'MyCert' } $CertAttribs = @{ - CRTAttribute = $attribs + CRTAttribute = New-CSCertAttribute @attribs KeyName = Join-Path -Path (Get-TempDir) -ChildPath '/foo.key' CertName = Join-Path -Path (Get-TempDir) -ChildPath '/cert.pfx' } -- 2.45.2 From 8808f1c70b8a86513ebab77858884160904bbab7 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 11:24:31 +0200 Subject: [PATCH 16/46] wip --- .../Item/New-CredentialStoreItem.Tests.ps1 | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) rename tests/Item/03_New-CredentialStoreItem.Tests.ps1 => src/Item/New-CredentialStoreItem.Tests.ps1 (89%) diff --git a/tests/Item/03_New-CredentialStoreItem.Tests.ps1 b/src/Item/New-CredentialStoreItem.Tests.ps1 similarity index 89% rename from tests/Item/03_New-CredentialStoreItem.Tests.ps1 rename to src/Item/New-CredentialStoreItem.Tests.ps1 index 56ce83b..166b831 100644 --- a/tests/Item/03_New-CredentialStoreItem.Tests.ps1 +++ b/src/Item/New-CredentialStoreItem.Tests.ps1 @@ -1,6 +1,19 @@ +BeforeAll { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Import-Module $ManifestFile -Force + + $PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object { + $_.BaseName -notmatch '.Tests' + } + ).FullName + foreach ( $func in $PrivateFunctions) { + . $func + } +} + Describe "New-CredentialStoreItem" { Context "Private Credential Store tests" { - It "Test1: Add entry to existing private store." { + It "Add entry to existing private store." { # Creat a fresh CredentialStore first New-CredentialStore -Force @@ -20,7 +33,7 @@ Describe "New-CredentialStoreItem" { } } Context "Test with new shared Credential Store" { - It "Test2: Create new RemoteHost entry" { + It "Create new RemoteHost entry" { # prepare test environment $tmpCS = Join-Path -Path (Get-TempDir) -ChildPath '/CredentialStore.json' New-CredentialStore -Shared -Path $tmpCS -Force @@ -48,7 +61,6 @@ Describe "New-CredentialStoreItem" { } } Context "Test optional parameter lookup" { - It "Test missing Credential" { function global:Get-Credential ([string]$Message) { $UserName = 'testuser' @@ -65,7 +77,7 @@ Describe "New-CredentialStoreItem" { } Context "General Exception handling" { - Mock Test-CredentialStore { return $false } + Mock Test-CredentialStore { return $false } -ModuleName 'PSCredentialStore' It "Missing CredentialStore should throw" { { New-CredentialStoreItem -Shared -Path 'C:\missingStore.json' -RemoteHost 'notrelevant' } | Should -Throw "Could not add anything" } -- 2.45.2 From c7529b5d89d2a1a5ba4d134a0e7277eafaec4220 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 11:26:41 +0200 Subject: [PATCH 17/46] wip --- src/Item/New-CredentialStoreItem.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Item/New-CredentialStoreItem.Tests.ps1 b/src/Item/New-CredentialStoreItem.Tests.ps1 index 166b831..dca488a 100644 --- a/src/Item/New-CredentialStoreItem.Tests.ps1 +++ b/src/Item/New-CredentialStoreItem.Tests.ps1 @@ -79,7 +79,7 @@ Describe "New-CredentialStoreItem" { Context "General Exception handling" { Mock Test-CredentialStore { return $false } -ModuleName 'PSCredentialStore' It "Missing CredentialStore should throw" { - { New-CredentialStoreItem -Shared -Path 'C:\missingStore.json' -RemoteHost 'notrelevant' } | Should -Throw "Could not add anything" + { New-CredentialStoreItem -Shared -Path '/tmp/missingStore.json' -RemoteHost 'notrelevant' } | Should -Throw "Could not add anything" } } Context "Testing pipeline paramter" { -- 2.45.2 From 9f9e895e6ed7afc8e5a0f5689a67d0a43a2db16f Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 11:29:38 +0200 Subject: [PATCH 18/46] wip --- src/Item/New-CredentialStoreItem.Tests.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Item/New-CredentialStoreItem.Tests.ps1 b/src/Item/New-CredentialStoreItem.Tests.ps1 index dca488a..2b7a52a 100644 --- a/src/Item/New-CredentialStoreItem.Tests.ps1 +++ b/src/Item/New-CredentialStoreItem.Tests.ps1 @@ -79,14 +79,18 @@ Describe "New-CredentialStoreItem" { Context "General Exception handling" { Mock Test-CredentialStore { return $false } -ModuleName 'PSCredentialStore' It "Missing CredentialStore should throw" { - { New-CredentialStoreItem -Shared -Path '/tmp/missingStore.json' -RemoteHost 'notrelevant' } | Should -Throw "Could not add anything" + { + New-CredentialStoreItem -Shared -Path '/tmp/missingStore.json' -RemoteHost 'notrelevant' + } | Should -Throw "Could not add anything into the given CredentialStore." } } Context "Testing pipeline paramter" { It "Add the item with credential value from pipe" { $UserName = 'pipeUser' $Password = ConvertTo-SecureString -String "pipePasswd" -AsPlainText -Force - { [PSCredential]::new($UserName, $Password) | New-CredentialStoreItem -RemoteHost 'PipeHost' } | Should -Not -Throw + { + [PSCredential]::new($UserName, $Password) | New-CredentialStoreItem -RemoteHost 'PipeHost' + } | Should -Not -Throw } It "Testing written item" { -- 2.45.2 From efcd905277d385d742f9e9432dbbef6fa4565c3f Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 11:41:17 +0200 Subject: [PATCH 19/46] fix linter issues --- src/Item/New-CredentialStoreItem.Tests.ps1 | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Item/New-CredentialStoreItem.Tests.ps1 b/src/Item/New-CredentialStoreItem.Tests.ps1 index 2b7a52a..60627d7 100644 --- a/src/Item/New-CredentialStoreItem.Tests.ps1 +++ b/src/Item/New-CredentialStoreItem.Tests.ps1 @@ -1,3 +1,10 @@ +[Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidUsingConvertToSecureStringWithPlainText', + '', + Justification = 'justification' +)] +param () + BeforeAll { $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName Import-Module $ManifestFile -Force @@ -42,7 +49,9 @@ Describe "New-CredentialStoreItem" { $Password = ConvertTo-SecureString -String "mypasswd" -AsPlainText -Force $mycreds = [PSCredential]::new($UserName, $Password) $RemoteHost = "foobar" - { New-CredentialStoreItem -Shared -Path $tmpCS -RemoteHost $RemoteHost -Credential $mycreds } | Should -Not -Throw + { + New-CredentialStoreItem -Shared -Path $tmpCS -RemoteHost $RemoteHost -Credential $mycreds + } | Should -Not -Throw $tmpCS = Get-Content -Path $tmpCS -Raw | ConvertFrom-Json $res = Get-Member -InputObject $tmpCS -Name $RemoteHost -Membertype Properties $res.Name | Should -Be $RemoteHost @@ -55,7 +64,14 @@ Describe "New-CredentialStoreItem" { $Password = ConvertTo-SecureString -String "mypasswd" -AsPlainText -Force $mycreds = [PSCredential]::new($UserName, $Password) $RemoteHost = "foobar2" - New-CredentialStoreItem -Shared -Path $tmpCS -RemoteHost $RemoteHost -Credential $mycreds -Identifier 'Foo' + $StoreItemParam = @{ + Shared = $true + Path = $tmpCS + RemeHost = $RemoteHost + Credential = $mycreds + identifier = 'Foo' + } + New-CredentialStoreItem @StoreItemParam $writtenItem = Get-CredentialStoreItem -Shared -Path $tmpCS -RemoteHost $RemoteHost -Identifier 'Foo' ($writtenItem.UserName -eq $UserName) -and ($writtenItem.Password.Length -gt 0) | Should -Be $true } -- 2.45.2 From ecd2735ce56b1c8e808251153e7412f07720e725 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 11:42:25 +0200 Subject: [PATCH 20/46] wip --- src/Item/New-CredentialStoreItem.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Item/New-CredentialStoreItem.Tests.ps1 b/src/Item/New-CredentialStoreItem.Tests.ps1 index 60627d7..099476f 100644 --- a/src/Item/New-CredentialStoreItem.Tests.ps1 +++ b/src/Item/New-CredentialStoreItem.Tests.ps1 @@ -67,7 +67,7 @@ Describe "New-CredentialStoreItem" { $StoreItemParam = @{ Shared = $true Path = $tmpCS - RemeHost = $RemoteHost + RemoteHost = $RemoteHost Credential = $mycreds identifier = 'Foo' } -- 2.45.2 From e60ee4cab83805d64c51fc7733dec6c890056d8c Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 11:51:43 +0200 Subject: [PATCH 21/46] wip --- src/Item/New-CredentialStoreItem.Tests.ps1 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Item/New-CredentialStoreItem.Tests.ps1 b/src/Item/New-CredentialStoreItem.Tests.ps1 index 099476f..02d1188 100644 --- a/src/Item/New-CredentialStoreItem.Tests.ps1 +++ b/src/Item/New-CredentialStoreItem.Tests.ps1 @@ -1,7 +1,12 @@ [Diagnostics.CodeAnalysis.SuppressMessageAttribute( 'PSAvoidUsingConvertToSecureStringWithPlainText', '', - Justification = 'justification' + Justification = 'just used in pester tests.' +)] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSProvideCommentHelp', + '', + Justification = 'no need in internal pester helpers.' )] param () @@ -53,7 +58,7 @@ Describe "New-CredentialStoreItem" { New-CredentialStoreItem -Shared -Path $tmpCS -RemoteHost $RemoteHost -Credential $mycreds } | Should -Not -Throw $tmpCS = Get-Content -Path $tmpCS -Raw | ConvertFrom-Json - $res = Get-Member -InputObject $tmpCS -Name $RemoteHost -Membertype Properties + $res = Get-Member -InputObject $tmpCS -Name $RemoteHost -MemberType Properties $res.Name | Should -Be $RemoteHost } It "Adds Item with identifier to shared store" { @@ -65,8 +70,8 @@ Describe "New-CredentialStoreItem" { $mycreds = [PSCredential]::new($UserName, $Password) $RemoteHost = "foobar2" $StoreItemParam = @{ - Shared = $true - Path = $tmpCS + Shared = $true + Path = $tmpCS RemoteHost = $RemoteHost Credential = $mycreds identifier = 'Foo' -- 2.45.2 From ef3fd6d0d691cdb7fcc5033ea29ac998b5d6ad12 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 11:53:39 +0200 Subject: [PATCH 22/46] wip --- src/Private/Test-CSPfxCertificate.Tests.ps1 | 25 +++++++++++++++++++ .../60_Test-CSPfxCertificate.Tests.ps1 | 10 -------- 2 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 src/Private/Test-CSPfxCertificate.Tests.ps1 delete mode 100644 tests/PfxCertificate/60_Test-CSPfxCertificate.Tests.ps1 diff --git a/src/Private/Test-CSPfxCertificate.Tests.ps1 b/src/Private/Test-CSPfxCertificate.Tests.ps1 new file mode 100644 index 0000000..f1405d1 --- /dev/null +++ b/src/Private/Test-CSPfxCertificate.Tests.ps1 @@ -0,0 +1,25 @@ +BeforeAll { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Import-Module $ManifestFile -Force + + $PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object { + $_.BaseName -notmatch '.Tests' + } + ).FullName + foreach ( $func in $PrivateFunctions) { + . $func + } +} + +Describe "Test-CSPfxCertificate" { + Context "Basic Tests" { + It "Should not Throw" { + { + Test-CSPfxCertificate -Thumbprint '12345' -StoreName My -StoreLocation CurrentUser + } | Should -Not -Throw + } + It "Should return false" { + Test-CSPfxCertificate -Thumbprint '12345' -StoreName My -StoreLocation CurrentUser | Should -Be $false + } + } +} diff --git a/tests/PfxCertificate/60_Test-CSPfxCertificate.Tests.ps1 b/tests/PfxCertificate/60_Test-CSPfxCertificate.Tests.ps1 deleted file mode 100644 index 9665cb6..0000000 --- a/tests/PfxCertificate/60_Test-CSPfxCertificate.Tests.ps1 +++ /dev/null @@ -1,10 +0,0 @@ -Describe "Test-CSPfxCertificate" { - Context "Basic Tests" { - It "Should not Throw" { - { Test-CSPfxCertificate -Thumbprint '12345' -StoreName My -StoreLocation CurrentUser } | Should -Not -Throw - } - It "Should return false" { - Test-CSPfxCertificate -Thumbprint '12345' -StoreName My -StoreLocation CurrentUser | Should -Be $false - } - } -} -- 2.45.2 From 90d41aaff3efd8abb29913794f69d888d6198f26 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 12:00:41 +0200 Subject: [PATCH 23/46] wip --- .../Get-DefaultCredentialStorePath.Tests.ps1 | 13 ++++++++++ src/Private/Get-ModuleBase.Tests.ps1 | 20 ++++++++++++++ src/Private/Get-RandomAESKey.Tests.ps1 | 26 +++++++++++++++++++ .../Private/Get-TempDir.Tests.ps1 | 21 +++++++++++++-- .../Private/Resolve-Dependency.Tests.ps1 | 25 +++++++++++++----- .../Private/Test-Module.Tests.ps1 | 15 ++++++++++- tests/Private/01_Get-ModuleBase.Tests.ps1 | 7 ----- tests/Private/01_Get-RandomAESKey.Tests.ps1 | 13 ---------- 8 files changed, 111 insertions(+), 29 deletions(-) rename tests/Private/01_Get-DefaultCredentialStorePath.Tests.ps1 => src/Private/Get-DefaultCredentialStorePath.Tests.ps1 (83%) create mode 100644 src/Private/Get-ModuleBase.Tests.ps1 create mode 100644 src/Private/Get-RandomAESKey.Tests.ps1 rename tests/Private/01_Get-TempDir.Tests.ps1 => src/Private/Get-TempDir.Tests.ps1 (54%) rename tests/Private/01_Resolve-Dependency.Tests.ps1 => src/Private/Resolve-Dependency.Tests.ps1 (57%) rename tests/Private/01_Test-Module.Tests.ps1 => src/Private/Test-Module.Tests.ps1 (68%) delete mode 100644 tests/Private/01_Get-ModuleBase.Tests.ps1 delete mode 100644 tests/Private/01_Get-RandomAESKey.Tests.ps1 diff --git a/tests/Private/01_Get-DefaultCredentialStorePath.Tests.ps1 b/src/Private/Get-DefaultCredentialStorePath.Tests.ps1 similarity index 83% rename from tests/Private/01_Get-DefaultCredentialStorePath.Tests.ps1 rename to src/Private/Get-DefaultCredentialStorePath.Tests.ps1 index ac4b6dc..ee892fe 100644 --- a/tests/Private/01_Get-DefaultCredentialStorePath.Tests.ps1 +++ b/src/Private/Get-DefaultCredentialStorePath.Tests.ps1 @@ -1,3 +1,16 @@ +BeforeAll { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Import-Module $ManifestFile -Force + + $PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object { + $_.BaseName -notmatch '.Tests' + } + ).FullName + foreach ( $func in $PrivateFunctions) { + . $func + } +} + Describe "Get-DefaultCredentialStorePath" { Context "Basic syntax test" { It "Test1: Should not throw" { diff --git a/src/Private/Get-ModuleBase.Tests.ps1 b/src/Private/Get-ModuleBase.Tests.ps1 new file mode 100644 index 0000000..73f9c53 --- /dev/null +++ b/src/Private/Get-ModuleBase.Tests.ps1 @@ -0,0 +1,20 @@ +BeforeAll { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Import-Module $ManifestFile -Force + + $PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object { + $_.BaseName -notmatch '.Tests' + } + ).FullName + foreach ( $func in $PrivateFunctions) { + . $func + } +} + +Describe "Get-ModuleBase" { + Context "Basic syntax check" { + It "Test1: Should not throw" { + { Get-ModuleBase } | Should -Not -Throw + } + } +} diff --git a/src/Private/Get-RandomAESKey.Tests.ps1 b/src/Private/Get-RandomAESKey.Tests.ps1 new file mode 100644 index 0000000..21b6046 --- /dev/null +++ b/src/Private/Get-RandomAESKey.Tests.ps1 @@ -0,0 +1,26 @@ +BeforeAll { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Import-Module $ManifestFile -Force + + $PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object { + $_.BaseName -notmatch '.Tests' + } + ).FullName + foreach ( $func in $PrivateFunctions) { + . $func + } +} + +Describe "Get-RandomKey" { + Context "Basic input tests" { + It "Test1: Should not throw " { + { Get-RandomAESKey } | Should -Not -Throw + } + } + Context "Basic syntax check" { + It "Test2: Should return a key with a length of 32 bytes" { + $Key = Get-RandomAESKey + $Key.length | Should -Be 32 + } + } +} diff --git a/tests/Private/01_Get-TempDir.Tests.ps1 b/src/Private/Get-TempDir.Tests.ps1 similarity index 54% rename from tests/Private/01_Get-TempDir.Tests.ps1 rename to src/Private/Get-TempDir.Tests.ps1 index 34a3d5e..336471b 100644 --- a/tests/Private/01_Get-TempDir.Tests.ps1 +++ b/src/Private/Get-TempDir.Tests.ps1 @@ -1,7 +1,20 @@ +BeforeAll { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Import-Module $ManifestFile -Force + + $PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object { + $_.BaseName -notmatch '.Tests' + } + ).FullName + foreach ( $func in $PrivateFunctions) { + . $func + } +} + Describe "Get-TempDir" { Context "Basic tests" { It "Should not throw" { - {Get-TempDir} | Should -Not -Throw + { Get-TempDir } | Should -Not -Throw } It "Should return the correct os tmp path" { $Path = Get-TempDir @@ -17,7 +30,11 @@ Describe "Get-TempDir" { } } if ($Env:APPVEYOR) { - if (($isWindows) -or ($PSVersionTable.PSVersion.Major -lt 6) -or ($PSVersionTable.PSEdition -eq 'Desktop')) { + if ( + ($isWindows) -or + ($PSVersionTable.PSVersion.Major -lt 6) -or + ($PSVersionTable.PSEdition -eq 'Desktop') + ) { $RefPath = (Resolve-Path -Path $env:TEMP).Path $Path | Should -Be $RefPath } diff --git a/tests/Private/01_Resolve-Dependency.Tests.ps1 b/src/Private/Resolve-Dependency.Tests.ps1 similarity index 57% rename from tests/Private/01_Resolve-Dependency.Tests.ps1 rename to src/Private/Resolve-Dependency.Tests.ps1 index 755ce9a..380a259 100644 --- a/tests/Private/01_Resolve-Dependency.Tests.ps1 +++ b/src/Private/Resolve-Dependency.Tests.ps1 @@ -1,7 +1,20 @@ +BeforeAll { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Import-Module $ManifestFile -Force + + $PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object { + $_.BaseName -notmatch '.Tests' + } + ).FullName + foreach ( $func in $PrivateFunctions) { + . $func + } +} + Describe "Resolve-Dependency" { Context "Basic syntax check" { - Mock Get-ModuleBase {return (Join-Path -Path $PWD -ChildPath '/resources')} - Mock Test-Module {return $true} + Mock Get-ModuleBase { return (Join-Path -Path $PWD -ChildPath '/resources') } + Mock Test-Module { return $true } It "Test1: Should not throw" { { Resolve-Dependency -Name 'foobar2000' } | Should -Not -Throw } @@ -12,11 +25,11 @@ Describe "Resolve-Dependency" { Context "Enforce Error" { # Return incorrect module base to enforce there is no config file. Mock Get-ModuleBase { - if ($IsWindows) {return "C:\"} - elseif ($isLinux) {return "/"} + if ($IsWindows) { return "C:\" } + elseif ($isLinux) { return "/" } } It "Missing dependency file should not cause an error" { - { Resolve-Dependency -Name 'awesome'} | Should -Not -Throw + { Resolve-Dependency -Name 'awesome' } | Should -Not -Throw } It "Missing dependency file should return true" { @@ -24,7 +37,7 @@ Describe "Resolve-Dependency" { } } Context "Testing input variations" { - Mock Get-ModuleBase {return (Join-Path -Path $PWD -ChildPath '/resources')} + Mock Get-ModuleBase { return (Join-Path -Path $PWD -ChildPath '/resources') } It "Should return true if all given dependencies exist" { Resolve-Dependency -Name 'Existing' | Should -Be $true } diff --git a/tests/Private/01_Test-Module.Tests.ps1 b/src/Private/Test-Module.Tests.ps1 similarity index 68% rename from tests/Private/01_Test-Module.Tests.ps1 rename to src/Private/Test-Module.Tests.ps1 index c5747c8..1805d12 100644 --- a/tests/Private/01_Test-Module.Tests.ps1 +++ b/src/Private/Test-Module.Tests.ps1 @@ -1,3 +1,16 @@ +BeforeAll { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Import-Module $ManifestFile -Force + + $PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object { + $_.BaseName -notmatch '.Tests' + } + ).FullName + foreach ( $func in $PrivateFunctions) { + . $func + } +} + Describe "Test-ModuleName" { Context "Basic input tests" { It "Testing standard module should not throw" { @@ -20,7 +33,7 @@ Describe "Test-ModuleName" { Test-Module -Name 'foobar2000' | Should -Be $false } It "StopifFails switch should thrown an error" { - {Test-Module -Name 'foobar2000' -StopIfFails }| Should -Throw + { Test-Module -Name 'foobar2000' -StopIfFails } | Should -Throw } } } diff --git a/tests/Private/01_Get-ModuleBase.Tests.ps1 b/tests/Private/01_Get-ModuleBase.Tests.ps1 deleted file mode 100644 index 0e5d972..0000000 --- a/tests/Private/01_Get-ModuleBase.Tests.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -Describe "Get-ModuleBase" { - Context "Basic syntax check" { - It "Test1: Should not throw" { - { Get-ModuleBase } | Should -Not -Throw - } - } -} diff --git a/tests/Private/01_Get-RandomAESKey.Tests.ps1 b/tests/Private/01_Get-RandomAESKey.Tests.ps1 deleted file mode 100644 index 9a9c72f..0000000 --- a/tests/Private/01_Get-RandomAESKey.Tests.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -Describe "Get-RandomKey" { - Context "Basic input tests" { - It "Test1: Should not throw " { - {Get-RandomAESKey} | Should -Not -Throw - } - } - Context "Basic syntax check" { - It "Test2: Should return a key with a length of 32 bytes" { - $Key = Get-RandomAESKey - $Key.length | Should -Be 32 - } - } -} -- 2.45.2 From 20f5fe7bd564ae50b7468f50a7832124506e04de Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 12:09:55 +0200 Subject: [PATCH 24/46] wip --- src/Private/Resolve-Dependency.Tests.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Private/Resolve-Dependency.Tests.ps1 b/src/Private/Resolve-Dependency.Tests.ps1 index 380a259..5e3a9c6 100644 --- a/src/Private/Resolve-Dependency.Tests.ps1 +++ b/src/Private/Resolve-Dependency.Tests.ps1 @@ -13,8 +13,8 @@ BeforeAll { Describe "Resolve-Dependency" { Context "Basic syntax check" { - Mock Get-ModuleBase { return (Join-Path -Path $PWD -ChildPath '/resources') } - Mock Test-Module { return $true } + Mock Get-ModuleBase { return (Join-Path -Path $PWD -ChildPath '/resources') } -ModuleName 'PSCredentialStore' + Mock Test-Module { return $true } -ModuleName 'PSCredentialStore' It "Test1: Should not throw" { { Resolve-Dependency -Name 'foobar2000' } | Should -Not -Throw } @@ -27,7 +27,7 @@ Describe "Resolve-Dependency" { Mock Get-ModuleBase { if ($IsWindows) { return "C:\" } elseif ($isLinux) { return "/" } - } + } -ModuleName 'PSCredentialStore' It "Missing dependency file should not cause an error" { { Resolve-Dependency -Name 'awesome' } | Should -Not -Throw } @@ -37,7 +37,7 @@ Describe "Resolve-Dependency" { } } Context "Testing input variations" { - Mock Get-ModuleBase { return (Join-Path -Path $PWD -ChildPath '/resources') } + Mock Get-ModuleBase { return (Join-Path -Path $PWD -ChildPath '/resources') } -ModuleName 'PSCredentialStore' It "Should return true if all given dependencies exist" { Resolve-Dependency -Name 'Existing' | Should -Be $true } -- 2.45.2 From f90741d82ad669986952fe605ce5c4c1373ddb48 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 14:48:05 +0200 Subject: [PATCH 25/46] try to mock private module function outside of module scope --- src/Private/Resolve-Dependency.Tests.ps1 | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Private/Resolve-Dependency.Tests.ps1 b/src/Private/Resolve-Dependency.Tests.ps1 index 5e3a9c6..7c3f2a1 100644 --- a/src/Private/Resolve-Dependency.Tests.ps1 +++ b/src/Private/Resolve-Dependency.Tests.ps1 @@ -13,8 +13,15 @@ BeforeAll { Describe "Resolve-Dependency" { Context "Basic syntax check" { - Mock Get-ModuleBase { return (Join-Path -Path $PWD -ChildPath '/resources') } -ModuleName 'PSCredentialStore' - Mock Test-Module { return $true } -ModuleName 'PSCredentialStore' + BeforeAll { + Mock -ModuleName 'PSCredentialStore' Get-ModuleBase { + return (Join-Path -Path $PWD -ChildPath '/resources') + } + Mock -ModuleName 'PSCredentialStore' Test-Module { + return $true + } + } + It "Test1: Should not throw" { { Resolve-Dependency -Name 'foobar2000' } | Should -Not -Throw } @@ -37,11 +44,16 @@ Describe "Resolve-Dependency" { } } Context "Testing input variations" { - Mock Get-ModuleBase { return (Join-Path -Path $PWD -ChildPath '/resources') } -ModuleName 'PSCredentialStore' It "Should return true if all given dependencies exist" { + Mock Get-ModuleBase { + return (Join-Path -Path $PWD -ChildPath '/resources') + } Resolve-Dependency -Name 'Existing' | Should -Be $true } It "Mixed results should return false" { + Mock Get-ModuleBase { + return (Join-Path -Path $PWD -ChildPath '/resources') + } Resolve-Dependency -Name 'PSGetMixed' | Should -Be $false } } -- 2.45.2 From 8e73cf346c76e584944081f395aa8c683fcd0302 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 14:54:20 +0200 Subject: [PATCH 26/46] wip --- .../Store/Get-CredentialStore.Tests.ps1 | 15 +++++- .../Store/New-CredentialStore.Tests.ps1 | 50 ++++++++++++------- .../Store/Test-CredentialStore.Tests.ps1 | 15 +++++- 3 files changed, 59 insertions(+), 21 deletions(-) rename tests/Store/03_Get-CredentialStore.Tests.ps1 => src/Store/Get-CredentialStore.Tests.ps1 (75%) rename tests/Store/02_New-CredentialStore.Tests.ps1 => src/Store/New-CredentialStore.Tests.ps1 (75%) rename tests/Store/02_Test-CredentialStore.Tests.ps1 => src/Store/Test-CredentialStore.Tests.ps1 (76%) diff --git a/tests/Store/03_Get-CredentialStore.Tests.ps1 b/src/Store/Get-CredentialStore.Tests.ps1 similarity index 75% rename from tests/Store/03_Get-CredentialStore.Tests.ps1 rename to src/Store/Get-CredentialStore.Tests.ps1 index 0bf63aa..4398a42 100644 --- a/tests/Store/03_Get-CredentialStore.Tests.ps1 +++ b/src/Store/Get-CredentialStore.Tests.ps1 @@ -1,4 +1,17 @@ -$RepoRoot = (Get-Item -Path (Get-GitDirectory) -Force).Parent | Select-Object -ExpandProperty 'FullName' +BeforeAll { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Import-Module $ManifestFile -Force + + $PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object { + $_.BaseName -notmatch '.Tests' + } + ).FullName + foreach ( $func in $PrivateFunctions) { + . $func + } + + $RepoRoot = (Get-Item -Path (Get-GitDirectory) -Force).Parent | Select-Object -ExpandProperty 'FullName' +} Describe "Get-CredentialStore" { Context "Basic logic tests" { diff --git a/tests/Store/02_New-CredentialStore.Tests.ps1 b/src/Store/New-CredentialStore.Tests.ps1 similarity index 75% rename from tests/Store/02_New-CredentialStore.Tests.ps1 rename to src/Store/New-CredentialStore.Tests.ps1 index ec58d99..4a32cf4 100644 --- a/tests/Store/02_New-CredentialStore.Tests.ps1 +++ b/src/Store/New-CredentialStore.Tests.ps1 @@ -1,23 +1,35 @@ -# Backup existing credential stores -$VerbosePreference = "Continue" -Write-Verbose "Backup private Credential Store..." -$CSPath = Get-DefaultCredentialStorePath -$BackupFile = "{0}.back" -f $CSPath -If (Test-Path -Path $CSPath) { - Move-Item -Path $CSPath -Destination $BackupFile +BeforeAll { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Import-Module $ManifestFile -Force + + $PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object { + $_.BaseName -notmatch '.Tests' + } + ).FullName + foreach ( $func in $PrivateFunctions) { + . $func + } + # Backup existing credential stores + $VerbosePreference = "Continue" + Write-Verbose "Backup private Credential Store..." + $CSPath = Get-DefaultCredentialStorePath + $BackupFile = "{0}.back" -f $CSPath + if (Test-Path -Path $CSPath) { + Move-Item -Path $CSPath -Destination $BackupFile + } + Write-Verbose "Backup shared CredentialStore..." + $CSShared = Get-DefaultCredentialStorePath -Shared + $BackupSharedFile = "{0}.back" -f $CSShared + if (Test-Path -Path $CSShared) { + Move-Item -Path $CSShared -Destination $BackupSharedFile + } + Write-Verbose "Remove old CredentialStore in Temp dir" + $CSTemp = Join-Path -Path (Get-TempDir) -ChildPath '/CredentialStore.json' + if (Test-Path -Path $CSTemp) { + Remove-Item -Path $CSTemp + } + $VerbosePreference = "SilentlyContinue" } -Write-Verbose "Backup shared CredentialStore..." -$CSShared = Get-DefaultCredentialStorePath -Shared -$BackupSharedFile = "{0}.back" -f $CSShared -If (Test-Path -Path $CSShared) { - Move-Item -Path $CSShared -Destination $BackupSharedFile -} -Write-Verbose "Remove old CredentialStore in Temp dir" -$CSTemp = Join-Path -Path (Get-TempDir) -ChildPath '/CredentialStore.json' -If (Test-Path -Path $CSTemp) { - Remove-Item -Path $CSTemp -} -$VerbosePreference = "SilentlyContinue" Describe "New-CredentialStore" { Context "Private CS tests" { diff --git a/tests/Store/02_Test-CredentialStore.Tests.ps1 b/src/Store/Test-CredentialStore.Tests.ps1 similarity index 76% rename from tests/Store/02_Test-CredentialStore.Tests.ps1 rename to src/Store/Test-CredentialStore.Tests.ps1 index 6cdeca9..33733e0 100644 --- a/tests/Store/02_Test-CredentialStore.Tests.ps1 +++ b/src/Store/Test-CredentialStore.Tests.ps1 @@ -1,4 +1,17 @@ -$RepoRoot = (Get-Item -Path (Get-GitDirectory) -Force).Parent | Select-Object -ExpandProperty 'FullName' +BeforeAll { + $ManifestFile = (Get-Item -Path "./src/*.psd1").FullName + Import-Module $ManifestFile -Force + + $PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object { + $_.BaseName -notmatch '.Tests' + } + ).FullName + foreach ( $func in $PrivateFunctions) { + . $func + } + + $RepoRoot = (Get-Item -Path (Get-GitDirectory) -Force).Parent | Select-Object -ExpandProperty 'FullName' +} Describe "Test-CredentialStore" { Context "Basic logic tests" { -- 2.45.2 From 01de79fe1196396268b26f13674801e2a4893e7a Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 15:18:22 +0200 Subject: [PATCH 27/46] wip --- src/Store/Get-CredentialStore.Tests.ps1 | 28 ++++++++-------- src/Store/New-CredentialStore.Tests.ps1 | 41 ++++++++++++++---------- src/Store/Test-CredentialStore.Tests.ps1 | 5 +-- 3 files changed, 42 insertions(+), 32 deletions(-) diff --git a/src/Store/Get-CredentialStore.Tests.ps1 b/src/Store/Get-CredentialStore.Tests.ps1 index 4398a42..25a7fae 100644 --- a/src/Store/Get-CredentialStore.Tests.ps1 +++ b/src/Store/Get-CredentialStore.Tests.ps1 @@ -9,37 +9,39 @@ BeforeAll { foreach ( $func in $PrivateFunctions) { . $func } - - $RepoRoot = (Get-Item -Path (Get-GitDirectory) -Force).Parent | Select-Object -ExpandProperty 'FullName' } Describe "Get-CredentialStore" { Context "Basic logic tests" { - $TestCredentialStore = Join-Path -Path $RepoRoot -ChildPath 'resources/cs/CredentialStore.json' - $TestPfxCert = Join-Path -Path $RepoRoot -ChildPath 'resources/cs/PSCredentialStore.pfx' - 'TestCredentialStore: {0}' -f $TestCredentialStore It "Test1: Read CS without params" { + $TestCredentialStore = './resources/cs/CredentialStore.json' + $TestPfxCert = './resources/cs/PSCredentialStore.pfx' if (! (Test-Path -Path (Get-DefaultCredentialStorePath)) ) { { New-CredentialStore -Force } | Should -Not -Throw - } { Get-CredentialStore } | Should -Not -Throw } It "Test2: Read Credential Store with testing data" { - { Use-CSCertificate -Shared -CredentialStore $TestCredentialStore -Path $TestPfxCert } | Should -Not -Throw + $TestCredentialStore = './resources/cs/CredentialStore.json' + $TestPfxCert = './resources/cs/PSCredentialStore.pfx' + { + Use-CSCertificate -Shared -CredentialStore $TestCredentialStore -Path $TestPfxCert + } | Should -Not -Throw { Get-CredentialStore -Shared -Path $TestCredentialStore } | Should -Not -Throw } It "Test3: Not existing path should return false" { - { Get-CredentialStore -Shared -Path './CredentialStore.json' } | Should -Throw "Could not find the CredentialStore." + { + Get-CredentialStore -Shared -Path './CredentialStore.json' + } | Should -Throw "Could not find the CredentialStore." } } Context "Testing invalid json data" { - #Mock Test-CredentialStore {return $true} - #Mock Get-Content {return '"foo":"bar",'} - $BrokenCS = Join-Path -Path $RepoRoot -ChildPath 'resources/cs/Broken_CS.json' - Write-Verbose -Message ('BrokenCS Path: {0}' -f $BrokenCS) -Verbose It "Should throw with invalid CredentialStore" { - { Get-CredentialStore -Path -Shared $BrokenCS } | Should -Throw + $BrokenCS = './resources/cs/Broken_CS.json' + Write-Verbose -Message ('BrokenCS Path: {0}' -f $BrokenCS) -Verbose + { + Get-CredentialStore -Path -Shared $BrokenCS + } | Should -Throw } } } diff --git a/src/Store/New-CredentialStore.Tests.ps1 b/src/Store/New-CredentialStore.Tests.ps1 index 4a32cf4..7180661 100644 --- a/src/Store/New-CredentialStore.Tests.ps1 +++ b/src/Store/New-CredentialStore.Tests.ps1 @@ -33,8 +33,8 @@ BeforeAll { Describe "New-CredentialStore" { Context "Private CS tests" { - $pCS = Get-DefaultCredentialStorePath It "Test1: Create new private CredentialStore" { + $pCS = Get-DefaultCredentialStorePath { New-CredentialStore -Confirm:$false } | Should -Not -Throw $result = Test-Path -Path $pCS $CS = Get-Content -Path $pCS -Raw | ConvertFrom-Json @@ -44,6 +44,7 @@ Describe "New-CredentialStore" { { New-CredentialStore -Confirm:$false } | Should -Throw } It "Test3: Reset existing Credential Store" { + $pCS = Get-DefaultCredentialStorePath $now = Get-Date $CS = Get-Content -Path $pCS -Raw | ConvertFrom-Json $CSCreation = [DateTime]$CS.Created @@ -52,8 +53,8 @@ Describe "New-CredentialStore" { } } Context "Shared CS tests" { - $sCS = Get-DefaultCredentialStorePath -Shared It "Test1: Create a new Shared Credential Store" { + $sCS = Get-DefaultCredentialStorePath -Shared { New-CredentialStore -Confirm:$false -Shared } | Should -Not -Throw Test-Path -Path $sCS | Should -Be $true } @@ -61,6 +62,7 @@ Describe "New-CredentialStore" { { New-CredentialStore -Shared -Confirm:$false } | Should -Throw } It "Test3: Reset shared CredentialStore" { + $sCS = Get-DefaultCredentialStorePath -Shared $now = Get-Date $CS = Get-Content -Path $sCS -Raw | ConvertFrom-Json $CSCreation = [DateTime]$CS.Created @@ -69,14 +71,16 @@ Describe "New-CredentialStore" { } } Context "Custom Shared CS tests" { - $cCS = Join-Path -Path (Get-TempDir) -ChildPath "CredentialStore.json" It "Test1: Create new custom shared" { + $cCS = Join-Path -Path (Get-TempDir) -ChildPath "CredentialStore.json" { New-CredentialStore -Path $cCS -Shared -Confirm:$false } | Should -Not -Throw } It "Test2: Try to override exiting one" { + $cCS = Join-Path -Path (Get-TempDir) -ChildPath "CredentialStore.json" { New-CredentialStore -Path $cCS -Shared -Confirm:$false } | Should -Throw } It "Test3: Reset existing custom CredentialStore" { + $cCS = Join-Path -Path (Get-TempDir) -ChildPath "CredentialStore.json" { New-CredentialStore -Path $cCS -Shared -Force -Confirm:$false } | Should -Not -Throw } } @@ -109,21 +113,24 @@ Describe "New-CredentialStore" { } } -# Cleanup test stores and restore existing ones. -$VerbosePreference = "Continue" -Write-Verbose "Restoring private CredentialStore" -If (Test-Path -Path $BackupFile) { - If (Test-Path -Path $CSPath) { - Remove-Item -Path $CSPath - Move-Item -Path $BackupFile -Destination $CSPath +AfterAll { + # Cleanup test stores and restore existing ones. + $VerbosePreference = "Continue" + Write-Verbose "Restoring private CredentialStore" + If (Test-Path -Path $BackupFile) { + If (Test-Path -Path $CSPath) { + Remove-Item -Path $CSPath + Move-Item -Path $BackupFile -Destination $CSPath + } } -} -Write-Verbose "Restoring shared CredentialStore" -If (Test-Path -Path $BackupSharedFile) { - If (Test-Path -Path $CSShared) { - Remove-Item -Path $CSShared - Move-Item -Path $BackupSharedFile -Destination $CSShared + Write-Verbose "Restoring shared CredentialStore" + If (Test-Path -Path $BackupSharedFile) { + If (Test-Path -Path $CSShared) { + Remove-Item -Path $CSShared + Move-Item -Path $BackupSharedFile -Destination $CSShared + } } + $VerbosePreference = "SilentlyContinue" + } -$VerbosePreference = "SilentlyContinue" diff --git a/src/Store/Test-CredentialStore.Tests.ps1 b/src/Store/Test-CredentialStore.Tests.ps1 index 33733e0..14eaeed 100644 --- a/src/Store/Test-CredentialStore.Tests.ps1 +++ b/src/Store/Test-CredentialStore.Tests.ps1 @@ -15,16 +15,17 @@ BeforeAll { Describe "Test-CredentialStore" { Context "Basic logic tests" { - $TestCredentialStore = Join-Path -Path $RepoRoot -ChildPath '/resources/cs/CredentialStore.json' It "Test1: Should Not Throw" { + $TestCredentialStore = './resources/cs/CredentialStore.json' { Test-CredentialStore -Shared -Path $TestCredentialStore } | Should -Not -Throw } It "Test2: Read valid CredentialStore" { + $TestCredentialStore = './resources/cs/CredentialStore.json' $res = Test-CredentialStore -Shared -Path $TestCredentialStore $res | Should -Be $true } It "Test3: Read a broken CredentialStore" { - $BrokenCS = Join-Path -Path $RepoRoot -ChildPath '{0}/resources/cs/Broken_CS.json' + $BrokenCS = './resources/cs/Broken_CS.json' $oWarningPreference = $WarningPreference $WarningPreference = 'SilentlyContinue' $res = Test-CredentialStore -Shared -Path $BrokenCS -- 2.45.2 From 9a5693d51c964f47d56b6ec6ca7c4c8cc5149b9f Mon Sep 17 00:00:00 2001 From: OCram85 Date: Wed, 29 Jun 2022 13:35:33 +0200 Subject: [PATCH 28/46] wip --- src/Store/New-CredentialStore.Tests.ps1 | 1 + tests/.gitkeep | 0 tests/00_BasicModule.Tests.ps1 | 17 ----------------- 3 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 tests/.gitkeep delete mode 100644 tests/00_BasicModule.Tests.ps1 diff --git a/src/Store/New-CredentialStore.Tests.ps1 b/src/Store/New-CredentialStore.Tests.ps1 index 7180661..8473eaf 100644 --- a/src/Store/New-CredentialStore.Tests.ps1 +++ b/src/Store/New-CredentialStore.Tests.ps1 @@ -9,6 +9,7 @@ BeforeAll { foreach ( $func in $PrivateFunctions) { . $func } + # Backup existing credential stores $VerbosePreference = "Continue" Write-Verbose "Backup private Credential Store..." diff --git a/tests/.gitkeep b/tests/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/tests/00_BasicModule.Tests.ps1 b/tests/00_BasicModule.Tests.ps1 deleted file mode 100644 index 6c846ad..0000000 --- a/tests/00_BasicModule.Tests.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -$RepoRoot = (Get-Item -Path (Get-GitDirectory) -Force).Parent | Select-Object -ExpandProperty 'FullName' -Write-Verbose -Message ('RepoRoot: {0}' -f $RepoRoot) -Verbose - -$ManifestFilePath = Join-Path -Path $RepoRoot -ChildPath '/src/PSCredentialStore.psd1' -Write-Verbose -Message ("ManifestFilePath: {0}" -f $ManifestFilePath) -Verbose -Describe "Pre-Flight module tests" { - Context "Manifest file related" { - It "Test the parsed file itself" { - { Test-ModuleManifest -Path $ManifestFilePath -Verbose } | Should -Not -Throw - } - } - Context "Module consistency tests" { - It "Importing should work" { - { Import-Module -Name $ManifestFilePath -Global -Force -Verbose } | Should -Not -Throw - } - } -} -- 2.45.2 From 89be8ad5994b073c17bf498469f8e30aee115e28 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Wed, 29 Jun 2022 13:44:49 +0200 Subject: [PATCH 29/46] add pwsh lts --- .drone.yml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.drone.yml b/.drone.yml index 0d5dc6d..bc2712f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -46,3 +46,49 @@ steps: from_secret: CodeCovToken files: - coverage.xml + +--- + +kind: pipeline +type: docker +name: PWSH_LTS_7.2_Ubuntu-focal + +platform: + os: linux + arch: amd64 + + +platform: + os: linux + arch: amd64 + +steps: + - name: Environments + image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal + commands: + - | + pwsh -NonInteractive -c "& { + Import-Module './tools/DroneIO.psm1' -Verbose; + Invoke-ShowEnv -Verbose + }" + + - name: LintTests + image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal + failure: ignore + commands: + - | + pwsh -NonInteractive -c "& { + Import-Module './tools/DroneIO.psm1'; + Invoke-InstallDependencies; + Invoke-Linter -ErrorAction 'Stop' + }" + + - name: UnitTests + image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal + failure: ignore + commands: + - | + pwsh -NonInteractive -c "& { + Import-Module './tools/DroneIO.psm1'; + Invoke-InstallDependencies; + Invoke-UnitTest -Verbosity 'Detailed' -ErrorAction 'Stop' -- 2.45.2 From 89a41055aea0c688b94de132ac44d0ed5f1a0920 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Wed, 29 Jun 2022 13:46:38 +0200 Subject: [PATCH 30/46] wip --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index bc2712f..04e1b20 100644 --- a/.drone.yml +++ b/.drone.yml @@ -92,3 +92,4 @@ steps: Import-Module './tools/DroneIO.psm1'; Invoke-InstallDependencies; Invoke-UnitTest -Verbosity 'Detailed' -ErrorAction 'Stop' + }" -- 2.45.2 From 2fd83fe8dcbbc47423d89bc526c212ce1be4507f Mon Sep 17 00:00:00 2001 From: OCram85 Date: Wed, 29 Jun 2022 13:51:01 +0200 Subject: [PATCH 31/46] add debug output --- .drone.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.drone.yml b/.drone.yml index 04e1b20..f5c777a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -93,3 +93,11 @@ steps: Invoke-InstallDependencies; Invoke-UnitTest -Verbosity 'Detailed' -ErrorAction 'Stop' }" + + - name: FinalState + image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal + commands: + - | + pwsh -NonInteractive -c "& { + Write-Verbose -Message ('Failed Steps: {0}' -f $Env:DRONE_FAILED_STEPS) + }" -- 2.45.2 From 5353e473e2b104120e475a9a2d57f60d6bec4f22 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Wed, 29 Jun 2022 13:53:19 +0200 Subject: [PATCH 32/46] wip --- .drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index f5c777a..d04d4d0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -99,5 +99,6 @@ steps: commands: - | pwsh -NonInteractive -c "& { - Write-Verbose -Message ('Failed Steps: {0}' -f $Env:DRONE_FAILED_STEPS) + Import-Module './tools/DroneIO.psm1'; + Invoke-ShowEnv -Verbose }" -- 2.45.2 From be156ab716cbed69582e024f6c4e62460e8ee262 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Wed, 29 Jun 2022 14:00:30 +0200 Subject: [PATCH 33/46] wip --- .drone.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index d04d4d0..52e51d3 100644 --- a/.drone.yml +++ b/.drone.yml @@ -74,7 +74,7 @@ steps: - name: LintTests image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal - failure: ignore + #failure: ignore commands: - | pwsh -NonInteractive -c "& { @@ -85,7 +85,7 @@ steps: - name: UnitTests image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal - failure: ignore + #failure: ignore commands: - | pwsh -NonInteractive -c "& { @@ -102,3 +102,6 @@ steps: Import-Module './tools/DroneIO.psm1'; Invoke-ShowEnv -Verbose }" + depends_on: + - LintTests + - UnitTests -- 2.45.2 From d2582e719438abbff7ec68c2814ec14acf9f7cba Mon Sep 17 00:00:00 2001 From: OCram85 Date: Thu, 30 Jun 2022 15:52:03 +0200 Subject: [PATCH 34/46] wip --- .drone.yml | 62 +++++----------------------------------------- STATE.xml | 20 +++++++++++++++ tools/DroneIO.psm1 | 37 +++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 56 deletions(-) create mode 100644 STATE.xml diff --git a/.drone.yml b/.drone.yml index 52e51d3..17fcff7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,7 +1,7 @@ --- kind: pipeline type: docker -name: Linux_PWSH7_Build +name: PWSH_LTS_7.2_Ubuntu-focal platform: os: linux @@ -9,7 +9,7 @@ platform: steps: - name: Environments - image: mcr.microsoft.com/powershell:latest + image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal commands: - | pwsh -NonInteractive -c "& { @@ -18,7 +18,7 @@ steps: }" - name: LintTests - image: mcr.microsoft.com/powershell:latest + image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal failure: ignore commands: - | @@ -29,7 +29,7 @@ steps: }" - name: UnitTests - image: mcr.microsoft.com/powershell:latest + image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal failure: ignore commands: - | @@ -47,61 +47,11 @@ steps: files: - coverage.xml ---- - -kind: pipeline -type: docker -name: PWSH_LTS_7.2_Ubuntu-focal - -platform: - os: linux - arch: amd64 - - -platform: - os: linux - arch: amd64 - -steps: - - name: Environments - image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal - commands: - - | - pwsh -NonInteractive -c "& { - Import-Module './tools/DroneIO.psm1' -Verbose; - Invoke-ShowEnv -Verbose - }" - - - name: LintTests - image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal - #failure: ignore - commands: - - | - pwsh -NonInteractive -c "& { - Import-Module './tools/DroneIO.psm1'; - Invoke-InstallDependencies; - Invoke-Linter -ErrorAction 'Stop' - }" - - - name: UnitTests - image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal - #failure: ignore - commands: - - | - pwsh -NonInteractive -c "& { - Import-Module './tools/DroneIO.psm1'; - Invoke-InstallDependencies; - Invoke-UnitTest -Verbosity 'Detailed' -ErrorAction 'Stop' - }" - - - name: FinalState + - name: SetPipelineState image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal commands: - | pwsh -NonInteractive -c "& { Import-Module './tools/DroneIO.psm1'; - Invoke-ShowEnv -Verbose + Invoke-BuildState -ErrorAction 'Stop' }" - depends_on: - - LintTests - - UnitTests diff --git a/STATE.xml b/STATE.xml new file mode 100644 index 0000000..debbefc --- /dev/null +++ b/STATE.xml @@ -0,0 +1,20 @@ + + + + System.Management.Automation.PSCustomObject + System.Object + + + + + System.Object[] + System.Array + System.Object + + + lint + + + + + \ No newline at end of file diff --git a/tools/DroneIO.psm1 b/tools/DroneIO.psm1 index b201ff4..6f333d6 100644 --- a/tools/DroneIO.psm1 +++ b/tools/DroneIO.psm1 @@ -144,6 +144,7 @@ function Invoke-Linter { "RuleName", "Message" ) -AutoSize | Out-String | Write-Verbose -Verbose + Update-BuildStateFile throw 'PS Script Analyzer failed!' } } @@ -203,6 +204,7 @@ function Invoke-UnitTest { $TestResults = Invoke-Pester -Configuration $PesterConf -ErrorAction 'Stop' if ($TestResults.FailedCount -gt 0) { + Update-BuildStateFile throw ('{0} tests failed!' -f $TestResults.FailedCount) } @@ -211,3 +213,38 @@ function Invoke-UnitTest { } } } + +function Update-BuildStateFile { + [CmdletBinding()] + param ( + [Parameter(Mandatory = $false)] + [ValidateNotNullOrEmpty()] + [string]$StepName = $Env:DRONE_FAILED_STEPS + ) + + process { + $StateFilePath = Join-Path -Path $PWD -ChildPath './STATE.xml' + if (Test-Path -Path $StateFilePath) { + $StateContent = Import-Clixml -Path $StateFilePath + $StateContent.Steps += $StepName + } + else { + $StateContent = [PSCustomObject]@{ + Steps = @($StepName) + } + } + Export-Clixml -Path $StateFilePath -InputObject $StateContent -Force -Encoding utf8NoBOM + } +} + +function Invoke-BuildState { + [CmdletBinding()] + param () + + process { + $StateFilePath = Join-Path -Path $PWD -ChildPath './STATE.xml' + if ( Test-Path -Path $StateFilePath ) { + throw 'One one more pipeline steps failed. Marking the pipeline as failed!' + } + } +} -- 2.45.2 From 4307159bedfefb33d33931dc42e05bf9d97c218e Mon Sep 17 00:00:00 2001 From: OCram85 Date: Thu, 30 Jun 2022 15:55:08 +0200 Subject: [PATCH 35/46] wip --- .drone.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 17fcff7..6a876ef 100644 --- a/.drone.yml +++ b/.drone.yml @@ -36,7 +36,7 @@ steps: pwsh -NonInteractive -c "& { Import-Module './tools/DroneIO.psm1'; Invoke-InstallDependencies; - Invoke-UnitTest -Verbosity 'Detailed' -ErrorAction 'Stop' + Invoke-UnitTest -Verbosity 'Normal' -ErrorAction 'Stop' }" - name: coverage @@ -46,6 +46,8 @@ steps: from_secret: CodeCovToken files: - coverage.xml + depends_on: + - UnitTests - name: SetPipelineState image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal @@ -55,3 +57,7 @@ steps: Import-Module './tools/DroneIO.psm1'; Invoke-BuildState -ErrorAction 'Stop' }" + depends_on: + - LintTests + - UnitTests + - Coverage -- 2.45.2 From 4ff1de546cc15e409c211fa80f269402bd324985 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Thu, 30 Jun 2022 15:55:54 +0200 Subject: [PATCH 36/46] wip --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 6a876ef..6d8c3cf 100644 --- a/.drone.yml +++ b/.drone.yml @@ -39,7 +39,7 @@ steps: Invoke-UnitTest -Verbosity 'Normal' -ErrorAction 'Stop' }" - - name: coverage + - name: Coverage image: plugins/codecov settings: token: -- 2.45.2 From bf5490205dd6b352d71747f6b62466bcbabd5ec1 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 1 Jul 2022 11:18:07 +0200 Subject: [PATCH 37/46] wip --- .drone.yml | 2 +- ...redentialStore.Certificate.Attribute.ps1xml | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.drone.yml b/.drone.yml index 6d8c3cf..1a9e24e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -36,7 +36,7 @@ steps: pwsh -NonInteractive -c "& { Import-Module './tools/DroneIO.psm1'; Invoke-InstallDependencies; - Invoke-UnitTest -Verbosity 'Normal' -ErrorAction 'Stop' + Invoke-UnitTest -Verbosity 'Normal' -ExcludeTag @( 'Integration', 'Disabled') -ErrorAction 'Stop' }" - name: Coverage diff --git a/src/Formats/PSCredentialStore.Certificate.Attribute.ps1xml b/src/Formats/PSCredentialStore.Certificate.Attribute.ps1xml index d75dee6..a9ef0fe 100644 --- a/src/Formats/PSCredentialStore.Certificate.Attribute.ps1xml +++ b/src/Formats/PSCredentialStore.Certificate.Attribute.ps1xml @@ -11,22 +11,28 @@ - Country + + $_.Subject.Country - State + + $_.Subject.State - City + + $_.Subject.City - Organization + + $_.Subject.Organization - OrganizationalUnitName + + $_.Subject.OrganizationalUnitName - CommonName + + $_.Subject.CommonName -- 2.45.2 From cd7b986dc91f010e216fb02bd558085b60c2432d Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 1 Jul 2022 11:21:11 +0200 Subject: [PATCH 38/46] wip --- src/Store/New-CredentialStore.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Store/New-CredentialStore.Tests.ps1 b/src/Store/New-CredentialStore.Tests.ps1 index 8473eaf..f660240 100644 --- a/src/Store/New-CredentialStore.Tests.ps1 +++ b/src/Store/New-CredentialStore.Tests.ps1 @@ -36,7 +36,7 @@ Describe "New-CredentialStore" { Context "Private CS tests" { It "Test1: Create new private CredentialStore" { $pCS = Get-DefaultCredentialStorePath - { New-CredentialStore -Confirm:$false } | Should -Not -Throw + { New-CredentialStore -Confirm:$false -Force } | Should -Not -Throw $result = Test-Path -Path $pCS $CS = Get-Content -Path $pCS -Raw | ConvertFrom-Json ($result -eq $true) -and ($CS.Type -eq "Private") | Should -Be $true -- 2.45.2 From ab96d9db0e0ccd999afdfef94b41c59ad39995de Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 1 Jul 2022 11:23:21 +0200 Subject: [PATCH 39/46] wip --- src/Store/Test-CredentialStore.Tests.ps1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Store/Test-CredentialStore.Tests.ps1 b/src/Store/Test-CredentialStore.Tests.ps1 index 14eaeed..b79e7f1 100644 --- a/src/Store/Test-CredentialStore.Tests.ps1 +++ b/src/Store/Test-CredentialStore.Tests.ps1 @@ -9,8 +9,6 @@ BeforeAll { foreach ( $func in $PrivateFunctions) { . $func } - - $RepoRoot = (Get-Item -Path (Get-GitDirectory) -Force).Parent | Select-Object -ExpandProperty 'FullName' } Describe "Test-CredentialStore" { -- 2.45.2 From 642af42d7e6d9d470cc51d1b5ad421fdea8e8243 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 1 Jul 2022 11:27:28 +0200 Subject: [PATCH 40/46] wip --- src/Store/Get-CredentialStore.Tests.ps1 | 4 ++-- src/Store/New-CredentialStore.Tests.ps1 | 26 ++++++++++++++----------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/Store/Get-CredentialStore.Tests.ps1 b/src/Store/Get-CredentialStore.Tests.ps1 index 25a7fae..bb940a0 100644 --- a/src/Store/Get-CredentialStore.Tests.ps1 +++ b/src/Store/Get-CredentialStore.Tests.ps1 @@ -13,7 +13,7 @@ BeforeAll { Describe "Get-CredentialStore" { Context "Basic logic tests" { - It "Test1: Read CS without params" { + It "Read CS without params" { $TestCredentialStore = './resources/cs/CredentialStore.json' $TestPfxCert = './resources/cs/PSCredentialStore.pfx' if (! (Test-Path -Path (Get-DefaultCredentialStorePath)) ) { @@ -21,7 +21,7 @@ Describe "Get-CredentialStore" { } { Get-CredentialStore } | Should -Not -Throw } - It "Test2: Read Credential Store with testing data" { + It "Read Credential Store with testing data" { $TestCredentialStore = './resources/cs/CredentialStore.json' $TestPfxCert = './resources/cs/PSCredentialStore.pfx' { diff --git a/src/Store/New-CredentialStore.Tests.ps1 b/src/Store/New-CredentialStore.Tests.ps1 index f660240..9cc5b88 100644 --- a/src/Store/New-CredentialStore.Tests.ps1 +++ b/src/Store/New-CredentialStore.Tests.ps1 @@ -34,17 +34,17 @@ BeforeAll { Describe "New-CredentialStore" { Context "Private CS tests" { - It "Test1: Create new private CredentialStore" { + It "Create new private CredentialStore" { $pCS = Get-DefaultCredentialStorePath { New-CredentialStore -Confirm:$false -Force } | Should -Not -Throw $result = Test-Path -Path $pCS $CS = Get-Content -Path $pCS -Raw | ConvertFrom-Json ($result -eq $true) -and ($CS.Type -eq "Private") | Should -Be $true } - It "Test2: Try to override private Store" { + It "Try to override private Store" { { New-CredentialStore -Confirm:$false } | Should -Throw } - It "Test3: Reset existing Credential Store" { + It "Reset existing Credential Store" { $pCS = Get-DefaultCredentialStorePath $now = Get-Date $CS = Get-Content -Path $pCS -Raw | ConvertFrom-Json @@ -54,15 +54,15 @@ Describe "New-CredentialStore" { } } Context "Shared CS tests" { - It "Test1: Create a new Shared Credential Store" { + It "Create a new Shared Credential Store" { $sCS = Get-DefaultCredentialStorePath -Shared { New-CredentialStore -Confirm:$false -Shared } | Should -Not -Throw Test-Path -Path $sCS | Should -Be $true } - It "Test2: Try to override existing shared CS" { + It "Try to override existing shared CS" { { New-CredentialStore -Shared -Confirm:$false } | Should -Throw } - It "Test3: Reset shared CredentialStore" { + It "Reset shared CredentialStore" { $sCS = Get-DefaultCredentialStorePath -Shared $now = Get-Date $CS = Get-Content -Path $sCS -Raw | ConvertFrom-Json @@ -72,15 +72,15 @@ Describe "New-CredentialStore" { } } Context "Custom Shared CS tests" { - It "Test1: Create new custom shared" { + It "Create new custom shared" { $cCS = Join-Path -Path (Get-TempDir) -ChildPath "CredentialStore.json" - { New-CredentialStore -Path $cCS -Shared -Confirm:$false } | Should -Not -Throw + { New-CredentialStore -Path $cCS -Shared -Confirm:$false -SkipPFXCertCreation } | Should -Not -Throw } - It "Test2: Try to override exiting one" { + It "Try to override exiting one" { $cCS = Join-Path -Path (Get-TempDir) -ChildPath "CredentialStore.json" { New-CredentialStore -Path $cCS -Shared -Confirm:$false } | Should -Throw } - It "Test3: Reset existing custom CredentialStore" { + It "Reset existing custom CredentialStore" { $cCS = Join-Path -Path (Get-TempDir) -ChildPath "CredentialStore.json" { New-CredentialStore -Path $cCS -Shared -Force -Confirm:$false } | Should -Not -Throw } @@ -88,7 +88,11 @@ Describe "New-CredentialStore" { Context "Test exception handling" { Mock Out-File { throw "foobar exception" } It "JSON Conversion should fail and throw" { - { New-CredentialStore -Path (Join-Path -Path (Get-TempDir) -ChildPath '/dummy.json') -Shared -Confirm:$false } | Should -Throw + { + New-CredentialStore -Path ( + Join-Path -Path (Get-TempDir) -ChildPath '/dummy.json' + ) -Shared -Confirm:$false + } | Should -Throw } } Context "Tests for Windows certificate store" { -- 2.45.2 From d34b5744fc842c015d4bb34bf0e4a30f9b600db7 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 1 Jul 2022 11:30:53 +0200 Subject: [PATCH 41/46] wip --- src/Store/Test-CredentialStore.Tests.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Store/Test-CredentialStore.Tests.ps1 b/src/Store/Test-CredentialStore.Tests.ps1 index b79e7f1..3ebb096 100644 --- a/src/Store/Test-CredentialStore.Tests.ps1 +++ b/src/Store/Test-CredentialStore.Tests.ps1 @@ -13,16 +13,16 @@ BeforeAll { Describe "Test-CredentialStore" { Context "Basic logic tests" { - It "Test1: Should Not Throw" { + It "Should Not Throw" { $TestCredentialStore = './resources/cs/CredentialStore.json' { Test-CredentialStore -Shared -Path $TestCredentialStore } | Should -Not -Throw } - It "Test2: Read valid CredentialStore" { + It "Read valid CredentialStore" { $TestCredentialStore = './resources/cs/CredentialStore.json' $res = Test-CredentialStore -Shared -Path $TestCredentialStore $res | Should -Be $true } - It "Test3: Read a broken CredentialStore" { + It "Read a broken CredentialStore" -Skip { $BrokenCS = './resources/cs/Broken_CS.json' $oWarningPreference = $WarningPreference $WarningPreference = 'SilentlyContinue' @@ -30,7 +30,7 @@ Describe "Test-CredentialStore" { $res | Should -Be $false $WarningPreference = $oWarningPreference } - It "Test4: Not existing path should return false" { + It "Not existing path should return false" { if ($isWindows -or ($PSVersionTable.PSVersion.Major -eq 5)) { Test-CredentialStore -Shared -Path 'C:\foobar\CredentialStore.json' | Should -Be $false } @@ -38,7 +38,7 @@ Describe "Test-CredentialStore" { Test-CredentialStore -Shared -Path '/var/opt/foo.json' | Should -Be $false } } - It "Test5: testing private CredentialStore path" { + It "testing private CredentialStore path" { if (Test-Path -Path (Get-DefaultCredentialStorePath)) { Remove-Item -Path (Get-DefaultCredentialStorePath) } -- 2.45.2 From 2045dad0634fe882558cd0d9dc0ee05b458d1143 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 4 Jul 2022 12:44:43 +0200 Subject: [PATCH 42/46] add build meta ignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 18af3f7..fc98b4f 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ data/*.csv # Ignore Unit Test result files coverage.xml testResults.xml + +# Optional build state file +STATE.xml -- 2.45.2 From 5b9cfd83ae7b6c4cfa31362bb7a7ecedb6ab42a8 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 4 Jul 2022 12:45:08 +0200 Subject: [PATCH 43/46] remove obsolete mocking syntax for privates --- src/Private/Resolve-Dependency.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Private/Resolve-Dependency.Tests.ps1 b/src/Private/Resolve-Dependency.Tests.ps1 index 7c3f2a1..53ee91e 100644 --- a/src/Private/Resolve-Dependency.Tests.ps1 +++ b/src/Private/Resolve-Dependency.Tests.ps1 @@ -14,10 +14,10 @@ BeforeAll { Describe "Resolve-Dependency" { Context "Basic syntax check" { BeforeAll { - Mock -ModuleName 'PSCredentialStore' Get-ModuleBase { + Mock Get-ModuleBase { return (Join-Path -Path $PWD -ChildPath '/resources') } - Mock -ModuleName 'PSCredentialStore' Test-Module { + Mock Test-Module { return $true } } @@ -34,7 +34,7 @@ Describe "Resolve-Dependency" { Mock Get-ModuleBase { if ($IsWindows) { return "C:\" } elseif ($isLinux) { return "/" } - } -ModuleName 'PSCredentialStore' + } It "Missing dependency file should not cause an error" { { Resolve-Dependency -Name 'awesome' } | Should -Not -Throw } -- 2.45.2 From 8d49ea5d70fb6cd3935881fb80885c4c60958124 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Wed, 6 Jul 2022 16:09:30 +0200 Subject: [PATCH 44/46] replace github - gitea files --- .../default.md => .gitea/ISSUE_TEMPLATE.md | 13 ++++++------- .../bug_report.md => .gitea/ISSUE_TEMPLATE/Bug.md | 14 ++++++-------- .../ISSUE_TEMPLATE/Enhancement.md | 14 ++++++-------- .../PULL_REQUEST_TEMPLATE.md | 0 4 files changed, 18 insertions(+), 23 deletions(-) rename .github/ISSUE_TEMPLATE/default.md => .gitea/ISSUE_TEMPLATE.md (58%) rename .github/ISSUE_TEMPLATE/bug_report.md => .gitea/ISSUE_TEMPLATE/Bug.md (86%) rename .github/ISSUE_TEMPLATE/feature_request.md => .gitea/ISSUE_TEMPLATE/Enhancement.md (69%) rename .github/pull_request_template.md => .gitea/PULL_REQUEST_TEMPLATE.md (100%) diff --git a/.github/ISSUE_TEMPLATE/default.md b/.gitea/ISSUE_TEMPLATE.md similarity index 58% rename from .github/ISSUE_TEMPLATE/default.md rename to .gitea/ISSUE_TEMPLATE.md index c458e70..049a408 100644 --- a/.github/ISSUE_TEMPLATE/default.md +++ b/.gitea/ISSUE_TEMPLATE.md @@ -1,11 +1,10 @@ ---- -name: Default -about: Use this template if nothing seems to work. +---- +name: "Default" +about: "Use this template if nothing seems to work." title: ":question: " -labels: question -assignees: '' - ---- +labels: + - question +---- #### :grey_question: Simply ask your question here: :grey_question: diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.gitea/ISSUE_TEMPLATE/Bug.md similarity index 86% rename from .github/ISSUE_TEMPLATE/bug_report.md rename to .gitea/ISSUE_TEMPLATE/Bug.md index f1d8d08..40f0ef0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.gitea/ISSUE_TEMPLATE/Bug.md @@ -1,12 +1,10 @@ ---- -name: Bug report -about: This template is used to report bugs! +---- +name: "Bug" +about: "This template is used to report bugs!" title: ":lady_beetle: " -labels: bug -assignees: OCram85 - ---- - +labels: + - bug +---- diff --git a/.github/pull_request_template.md b/.gitea/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from .github/pull_request_template.md rename to .gitea/PULL_REQUEST_TEMPLATE.md -- 2.45.2 From 7231be25aa40abcb77974485efe46a0ae5dcbec4 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Wed, 13 Jul 2022 08:49:40 +0200 Subject: [PATCH 45/46] disable codecov --- .drone.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.drone.yml b/.drone.yml index 1a9e24e..86f4979 100644 --- a/.drone.yml +++ b/.drone.yml @@ -39,15 +39,16 @@ steps: Invoke-UnitTest -Verbosity 'Normal' -ExcludeTag @( 'Integration', 'Disabled') -ErrorAction 'Stop' }" - - name: Coverage - image: plugins/codecov - settings: - token: - from_secret: CodeCovToken - files: - - coverage.xml - depends_on: - - UnitTests + # Disable Codecov for self hosted git + #- name: Coverage + # image: plugins/codecov + # settings: + # token: + # from_secret: CodeCovToken + # files: + # - coverage.xml + # depends_on: + # - UnitTests - name: SetPipelineState image: mcr.microsoft.com/powershell:lts-7.2-ubuntu-focal @@ -60,4 +61,4 @@ steps: depends_on: - LintTests - UnitTests - - Coverage + #- Coverage -- 2.45.2 From b86a39e959e17d7101366e70be8fff45ce5ecaa8 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Thu, 14 Jul 2022 13:17:29 +0200 Subject: [PATCH 46/46] remove temp build files --- STATE.xml | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 STATE.xml diff --git a/STATE.xml b/STATE.xml deleted file mode 100644 index debbefc..0000000 --- a/STATE.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - System.Management.Automation.PSCustomObject - System.Object - - - - - System.Object[] - System.Array - System.Object - - - lint - - - - - \ No newline at end of file -- 2.45.2