From 6fe59fc7a70ffe31810e61179ea18a88a46cfcf5 Mon Sep 17 00:00:00 2001 From: Danielle Adams Date: Mon, 26 Feb 2024 12:28:31 -0700 Subject: [PATCH] ARCH-2011 - Renaming for the multiple trx files and single trx file. --- .github/workflows/build-and-review-pr.yml | 20 ++++----- .../expected-test-results.md | 4 +- .../multiple-trx/expected-test-results.md | 4 +- .../multiple-trx/{fidget.trx => trx1.trx} | 6 +-- test/files/multiple-trx/trx2.trx | 44 +++++++++++++++++++ test/files/multiple-trx/widget.trx | 44 ------------------- .../single-test/expected-test-results.md | 2 +- test/files/single-test/single-test.trx | 6 +-- test/update-failing-status-check.js | 9 ++-- 9 files changed, 71 insertions(+), 68 deletions(-) rename test/files/multiple-trx/{fidget.trx => trx1.trx} (62%) create mode 100644 test/files/multiple-trx/trx2.trx delete mode 100644 test/files/multiple-trx/widget.trx diff --git a/.github/workflows/build-and-review-pr.yml b/.github/workflows/build-and-review-pr.yml index 3c57f8a..668cf89 100644 --- a/.github/workflows/build-and-review-pr.yml +++ b/.github/workflows/build-and-review-pr.yml @@ -550,9 +550,9 @@ jobs: if: always() run: | # Verify the trx-files list matches what we expect - fidget="./test/files/multiple-trx/fidget.trx" - widget="./test/files/multiple-trx/widget.trx" - ./test/assert-values-match.sh --name "trx-files output" --expected "[$fidget,$widget]" --actual "${{ steps.multiple-trx.outputs.trx-files }}" + trx1="./test/files/multiple-trx/trx1.trx" + trx2="./test/files/multiple-trx/trx2.trx" + ./test/assert-values-match.sh --name "trx-files output" --expected "[$trx1,$trx2]" --actual "${{ steps.multiple-trx.outputs.trx-files }}" # Verify the test-outcome is passed ./test/assert-values-match.sh --name "test-outcome output" --expected "Passed" --actual "${{ steps.multiple-trx.outputs.test-outcome }}" @@ -593,7 +593,7 @@ jobs: uses: ./ with: github-token: '${{ secrets.GITHUB_TOKEN }}' - base-directory: './test/files/failing-test' + base-directory: './test/files/failing-test-ignore' create-results-file: true # Keep this so we have an "actual" output to compare against create-status-check: false create-pr-comment: false @@ -703,23 +703,23 @@ jobs: const expectedBody = fs.readFileSync('./test-results.md', 'utf8'); const expectedFidgetValues = { - name: 'status check - dotnet unit tests (fidget.tests)', + name: 'status check - dotnet unit tests (multiple.trx1.tests)', status: 'completed', conclusion: 'success', - title: 'FIDGET.TESTS', + title: 'MULTIPLE.TRX1.TESTS', text: expectedBody }; - const actualFidgetCheck = actualStatusChecks.find(check => check.name.includes('fidget')); + const actualFidgetCheck = actualStatusChecks.find(check => check.name.includes('trx1')); assertStatusCheckMatchesExpectations(core, actualFidgetCheck, expectedFidgetValues); const expectedWidgetValues = { - name: 'status check - dotnet unit tests (widget.tests)', + name: 'status check - dotnet unit tests (multiple.trx2.tests)', status: 'completed', conclusion: 'success', - title: 'WIDGET.TESTS', + title: 'MULTIPLE.TRX2.TESTS', text: expectedBody }; - const actualWidgetCheck = actualStatusChecks.find(check => check.name.includes('widget')); + const actualWidgetCheck = actualStatusChecks.find(check => check.name.includes('trx2')); assertStatusCheckMatchesExpectations(core, actualWidgetCheck, expectedWidgetValues); - name: '-------------------------------------------------------------------------------------------------------------' diff --git a/test/files/failing-test-ignore/expected-test-results.md b/test/files/failing-test-ignore/expected-test-results.md index 17025be..24952d0 100644 --- a/test/files/failing-test-ignore/expected-test-results.md +++ b/test/files/failing-test-ignore/expected-test-results.md @@ -1,7 +1,7 @@ -# Ignore.Failures +# IGNORE.FAILURES -![Generic badge](https://img.shields.io/badge/1/4-FAILED-red.svg) +![Generic badge](https://img.shields.io/badge/1/2-FAILED-red.svg)
Duration: 0.805 seconds diff --git a/test/files/multiple-trx/expected-test-results.md b/test/files/multiple-trx/expected-test-results.md index 6814eaa..241b476 100644 --- a/test/files/multiple-trx/expected-test-results.md +++ b/test/files/multiple-trx/expected-test-results.md @@ -1,5 +1,5 @@ -# FIDGET.TESTS +# MULTIPLE.TRX1.TESTS ![Generic badge](https://img.shields.io/badge/1/1-PASSED-brightgreen.svg)
@@ -50,7 +50,7 @@
-# WIDGET.TESTS +# MULTIPLE.TRX2.TESTS ![Generic badge](https://img.shields.io/badge/4/4-PASSED-brightgreen.svg)
diff --git a/test/files/multiple-trx/fidget.trx b/test/files/multiple-trx/trx1.trx similarity index 62% rename from test/files/multiple-trx/fidget.trx rename to test/files/multiple-trx/trx1.trx index b9f21a3..0e072c0 100644 --- a/test/files/multiple-trx/fidget.trx +++ b/test/files/multiple-trx/trx1.trx @@ -5,12 +5,12 @@ - + - + - + diff --git a/test/files/multiple-trx/trx2.trx b/test/files/multiple-trx/trx2.trx new file mode 100644 index 0000000..2397633 --- /dev/null +++ b/test/files/multiple-trx/trx2.trx @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/files/multiple-trx/widget.trx b/test/files/multiple-trx/widget.trx deleted file mode 100644 index 9931ef2..0000000 --- a/test/files/multiple-trx/widget.trx +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/files/single-test/expected-test-results.md b/test/files/single-test/expected-test-results.md index 134e5e5..1c4ff48 100644 --- a/test/files/single-test/expected-test-results.md +++ b/test/files/single-test/expected-test-results.md @@ -1,5 +1,5 @@ -# DIGIT.TESTS +# SINGLE.TESTS ![Generic badge](https://img.shields.io/badge/1/1-PASSED-brightgreen.svg)
diff --git a/test/files/single-test/single-test.trx b/test/files/single-test/single-test.trx index f1b2d5e..2cb2119 100644 --- a/test/files/single-test/single-test.trx +++ b/test/files/single-test/single-test.trx @@ -5,12 +5,12 @@ - + - + - + diff --git a/test/update-failing-status-check.js b/test/update-failing-status-check.js index 17e4e66..f0b70d5 100644 --- a/test/update-failing-status-check.js +++ b/test/update-failing-status-check.js @@ -27,6 +27,9 @@ module.exports = async (github, core, statusCheckId) => { return; } + const updatedText = `> [!IMPORTANT] +> This status check was purposely created with a \`failure\` conclusion. We don't want this to prevent the PR from being merged though, so change the conclusion to \`neutral\` after the tests have run. +${actualCheck.output.text}`; await github.rest.checks .update({ owner: 'im-open', @@ -35,9 +38,9 @@ module.exports = async (github, core, statusCheckId) => { name: `${actualCheck.name} - UPDATED`, conclusion: 'neutral', output: { - title: `${actualCheck.output.title} - Updated`, - summary: `${actualCheck.output.summary} - Updated`, - text: `# Test Update\n> [!IMPORTANT]\n> This status check has been modified with a \`neutral\` status. It was purposely created with a 'failure' conclusion but we don't want this to prevent the PR from being merged.\n${actualCheck.output.text}` + title: `${actualCheck.output.title}`, + summary: `${actualCheck.output.summary}`, + text: updatedText } }) .then(() => {