From 657a12a58a92ab517e9d245d66610c0a0ea7e88f Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Tue, 26 May 2020 10:55:34 -0700 Subject: [PATCH 1/9] Trying to fix CI build Pester was failing to save its output because the output directory didn't exist. Without that, it couldn't actually publish the results. --- build/pipelines/templates/run-unitTests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/build/pipelines/templates/run-unitTests.yaml b/build/pipelines/templates/run-unitTests.yaml index 58b83298..a97b1aee 100644 --- a/build/pipelines/templates/run-unitTests.yaml +++ b/build/pipelines/templates/run-unitTests.yaml @@ -19,6 +19,7 @@ steps: displayName: 'Install Pester' - powershell: | + $null = New-Item -Path ..\ -Name Pester -ItemType Directory -Force Invoke-Pester -CodeCoverage .\*.ps*1 -CodeCoverageOutputFile ../Pester/coverage.xml -CodeCoverageOutputFileFormat JaCoCo -EnableExit -Strict -OutputFile ../Pester/test-results.xml -OutputFormat NUnitXml workingDirectory: '$(System.DefaultWorkingDirectory)' displayName: 'Run Unit Tests via Pester' From fed3a05eb09106c66e1dbe8383ef748f9e761e40 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Tue, 26 May 2020 15:34:42 -0700 Subject: [PATCH 2/9] Need to run the different OS jobs in series instead of parallel Since the UT's are all modifying the shared state of the same test GitHub account, they end up stomping over each other and causing erroneous failures. These jobs therefore need to unfortunately run in series instead of parallel. --- build/pipelines/azure-pipelines.ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/pipelines/azure-pipelines.ci.yaml b/build/pipelines/azure-pipelines.ci.yaml index d294cc72..1622803d 100644 --- a/build/pipelines/azure-pipelines.ci.yaml +++ b/build/pipelines/azure-pipelines.ci.yaml @@ -30,6 +30,7 @@ jobs: - job: Linux pool: vmImage: 'ubuntu-16.04' + dependsOn: Windows # Run in series instead of parallel because the UT's are modifying the same shared state steps: - template: ./templates/run-staticAnalysis.yaml - template: ./templates/run-unitTests.yaml @@ -37,6 +38,7 @@ jobs: - job: macOS pool: vmImage: 'macOS-10.14' + dependsOn: Linux # Run in series instead of parallel because the UT's are modifying the same shared state steps: - template: ./templates/run-staticAnalysis.yaml - template: ./templates/run-unitTests.yaml From 92c1693ec949bed6e794792031eb25212387fd8b Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 28 May 2020 10:12:16 -0700 Subject: [PATCH 3/9] Adding .gitattributes file to ensure consistent line endings for Settings.ps1 --- .gitattributes | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..477d176a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# Need to make sure that this file always has consistent line endings since we store the hash +# of it in GitHubConfiguration.ps1 in order to be able to determine if it has been modified +# or not. +Tests/Config/Settings.ps1 text eol=crlf \ No newline at end of file From e89f79250ce53d1b0075e53a21e68de26b2158d4 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 28 May 2020 10:13:10 -0700 Subject: [PATCH 4/9] Temporarily modifying CI pipeline to test .gitattributes fix --- build/pipelines/azure-pipelines.ci.yaml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/build/pipelines/azure-pipelines.ci.yaml b/build/pipelines/azure-pipelines.ci.yaml index 1622803d..b9a18097 100644 --- a/build/pipelines/azure-pipelines.ci.yaml +++ b/build/pipelines/azure-pipelines.ci.yaml @@ -24,21 +24,23 @@ jobs: vmImage: 'vs2017-win2016' steps: - template: ./templates/verify-testConfigSettingsHash.yaml - - template: ./templates/run-staticAnalysis.yaml - - template: ./templates/run-unitTests.yaml +# - template: ./templates/run-staticAnalysis.yaml +# - template: ./templates/run-unitTests.yaml - job: Linux pool: vmImage: 'ubuntu-16.04' - dependsOn: Windows # Run in series instead of parallel because the UT's are modifying the same shared state +# dependsOn: Windows # Run in series instead of parallel because the UT's are modifying the same shared state steps: - - template: ./templates/run-staticAnalysis.yaml - - template: ./templates/run-unitTests.yaml + - template: ./templates/verify-testConfigSettingsHash.yaml +# - template: ./templates/run-staticAnalysis.yaml +# - template: ./templates/run-unitTests.yaml - job: macOS pool: vmImage: 'macOS-10.14' - dependsOn: Linux # Run in series instead of parallel because the UT's are modifying the same shared state +# dependsOn: Linux # Run in series instead of parallel because the UT's are modifying the same shared state steps: - - template: ./templates/run-staticAnalysis.yaml - - template: ./templates/run-unitTests.yaml + - template: ./templates/verify-testConfigSettingsHash.yaml +# - template: ./templates/run-staticAnalysis.yaml +# - template: ./templates/run-unitTests.yaml From e583f52120f9fc4f2bac25c3c91fc858f35f9bfe Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 28 May 2020 10:22:54 -0700 Subject: [PATCH 5/9] Revert temporary testing change and re-add hash verification for all platforms --- build/pipelines/azure-pipelines.ci.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/build/pipelines/azure-pipelines.ci.yaml b/build/pipelines/azure-pipelines.ci.yaml index b9a18097..9adc9f1a 100644 --- a/build/pipelines/azure-pipelines.ci.yaml +++ b/build/pipelines/azure-pipelines.ci.yaml @@ -24,23 +24,23 @@ jobs: vmImage: 'vs2017-win2016' steps: - template: ./templates/verify-testConfigSettingsHash.yaml -# - template: ./templates/run-staticAnalysis.yaml -# - template: ./templates/run-unitTests.yaml + - template: ./templates/run-staticAnalysis.yaml + - template: ./templates/run-unitTests.yaml - job: Linux pool: vmImage: 'ubuntu-16.04' -# dependsOn: Windows # Run in series instead of parallel because the UT's are modifying the same shared state + dependsOn: Windows # Run in series instead of parallel because the UT's are modifying the same shared state steps: - template: ./templates/verify-testConfigSettingsHash.yaml -# - template: ./templates/run-staticAnalysis.yaml -# - template: ./templates/run-unitTests.yaml + - template: ./templates/run-staticAnalysis.yaml + - template: ./templates/run-unitTests.yaml - job: macOS pool: vmImage: 'macOS-10.14' -# dependsOn: Linux # Run in series instead of parallel because the UT's are modifying the same shared state + dependsOn: Linux # Run in series instead of parallel because the UT's are modifying the same shared state steps: - template: ./templates/verify-testConfigSettingsHash.yaml -# - template: ./templates/run-staticAnalysis.yaml -# - template: ./templates/run-unitTests.yaml + - template: ./templates/run-staticAnalysis.yaml + - template: ./templates/run-unitTests.yaml From c9828eb535291fba6366c34946d2ba664abf5d6c Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 28 May 2020 12:11:13 -0700 Subject: [PATCH 6/9] Pester v5 was just released. Let's stick with v4 until we know these tests pass on v5 --- build/pipelines/templates/run-unitTests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pipelines/templates/run-unitTests.yaml b/build/pipelines/templates/run-unitTests.yaml index a97b1aee..ab8a4f60 100644 --- a/build/pipelines/templates/run-unitTests.yaml +++ b/build/pipelines/templates/run-unitTests.yaml @@ -15,7 +15,7 @@ steps: - powershell: | - Install-Module -Name Pester -Repository PSGallery -Scope CurrentUser -AllowClobber -SkipPublisherCheck -Force -Verbose + Install-Module -Name Pester -Repository PSGallery -Scope CurrentUser -AllowClobber -SkipPublisherCheck -RequiredVersion 4.10.1 -Force -Verbose displayName: 'Install Pester' - powershell: | From 1b61ef916943a6b05baecf93720aa043f12df298 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 28 May 2020 12:25:44 -0700 Subject: [PATCH 7/9] Fixing expected HTML output for default README.md for GitHubContents.tests.ps1 --- Tests/GitHubContents.tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/GitHubContents.tests.ps1 b/Tests/GitHubContents.tests.ps1 index 554ce61b..474d4f1d 100644 --- a/Tests/GitHubContents.tests.ps1 +++ b/Tests/GitHubContents.tests.ps1 @@ -22,7 +22,7 @@ try # Need two separate blocks to set constants because we need to reference a constant from the first block in this block. @{ - htmlOutput = "

