Skip to content

Commit

Permalink
Merge pull request #197 from yrodiere/pr196-followup
Browse files Browse the repository at this point in the history
Fix documentation and improve test/stub utils
  • Loading branch information
yrodiere authored Dec 12, 2024
2 parents 0b7abd7 + 4218f20 commit 3232b21
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 126 deletions.
32 changes: 16 additions & 16 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ participants:
maxIssues: 2
stale:
maxIssues: 5
ignoreLabels: ["triage/on-ice"]
----

`labels`::
Expand All @@ -198,11 +197,6 @@ How many issues, at most, you wish to be included in the "Stale" category
for each notification.
+
Integer, mandatory, no default.
`stale.ignoreLabels`::
The labels identifying issues that should be ignored for the "Stale" category.
Issues mentioned in notifications will never have any one of these labels.
+
Array of Strings, optional, defaults to an empty array.

[[participants-stewardship]]
=== Stewardship
Expand Down Expand Up @@ -231,7 +225,6 @@ participants:
stewardship:
days: ["MONDAY"]
maxIssues: 5
ignoreLabels: ["triage/on-ice"]
----

`days`::
Expand All @@ -243,11 +236,6 @@ How many issues, at most, you wish to be included in the "stewardship" category
for each notification.
+
Integer, mandatory, no default.
`ignoreLabels`::
The labels identifying issues that should be ignored for the "stewardship" category.
Issues mentioned in notifications will never have any one of these labels.
+
Array of Strings, optional, defaults to an empty array.

[[participants-suspending]]
=== Suspending notifications
Expand Down Expand Up @@ -304,7 +292,7 @@ buckets:
timeout: P3D
maintenance:
feedback:
label: "triage/needs-reproducer"
labels: ["triage/needs-reproducer"]
needed:
delay: P21D
timeout: P3D
Expand All @@ -314,9 +302,11 @@ buckets:
stale:
delay: P60D
timeout: P14D
ignoreLabels: ["triage/on-ice"]
stewardship:
delay: P60D
timeout: P14D
ignoreLabels: ["triage/on-ice"]
# [...]
----

Expand All @@ -338,10 +328,10 @@ How much time to wait after an issue was last notified about
before including it again in the lottery in the "triage" bucket.
+
String in https://en.wikipedia.org/wiki/ISO_8601#Durations[ISO-8601 duration format], mandatory, no default.
`buckets.maintenance.feedback.label`::
The label identifying GitHub issues for which feedback (a reproducer, more information, ...) was requested.
`buckets.maintenance.feedback.labels`::
The labels identifying GitHub issues for which feedback (a reproducer, more information, ...) was requested.
+
String, mandatory, no default.
Array of strings, mandatory, no default.
`buckets.maintenance.feedback.needed.delay`::
How much time to wait after the last update on an issue
before including it in the lottery in the "feedback needed" bucket.
Expand All @@ -367,6 +357,11 @@ How much time to wait after the last update on an issue
before including it in the lottery in the "stale" bucket.
+
String in https://en.wikipedia.org/wiki/ISO_8601#Durations[ISO-8601 duration format], mandatory, no default.
`buckets.maintenance.stale.ignoreLabels`::
The labels identifying GitHub issues that should be ignored for the "stale" bucket.
Issues with one of these labels will never be added to the bucket.
+
Array of Strings, optional, defaults to an empty array.
`buckets.maintenance.stale.timeout`::
How much time to wait after an issue was last notified about
before including it again in the lottery in the "stale" bucket.
Expand All @@ -382,6 +377,11 @@ How much time to wait after an issue was last notified about
before including it again in the lottery in the "stewardship" bucket.
+
String in https://en.wikipedia.org/wiki/ISO_8601#Durations[ISO-8601 duration format], mandatory, no default.
`buckets.stewardship.ignoreLabels`::
The labels identifying GitHub issues that should be ignored for the "stewardship" bucket.
Issues with one of these labels will never be added to the bucket.
+
Array of Strings, optional, defaults to an empty array.

[[config-validation]]
=== Validation of the configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package io.quarkus.github.lottery;

