forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Filter for default-branch selection (go-gitea#29388) Fixing the issue when status check per rule matches multiple actions (go-gitea#29631) Fix 500 when deleting account with incorrect password or unsupported login type (go-gitea#29579) Partially enable MSSQL case-sensitive collation support (go-gitea#29238)
- Loading branch information
Showing
10 changed files
with
113 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright 2024 The Gitea Authors. | ||
// All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package pull | ||
|
||
import ( | ||
"testing" | ||
|
||
git_model "code.gitea.io/gitea/models/git" | ||
"code.gitea.io/gitea/modules/structs" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestMergeRequiredContextsCommitStatus(t *testing.T) { | ||
testCases := [][]*git_model.CommitStatus{ | ||
{ | ||
{Context: "Build 1", State: structs.CommitStatusSuccess}, | ||
{Context: "Build 2", State: structs.CommitStatusSuccess}, | ||
{Context: "Build 3", State: structs.CommitStatusSuccess}, | ||
}, | ||
{ | ||
{Context: "Build 1", State: structs.CommitStatusSuccess}, | ||
{Context: "Build 2", State: structs.CommitStatusSuccess}, | ||
{Context: "Build 2t", State: structs.CommitStatusPending}, | ||
}, | ||
{ | ||
{Context: "Build 1", State: structs.CommitStatusSuccess}, | ||
{Context: "Build 2", State: structs.CommitStatusSuccess}, | ||
{Context: "Build 2t", State: structs.CommitStatusFailure}, | ||
}, | ||
{ | ||
{Context: "Build 1", State: structs.CommitStatusSuccess}, | ||
{Context: "Build 2", State: structs.CommitStatusSuccess}, | ||
{Context: "Build 2t", State: structs.CommitStatusSuccess}, | ||
}, | ||
{ | ||
{Context: "Build 1", State: structs.CommitStatusSuccess}, | ||
{Context: "Build 2", State: structs.CommitStatusSuccess}, | ||
{Context: "Build 2t", State: structs.CommitStatusSuccess}, | ||
}, | ||
} | ||
testCasesRequiredContexts := [][]string{ | ||
{"Build*"}, | ||
{"Build*", "Build 2t*"}, | ||
{"Build*", "Build 2t*"}, | ||
{"Build*", "Build 2t*", "Build 3*"}, | ||
{"Build*", "Build *", "Build 2t*", "Build 1*"}, | ||
} | ||
|
||
testCasesExpected := []structs.CommitStatusState{ | ||
structs.CommitStatusSuccess, | ||
structs.CommitStatusPending, | ||
structs.CommitStatusFailure, | ||
structs.CommitStatusPending, | ||
structs.CommitStatusSuccess, | ||
} | ||
|
||
for i, commitStatuses := range testCases { | ||
if MergeRequiredContextsCommitStatus(commitStatuses, testCasesRequiredContexts[i]) != testCasesExpected[i] { | ||
assert.Fail(t, "Test case failed", "Test case %d failed", i+1) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters