From e1b15ae8ed0e58fede9a0afdda07f14c53e7932f Mon Sep 17 00:00:00 2001 From: "Christoph Bergmeister [MVP]" Date: Fri, 28 Jan 2022 20:44:35 +0000 Subject: [PATCH 1/3] CI Retry test tasks in case of failure --- .azure-pipelines-ci/templates/test-powershell.yaml | 1 + .azure-pipelines-ci/templates/test-pwsh.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/.azure-pipelines-ci/templates/test-powershell.yaml b/.azure-pipelines-ci/templates/test-powershell.yaml index 306dab473..de3f30b68 100644 --- a/.azure-pipelines-ci/templates/test-powershell.yaml +++ b/.azure-pipelines-ci/templates/test-powershell.yaml @@ -6,6 +6,7 @@ steps: targetPath: '$(Build.SourcesDirectory)/out' - task: PowerShell@2 displayName: 'Test' + retryCountOnTaskFailure: 2 inputs: targetType: inline pwsh: false diff --git a/.azure-pipelines-ci/templates/test-pwsh.yaml b/.azure-pipelines-ci/templates/test-pwsh.yaml index 2661b2157..152458d6c 100644 --- a/.azure-pipelines-ci/templates/test-pwsh.yaml +++ b/.azure-pipelines-ci/templates/test-pwsh.yaml @@ -6,6 +6,7 @@ steps: targetPath: '$(Build.SourcesDirectory)/out' - task: PowerShell@2 displayName: 'Test' + retryCountOnTaskFailure: 2 inputs: targetType: inline pwsh: true From 5a5e3fdc80028251dc7eafcca7c8b45b92b6bac4 Mon Sep 17 00:00:00 2001 From: "Christoph Bergmeister [MVP]" Date: Fri, 28 Jan 2022 20:48:30 +0000 Subject: [PATCH 2/3] make test fail to show retry behaviour --- Tests/Engine/InvokeScriptAnalyzer.tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Engine/InvokeScriptAnalyzer.tests.ps1 b/Tests/Engine/InvokeScriptAnalyzer.tests.ps1 index 06b94cb78..24999998e 100644 --- a/Tests/Engine/InvokeScriptAnalyzer.tests.ps1 +++ b/Tests/Engine/InvokeScriptAnalyzer.tests.ps1 @@ -103,7 +103,7 @@ Describe "Test ScriptDefinition" { # this is a script with 12 parse errors $script = ');' * 12 $moreThanTenErrors = Invoke-ScriptAnalyzer -ScriptDefinition $script - $moreThanTenErrors.Count | Should -Be 12 + $moreThanTenErrors.Count | Should -Be 13 } } } From ead3683785271f410cd8a2bf96a0323affe40049 Mon Sep 17 00:00:00 2001 From: "Christoph Bergmeister [MVP]" Date: Fri, 28 Jan 2022 21:13:36 +0000 Subject: [PATCH 3/3] randomise error --- Tests/Engine/InvokeScriptAnalyzer.tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Engine/InvokeScriptAnalyzer.tests.ps1 b/Tests/Engine/InvokeScriptAnalyzer.tests.ps1 index 24999998e..cbfa772ea 100644 --- a/Tests/Engine/InvokeScriptAnalyzer.tests.ps1 +++ b/Tests/Engine/InvokeScriptAnalyzer.tests.ps1 @@ -103,7 +103,7 @@ Describe "Test ScriptDefinition" { # this is a script with 12 parse errors $script = ');' * 12 $moreThanTenErrors = Invoke-ScriptAnalyzer -ScriptDefinition $script - $moreThanTenErrors.Count | Should -Be 13 + $moreThanTenErrors.Count | Should -Be (12 + (Get-Random -Minimum 0 -Maximum 2)) } } }