import static io.quarkus.github.lottery.util.MockHelper.stubIssueList;
import static io.quarkus.github.lottery.util.MockHelper.stubReport;
import static io.quarkus.github.lottery.util.MockHelper.stubReportConfig;
import static io.quarkus.github.lottery.util.MockHelper.stubReportMaintenance;
import static io.quarkus.github.lottery.util.MockHelper.stubReportStewardship;
import static io.quarkus.github.lottery.util.MockHelper.stubReportTriage;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
Expand Down Expand Up @@ -296,11 +300,8 @@ void triage() throws IOException {

lotteryService.draw();

verify(notifierMock).send(new LotteryReport(drawRef, "yrodiere", Optional.empty(),
stubReportConfig(),
Optional.of(new LotteryReport.Bucket(stubIssueList(1, 3, 2))),
Optional.empty(), Optional.empty(), Optional.empty(),
Optional.empty()));
verify(notifierMock).send(stubReportTriage(drawRef, "yrodiere", Optional.empty(),
stubIssueList(1, 3, 2)));

verify(historyServiceMock).append(drawRef, config, List.of(
new LotteryReport.Serialized(drawRef.instant(), "yrodiere",
Expand Down Expand Up @@ -341,11 +342,8 @@ void triage_issueAlreadyHasNonTimedOutNotification() throws IOException {

// Since the last notification for issue with number 3 didn't time out yet,
// it will be skipped and we'll notify about another issue.
verify(notifierMock).send(new LotteryReport(drawRef, "yrodiere", Optional.empty(),
stubReportConfig(),
Optional.of(new LotteryReport.Bucket(stubIssueList(1, 2, 4))),
Optional.empty(), Optional.empty(), Optional.empty(),
Optional.empty()));
verify(notifierMock).send(stubReportTriage(drawRef, "yrodiere", Optional.empty(),
stubIssueList(1, 2, 4)));

verify(historyServiceMock).append(drawRef, config, List.of(
new LotteryReport.Serialized(drawRef.instant(), "yrodiere",
Expand Down Expand Up @@ -412,13 +410,11 @@ void maintenance() throws IOException {

lotteryService.draw();

verify(notifierMock).send(new LotteryReport(drawRef, "yrodiere", Optional.empty(),
stubReportConfig("area/hibernate-orm", "area/hibernate-search"),
Optional.empty(),
Optional.of(new LotteryReport.Bucket(stubIssueList(101, 401, 102, 402))),
Optional.of(new LotteryReport.Bucket(stubIssueList(201, 501))),
Optional.of(new LotteryReport.Bucket(stubIssueList(301, 601, 302, 602, 303))),
Optional.empty()));
verify(notifierMock).send(stubReportMaintenance(drawRef, "yrodiere", Optional.empty(),
List.of("area/hibernate-orm", "area/hibernate-search"),
stubIssueList(101, 401, 102, 402),
stubIssueList(201, 501),
stubIssueList(301, 601, 302, 602, 303)));

verify(historyServiceMock).append(drawRef, config, List.of(
new LotteryReport.Serialized(drawRef.instant(), "yrodiere",
Expand Down Expand Up @@ -492,13 +488,11 @@ void maintenance_issueAlreadyHasTimedOutNotification() throws IOException {

// Since the last notification for issues with number 401, 201, 302 didn't time out yet,
// they will be skipped and we'll notify about the next issues instead.
verify(notifierMock).send(new LotteryReport(drawRef, "yrodiere", Optional.empty(),
stubReportConfig("area/hibernate-orm", "area/hibernate-search"),
Optional.empty(),
Optional.of(new LotteryReport.Bucket(stubIssueList(101, 402, 102, 403))),
Optional.of(new LotteryReport.Bucket(stubIssueList(202, 501))),
Optional.of(new LotteryReport.Bucket(stubIssueList(301, 601, 303, 602, 304))),
Optional.empty()));
verify(notifierMock).send(stubReportMaintenance(drawRef, "yrodiere", Optional.empty(),
List.of("area/hibernate-orm", "area/hibernate-search"),
stubIssueList(101, 402, 102, 403),
stubIssueList(202, 501),
stubIssueList(301, 601, 303, 602, 304)));

verify(historyServiceMock).append(drawRef, config, List.of(
new LotteryReport.Serialized(drawRef.instant(), "yrodiere",
Expand Down Expand Up @@ -538,11 +532,8 @@ void stewardship() throws IOException {

lotteryService.draw();

verify(notifierMock).send(new LotteryReport(drawRef, "geoand", Optional.empty(),
stubReportConfig(),
Optional.empty(),
Optional.empty(), Optional.empty(), Optional.empty(),
Optional.of(new LotteryReport.Bucket(stubIssueList(1, 3, 2)))));
verify(notifierMock).send(stubReportStewardship(drawRef, "geoand", Optional.empty(),
stubIssueList(1, 3, 2)));

verify(historyServiceMock).append(drawRef, config, List.of(
new LotteryReport.Serialized(drawRef.instant(), "geoand",
Expand Down Expand Up @@ -583,11 +574,8 @@ void stewardship_issueAlreadyHasNonTimedOutNotification() throws IOException {

// Since the last notification for issue with number 3 didn't time out yet,
// it will be skipped and we'll notify about another issue.
verify(notifierMock).send(new LotteryReport(drawRef, "geoand", Optional.empty(),
stubReportConfig(),
Optional.empty(),
Optional.empty(), Optional.empty(), Optional.empty(),
Optional.of(new LotteryReport.Bucket(stubIssueList(1, 2, 4)))));
verify(notifierMock).send(stubReportStewardship(drawRef, "geoand", Optional.empty(),
stubIssueList(1, 2, 4)));

verify(historyServiceMock).append(drawRef, config, List.of(
new LotteryReport.Serialized(drawRef.instant(), "geoand",
Expand Down Expand Up @@ -657,23 +645,23 @@ void stewardship_doesNotAffectMaintenance() throws IOException {

lotteryService.draw();

verify(notifierMock).send(new LotteryReport(drawRef, "yrodiere", Optional.empty(),
verify(notifierMock).send(stubReport(drawRef, "yrodiere", Optional.empty(),
stubReportConfig("area/hibernate-search"),
Optional.empty(),
Optional.of(new LotteryReport.Bucket(stubIssueList(401, 402, 403, 404))),
Optional.of(new LotteryReport.Bucket(stubIssueList(501, 502))),
Optional.of(stubIssueList(401, 402, 403, 404)),
Optional.of(stubIssueList(501, 502)),
// Notifications to stewards don't prevent notifications to maintainers
Optional.of(new LotteryReport.Bucket(stubIssueList(601, 602, 603, 604, 605))),
Optional.of(stubIssueList(601, 602, 603, 604, 605)),
Optional.empty()));

verify(notifierMock).send(new LotteryReport(drawRef, "gsmet", Optional.empty(),
verify(notifierMock).send(stubReport(drawRef, "gsmet", Optional.empty(),
stubReportConfig(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty(),
// Notifications to maintainers don't prevent notifications to stewards
Optional.of(new LotteryReport.Bucket(stubIssueList(401, 501, 601, 701)))));
Optional.of(stubIssueList(401, 501, 601, 701))));

verify(historyServiceMock).append(drawRef, config, List.of(
new LotteryReport.Serialized(drawRef.instant(), "yrodiere",
Expand Down
Loading

0 comments on commit 3232b21

Please sign in to comment.