(t *testing.T)
| 53 | } |
| 54 | |
| 55 | func TestReleaseAndDevBranchProtected(t *testing.T) { |
| 56 | t.Parallel() |
| 57 | |
| 58 | rel1 := "release/v.1" |
| 59 | sha := "8fb3cb86082b17144a80402f5367ae65f06083bd" |
| 60 | main := "main" |
| 61 | trueVal := true |
| 62 | falseVal := false |
| 63 | var zeroVal int32 |
| 64 | |
| 65 | var oneVal int32 = 1 |
| 66 | |
| 67 | tests := []struct { |
| 68 | name string |
| 69 | defaultBranch string |
| 70 | branches []*clients.BranchRef |
| 71 | releases []string |
| 72 | repoFiles []string |
| 73 | expected scut.TestReturn |
| 74 | nonadmin bool |
| 75 | }{ |
| 76 | { |
| 77 | name: "Nil release and main branch names", |
| 78 | expected: scut.TestReturn{ |
| 79 | Error: nil, |
| 80 | Score: checker.InconclusiveResultScore, |
| 81 | NumberOfWarn: 0, |
| 82 | NumberOfInfo: 0, |
| 83 | NumberOfDebug: 0, |
| 84 | }, |
| 85 | defaultBranch: main, |
| 86 | branches: []*clients.BranchRef{ |
| 87 | { |
| 88 | Protected: &trueVal, |
| 89 | BranchProtectionRule: clients.BranchProtectionRule{ |
| 90 | CheckRules: clients.StatusChecksRule{ |
| 91 | RequiresStatusChecks: &trueVal, |
| 92 | UpToDateBeforeMerge: &trueVal, |
| 93 | Contexts: []string{"foo"}, |
| 94 | }, |
| 95 | PullRequestRule: clients.PullRequestRule{ |
| 96 | Required: &trueVal, |
| 97 | DismissStaleReviews: &trueVal, |
| 98 | RequireCodeOwnerReviews: &trueVal, |
| 99 | RequiredApprovingReviewCount: &oneVal, |
| 100 | }, |
| 101 | EnforceAdmins: &trueVal, |
| 102 | RequireLinearHistory: &trueVal, |
| 103 | AllowForcePushes: &falseVal, |
| 104 | AllowDeletions: &falseVal, |
| 105 | }, |
| 106 | }, |
| 107 | { |
| 108 | Protected: &trueVal, |
| 109 | BranchProtectionRule: clients.BranchProtectionRule{ |
| 110 | CheckRules: clients.StatusChecksRule{ |
| 111 | RequiresStatusChecks: &trueVal, |
| 112 | UpToDateBeforeMerge: &falseVal, |
nothing calls this directly
no test coverage detected