$repoGuid

" + htmlOutput = "

$repoGuid

" rawOutput = "# $repoGuid" }.GetEnumerator() | ForEach-Object { Set-Variable -Force -Scope Script -Option ReadOnly -Visibility Private -Name $_.Key -Value $_.Value From 9eb0aac50a3508f702b6732e20a3cb8481435c78 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 28 May 2020 12:55:36 -0700 Subject: [PATCH 8/9] Fixing typo in ciOrganizationName pipeline variable which was causing a number of test failures --- build/pipelines/templates/run-unitTests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pipelines/templates/run-unitTests.yaml b/build/pipelines/templates/run-unitTests.yaml index ab8a4f60..53d64828 100644 --- a/build/pipelines/templates/run-unitTests.yaml +++ b/build/pipelines/templates/run-unitTests.yaml @@ -26,7 +26,7 @@ steps: env: ciAccessToken: $(GitHubAccessToken) ciOwnerName: $(GitHubOwnerName) - ciOrganizatioName: $(GitHubOrganizationName) + ciOrganizationName: $(GitHubOrganizationName) - task: PublishTestResults@2 displayName: 'Publish Test Results' From 696a493103ba838e04890d40a97604f9ae9b0b67 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 28 May 2020 15:29:23 -0700 Subject: [PATCH 9/9] Update CONTRIBUTING documentation to note required Pester version --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e62fffd8..1cf400fa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -295,7 +295,7 @@ This module supports testing using the [Pester UT framework](https://github.com/ To install it: ```powershell -Install-Module -Name Pester +Install-Module -Name Pester -RequiredVersion 4.10.1 -AllowClobber -SkipPublisherCheck -Force ``` #### Configuring Your Environment