Skip to content

Commit

Permalink
remove tests that represent impossible scenarios
Browse files Browse the repository at this point in the history
Signed-off-by: AdamKorcz <adam@adalogics.com>
  • Loading branch information
AdamKorcz committed Feb 24, 2024
1 parent 21fdf63 commit a4896eb
Showing 1 changed file with 0 additions and 255 deletions.
255 changes: 0 additions & 255 deletions checks/evaluation/branch_protection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1356,261 +1356,6 @@ func TestBranchProtection(t *testing.T) {
NumberOfInfo: 9,
},
},
{
name: "2 branches, one is protected, one is not",
findings: []finding.Finding{
{
Probe: "blocksDeleteOnBranches",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "blocksForcePushOnBranches",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "branchesAreProtected",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "branchProtectionAppliesToAdmins",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "dismissesStaleReviews",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "requiresApproversForPullRequests",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
"numberOfRequiredReviewers": "1",
},
},
{
Probe: "requiresCodeOwnersReview",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
"CodeownersFiles": "2",
},
},
{
Probe: "requiresLastPushApproval",
Outcome: finding.OutcomeNegative,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "requiresUpToDateBranches",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "runsStatusChecksBeforeMerging",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "requiresPRsToChangeCode",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main2": "1",
},
},
{
Probe: "blocksDeleteOnBranches",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main2": "1",
},
},
{
Probe: "blocksForcePushOnBranches",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main2": "1",
},
},
{
Probe: "branchesAreProtected",
Outcome: finding.OutcomeNegative,
Values: map[string]string{
"main2": "1",
},
},
{
Probe: "branchProtectionAppliesToAdmins",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main2": "1",
},
},
{
Probe: "dismissesStaleReviews",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main2": "1",
},
},
{
Probe: "requiresApproversForPullRequests",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main2": "1",
"numberOfRequiredReviewers": "1",
},
},
{
Probe: "requiresCodeOwnersReview",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main2": "1",
"CodeownersFiles": "2",
},
},
{
Probe: "requiresLastPushApproval",
Outcome: finding.OutcomeNegative,
Values: map[string]string{
"main2": "1",
},
},
{
Probe: "requiresUpToDateBranches",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main2": "1",
},
},
{
Probe: "runsStatusChecksBeforeMerging",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main2": "1",
},
},
{
Probe: "requiresPRsToChangeCode",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main2": "1",
},
},
},
result: scut.TestReturn{
Score: 8,
NumberOfWarn: 3,
NumberOfInfo: 7,
},
},
{
name: "1 branch that is not protected",
findings: []finding.Finding{
{
Probe: "blocksDeleteOnBranches",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "blocksForcePushOnBranches",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "branchesAreProtected",
Outcome: finding.OutcomeNegative,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "branchProtectionAppliesToAdmins",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "dismissesStaleReviews",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "requiresApproversForPullRequests",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
"numberOfRequiredReviewers": "1",
},
},
{
Probe: "requiresCodeOwnersReview",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "requiresLastPushApproval",
Outcome: finding.OutcomeNegative,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "requiresUpToDateBranches",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "runsStatusChecksBeforeMerging",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
{
Probe: "requiresPRsToChangeCode",
Outcome: finding.OutcomePositive,
Values: map[string]string{
"main": "1",
},
},
},
result: scut.TestReturn{
Score: 5,
NumberOfWarn: 1,
},
},
}
for _, tt := range tests {
tt := tt
Expand Down

0 comments on commit a4896eb

Please sign in to comment.