Skip to content
Permalink
Browse files
1108: Fix label updater for gitlab
Reviewed-by: kcr
  • Loading branch information
erikj79 committed Jul 13, 2021
1 parent 6c33395 commit 68fc5e4b6801291258f462a572d82c59108fd33e
@@ -46,7 +46,7 @@ public Collection<WorkItem> run(Path scratchPath) {

var configuredLabels = bot.lists().stream()
.flatMap(configuration -> configuration.labels().stream()
.map(labelName -> new Label(labelName, configuration.list().toString())))
.map(labelName -> new Label(labelName, configuration.list().address())))
.toList();

for (Label configuredLabel : configuredLabels) {
@@ -61,7 +61,7 @@ public Collection<WorkItem> run(Path scratchPath) {
}
}

log.fine("Done updating labels for: " + bot.codeRepo());
log.fine("Done updating labels for: " + bot.codeRepo().name());
bot.setLabelsUpdated(true);
return List.of();
}
@@ -32,10 +32,10 @@ void simple(TestInfo testInfo) throws IOException {

assertEquals(2, targetRepo.labels().size(), "Wrong number of labels");
assertTrue(targetRepo.labels().stream()
.anyMatch(l -> l.name().equals("foo") && l.description().orElseThrow().equals(listAddress.toString())),
.anyMatch(l -> l.name().equals("foo") && l.description().orElseThrow().equals(listAddress.address())),
"No label 'foo' found");
assertTrue(targetRepo.labels().stream()
.anyMatch(l -> l.name().equals("bar") && l.description().orElseThrow().equals(listAddress.toString())),
.anyMatch(l -> l.name().equals("bar") && l.description().orElseThrow().equals(listAddress.address())),
"No label 'bar' found");

// Run again and expect no change
@@ -65,7 +65,7 @@ void update(TestInfo testInfo) throws IOException {

assertEquals(1, targetRepo.labels().size(), "Wrong number of labels");
assertTrue(targetRepo.labels().stream()
.anyMatch(l -> l.name().equals("foo") && l.description().orElseThrow().equals(listAddress.toString())),
.anyMatch(l -> l.name().equals("foo") && l.description().orElseThrow().equals(listAddress.address())),
"No label 'foo' found");

var mlBot2 = MailingListBridgeBot.newBuilder()
@@ -78,7 +78,7 @@ void update(TestInfo testInfo) throws IOException {

assertEquals(1, targetRepo.labels().size(), "Wrong number of labels");
assertTrue(targetRepo.labels().stream()
.anyMatch(l -> l.name().equals("foo") && l.description().orElseThrow().equals(listAddress2.toString())),
.anyMatch(l -> l.name().equals("foo") && l.description().orElseThrow().equals(listAddress2.address())),
"No label 'foo' found");
}
}

1 comment on commit 68fc5e4

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 68fc5e4 Jul 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.