From 699e91cb16e92ee6f8a78b75eff74e3a70708585 Mon Sep 17 00:00:00 2001 From: AlexanderSehr Date: Sun, 2 Mar 2025 21:09:15 +0100 Subject: [PATCH] Set tests to fail instead of producing a warning --- .../compliance/module.tests.ps1 | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/utilities/pipelines/staticValidation/compliance/module.tests.ps1 b/utilities/pipelines/staticValidation/compliance/module.tests.ps1 index ccc2a4bb76..a2da2defef 100644 --- a/utilities/pipelines/staticValidation/compliance/module.tests.ps1 +++ b/utilities/pipelines/staticValidation/compliance/module.tests.ps1 @@ -1253,15 +1253,15 @@ Describe 'Module tests' -Tag 'Module' { } } # To be re-enabled once more modules are prepared. The code right below can then be removed. - # $incorrectTypes | Should -BeNullOrEmpty -Because ('no user-defined type should be declared as an array, but instead the parameter that uses the type. This makes the template and its parameters easier to understand. Found incorrect items: [{0}].' -f ($incorrectTypes -join ', ')) - if ($incorrectTypes.Count -gt 0) { - $warningMessage = ('No user-defined type should be declared as an array, but instead the parameter that uses the type. This makes the template and its parameters easier to understand. Found incorrect items: [{0}].' -f ($incorrectTypes -join ', ')) - Write-Warning $warningMessage - - Write-Output @{ - Warning = $warningMessage - } - } + $incorrectTypes | Should -BeNullOrEmpty -Because ('no user-defined type should be declared as an array, but instead the parameter that uses the type. This makes the template and its parameters easier to understand. Found incorrect items: [{0}].' -f ($incorrectTypes -join ', ')) + # if ($incorrectTypes.Count -gt 0) { + # $warningMessage = ('No user-defined type should be declared as an array, but instead the parameter that uses the type. This makes the template and its parameters easier to understand. Found incorrect items: [{0}].' -f ($incorrectTypes -join ', ')) + # Write-Warning $warningMessage + + # Write-Output @{ + # Warning = $warningMessage + # } + # } } It '[] A UDT should not be nullable, but instead the parameter that uses it. AVM-Spec-Ref: BCPNFR18.' -TestCases $moduleFolderTestCases -Tag 'UDT' { @@ -1283,15 +1283,15 @@ Describe 'Module tests' -Tag 'Module' { } # To be re-enabled once more modules are prepared. The code right below can then be removed. - # $incorrectTypes | Should -BeNullOrEmpty -Because ('no user-defined type should be declared as nullable, but instead the parameter that uses the type. This makes the template and its parameters easier to understand. Found incorrect items: [{0}].' -f ($incorrectTypes -join ', ')) - if ($incorrectTypes.Count -gt 0) { - $warningMessage = ('No user-defined type should be declared as nullable, but instead the parameter that uses the type. This makes the template and its parameters easier to understand. Found incorrect items: [{0}].' -f ($incorrectTypes -join ', ')) - Write-Warning $warningMessage - - Write-Output @{ - Warning = $warningMessage - } - } + $incorrectTypes | Should -BeNullOrEmpty -Because ('no user-defined type should be declared as nullable, but instead the parameter that uses the type. This makes the template and its parameters easier to understand. Found incorrect items: [{0}].' -f ($incorrectTypes -join ', ')) + # if ($incorrectTypes.Count -gt 0) { + # $warningMessage = ('No user-defined type should be declared as nullable, but instead the parameter that uses the type. This makes the template and its parameters easier to understand. Found incorrect items: [{0}].' -f ($incorrectTypes -join ', ')) + # Write-Warning $warningMessage + + # Write-Output @{ + # Warning = $warningMessage + # } + # } } It '[] A UDT should always be camel-cased and end with the suffix "Type". AVM-Spec-Ref: BCPNFR19.' -TestCases $moduleFolderTestCases -Tag 'UDT' { @@ -1319,15 +1319,15 @@ Describe 'Module tests' -Tag 'Module' { } # To be re-enabled once more modules are prepared. The code right below can then be removed. - # $incorrectTypes | Should -BeNullOrEmpty -Because ('every used-defined type should be camel-cased and end with the suffix "Type". Found incorrect items: [{0}].' -f ($incorrectTypes -join ', ')) - if ($incorrectTypes.Count -gt 0) { - $warningMessage = ('Every used-defined type should be camel-cased and end with the suffix "Type". Found incorrect items: [{0}].' -f ($incorrectTypes -join ', ')) - Write-Warning $warningMessage - - Write-Output @{ - Warning = $warningMessage - } - } + $incorrectTypes | Should -BeNullOrEmpty -Because ('every used-defined type should be camel-cased and end with the suffix "Type". Found incorrect items: [{0}].' -f ($incorrectTypes -join ', ')) + # if ($incorrectTypes.Count -gt 0) { + # $warningMessage = ('Every used-defined type should be camel-cased and end with the suffix "Type". Found incorrect items: [{0}].' -f ($incorrectTypes -join ', ')) + # Write-Warning $warningMessage + + # Write-Output @{ + # Warning = $warningMessage + # } + # } } } }