Skip to content

Commit 1f667ad

Browse files
authored
refactor(cherrypickapproved): remove test status check (#25)
Remove test status check and related test cases
1 parent c4199af commit 1f667ad

2 files changed

Lines changed: 0 additions & 36 deletions

File tree

pkg/plugins/cherrypickapproved/cherrypickapproved.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -173,19 +173,6 @@ func (h *handler) handle(log *logrus.Entry, gc plugins.PluginGitHubClient, e git
173173
return nil
174174
}
175175

176-
// Check the PR state to not have failed tests
177-
combinedStatus, err := h.GetCombinedStatus(gc, org, repo, e.PullRequest.Head.SHA)
178-
if err != nil {
179-
return fmt.Errorf("get combined status: %w", err)
180-
}
181-
for _, status := range combinedStatus.Statuses {
182-
state := status.State
183-
if state == github.StatusError || state == github.StatusFailure {
184-
log.Infof("Skipping PR %d because tests failed", prNumber)
185-
return nil
186-
}
187-
}
188-
189176
// Validate the labels
190177
issueLabels, err := h.GetIssueLabels(gc, org, repo, prNumber)
191178
if err != nil {

pkg/plugins/cherrypickapproved/cherrypickapproved_test.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -173,29 +173,6 @@ func TestHandle(t *testing.T) {
173173
assert.Error(t, err)
174174
},
175175
},
176-
{
177-
name: "error on GetCombinedStatus",
178-
config: testConfig,
179-
prepare: func(mock *cherrypickapprovedfakes.FakeImpl) {
180-
mock.GetCombinedStatusReturns(nil, errTest)
181-
},
182-
assert: func(mock *cherrypickapprovedfakes.FakeImpl, err error) {
183-
assert.Error(t, err)
184-
},
185-
},
186-
{
187-
name: "skip with failed tests",
188-
config: testConfig,
189-
prepare: func(mock *cherrypickapprovedfakes.FakeImpl) {
190-
mock.GetCombinedStatusReturns(&github.CombinedStatus{
191-
Statuses: []github.Status{{State: github.StatusError}},
192-
}, nil)
193-
},
194-
assert: func(mock *cherrypickapprovedfakes.FakeImpl, err error) {
195-
assert.NoError(t, err)
196-
assert.EqualValues(t, 0, mock.GetIssueLabelsCallCount())
197-
},
198-
},
199176
{
200177
name: "skip with wrong review state",
201178
config: testConfig,

0 commit comments

Comments
 (0)