From 10054b9c04f802245cf9133ae435253858832ebb Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 27 Nov 2023 12:52:19 +0100 Subject: [PATCH] test: git@ repos --- updater/tests/nonbot-commits.ps1 | 49 +++++++++++++++++--------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/updater/tests/nonbot-commits.ps1 b/updater/tests/nonbot-commits.ps1 index 02cfba4..b2a0f30 100644 --- a/updater/tests/nonbot-commits.ps1 +++ b/updater/tests/nonbot-commits.ps1 @@ -2,32 +2,35 @@ Set-StrictMode -Version latest . "$PSScriptRoot/common/test-utils.ps1" -function NonBotCommits([Parameter(Mandatory = $true)][string] $branch) +foreach ($repoUrl in @('https://github.com/getsentry/github-workflows', 'git@github.com:getsentry/github-workflows.git')) { - $result = & "$PSScriptRoot/../scripts/nonbot-commits.ps1" ` - -RepoUrl 'https://github.com/getsentry/github-workflows' -MainBranch 'main' -PrBranch $branch - if (-not $?) - { - throw $result - } - elseif ($LASTEXITCODE -ne 0) + + function NonBotCommits([Parameter(Mandatory = $true)][string] $branch) { - throw "Script finished with exit code $LASTEXITCODE" + $result = & "$PSScriptRoot/../scripts/nonbot-commits.ps1" -RepoUrl $repoUrl -MainBranch 'main' -PrBranch $branch + if (-not $?) + { + throw $result + } + elseif ($LASTEXITCODE -ne 0) + { + throw "Script finished with exit code $LASTEXITCODE" + } + $result } - $result -} -RunTest 'empty-if-all-commits-by-bot' { - $commits = NonBotCommits 'deps/updater/tests/sentry-cli.properties' - AssertEqual '' "$commits" -} + RunTest 'empty-if-all-commits-by-bot' { + $commits = NonBotCommits 'deps/updater/tests/sentry-cli.properties' + AssertEqual '' "$commits" + } -RunTest 'empty-if-branch-doesnt-exist' { - $commits = NonBotCommits 'non-existent-branch' - AssertEqual '' "$commits" -} + RunTest 'empty-if-branch-doesnt-exist' { + $commits = NonBotCommits 'non-existent-branch' + AssertEqual '' "$commits" + } -RunTest 'non-empty-if-changed' { - $commits = NonBotCommits 'test/nonbot-commits' - AssertEqual '0b7d9cc test: keep this branch' "$commits" -} + RunTest 'non-empty-if-changed' { + $commits = NonBotCommits 'test/nonbot-commits' + AssertEqual '0b7d9cc test: keep this branch' "$commits" + } +} \ No newline at end of file