mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
Fix submit queue when there are multiple LGTMs
This commit is contained in:
parent
714b39f025
commit
c5643c3c03
@ -111,7 +111,9 @@ func validateLGTMAfterPush(client *github.Client, user, project string, pr *gith
|
|||||||
for ix := range events {
|
for ix := range events {
|
||||||
event := &events[ix]
|
event := &events[ix]
|
||||||
if *event.Event == "labeled" && *event.Label.Name == "lgtm" {
|
if *event.Event == "labeled" && *event.Label.Name == "lgtm" {
|
||||||
lgtmTime = event.CreatedAt
|
if lgtmTime == nil || event.CreatedAt.After(*lgtmTime) {
|
||||||
|
lgtmTime = event.CreatedAt
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if lgtmTime == nil {
|
if lgtmTime == nil {
|
||||||
|
@ -424,6 +424,60 @@ func TestValidateLGTMAfterPush(t *testing.T) {
|
|||||||
lastModified: time.Unix(11, 0),
|
lastModified: time.Unix(11, 0),
|
||||||
shouldPass: false,
|
shouldPass: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
issueEvents: []github.IssueEvent{
|
||||||
|
{
|
||||||
|
Event: stringPtr("labeled"),
|
||||||
|
Label: &github.Label{
|
||||||
|
Name: stringPtr("lgtm"),
|
||||||
|
},
|
||||||
|
CreatedAt: timePtr(time.Unix(12, 0)),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Event: stringPtr("labeled"),
|
||||||
|
Label: &github.Label{
|
||||||
|
Name: stringPtr("lgtm"),
|
||||||
|
},
|
||||||
|
CreatedAt: timePtr(time.Unix(11, 0)),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Event: stringPtr("labeled"),
|
||||||
|
Label: &github.Label{
|
||||||
|
Name: stringPtr("lgtm"),
|
||||||
|
},
|
||||||
|
CreatedAt: timePtr(time.Unix(10, 0)),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lastModified: time.Unix(11, 0),
|
||||||
|
shouldPass: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
issueEvents: []github.IssueEvent{
|
||||||
|
{
|
||||||
|
Event: stringPtr("labeled"),
|
||||||
|
Label: &github.Label{
|
||||||
|
Name: stringPtr("lgtm"),
|
||||||
|
},
|
||||||
|
CreatedAt: timePtr(time.Unix(10, 0)),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Event: stringPtr("labeled"),
|
||||||
|
Label: &github.Label{
|
||||||
|
Name: stringPtr("lgtm"),
|
||||||
|
},
|
||||||
|
CreatedAt: timePtr(time.Unix(11, 0)),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Event: stringPtr("labeled"),
|
||||||
|
Label: &github.Label{
|
||||||
|
Name: stringPtr("lgtm"),
|
||||||
|
},
|
||||||
|
CreatedAt: timePtr(time.Unix(12, 0)),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lastModified: time.Unix(11, 0),
|
||||||
|
shouldPass: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
client, server, mux := initTest()
|
client, server, mux := initTest()
|
||||||
|
Loading…
Reference in New Issue
Block a user