Skip to content

Commit 4425fed

Browse files
Makes tests more concrete
1 parent bae2ddb commit 4425fed

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/e2eTest/java/io/micrometer/release/single/SingleProjectGithubActionsE2eTests.java

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828

2929
class SingleProjectGithubActionsE2eTests implements GithubActions {
3030

31+
String[] closedIssueTitles = {"Closed issue in generic 0.1.x", "Closed bug in concrete 0.1.1",
32+
"Closed bug in generic 0.1.x", "Closed enhancement in generic 0.1.x"};
33+
3134
@BeforeAll
3235
static void should_go_through_whole_flow() {
3336
githubClient.createReleaseAndTag("v0.1.1");
@@ -41,55 +44,58 @@ void should_verify_release_notes_content() throws JsonProcessingException {
4144
assertThat(release.body()).containsIgnoringWhitespaces(
4245
"Closed enhancement in generic 0.1.x [#8](https://github.com/marcingrzejszczak/gh-actions-test/issues/8)")
4346
.containsIgnoringWhitespaces(
44-
"Closed bug in concrete 0.1.1 [#12](https://github.com/marcingrzejszczak/gh-actions-test/issues/12)")
47+
"Closed bug in concrete 0.1.1 [#12](https://github.com/marcingrzejszczak/gh-actions-test/issues/12)")
4548
.containsIgnoringWhitespaces(
46-
"Closed bug in generic 0.1.x [#9](https://github.com/marcingrzejszczak/gh-actions-test/issues/9)");
49+
"Closed bug in generic 0.1.x [#9](https://github.com/marcingrzejszczak/gh-actions-test/issues/9)");
4750
}
4851

4952
@Test
5053
void should_verify_current_milestone() throws JsonProcessingException {
5154
Milestone milestone = githubClient.getMilestoneByTitle("0.1.1");
5255

53-
String[] issueTitles = { "Closed issue in generic 0.1.x", "Closed bug in concrete 0.1.1",
54-
"Closed bug in generic 0.1.x", "Closed enhancement in generic 0.1.x" };
5556
assertThat(milestone.state()).isEqualTo("closed");
5657
List<Issue> issues = githubClient.getIssuesForMilestone(milestone.number());
57-
assertThat(issues).filteredOn(s -> Arrays.asList(issueTitles).contains(s.title()))
58+
assertThat(issues).filteredOn(s -> Arrays.asList(closedIssueTitles).contains(s.title()))
5859
.extracting(Issue::state)
5960
.containsOnly("closed");
6061
assertThat(issues).extracting(Issue::title)
61-
.contains(issueTitles)
62+
.contains(closedIssueTitles)
6263
.doesNotContain("Open issue in concrete 0.1.1");
6364
}
6465

6566
@Test
6667
void should_verify_next_milestone() throws JsonProcessingException {
6768
Milestone milestone = githubClient.getMilestoneByTitle("0.1.2");
6869

69-
String[] issueTitles = { "Closed issue in generic 0.1.x", "Closed bug in concrete 0.1.1",
70-
"Closed bug in generic 0.1.x", "Closed enhancement in generic 0.1.x" };
7170
assertThat(milestone.state()).isEqualTo("open");
72-
assertThat(milestone.dueOn()).isEqualTo(ReleaseDateCalculator.calculateDueDate(LocalDate.now()));
71+
assertThat(milestone.dueOn()).isEqualTo(
72+
ReleaseDateCalculator.calculateDueDate(LocalDate.now()));
7373
List<Issue> issues = githubClient.getIssuesForMilestone(milestone.number());
74-
assertThat(issues).filteredOn(s -> "Open issue in concrete 0.1.1".equalsIgnoreCase(s.title()))
74+
assertThat(issues).filteredOn(
75+
s -> "Open issue in concrete 0.1.1".equalsIgnoreCase(s.title()))
7576
.extracting(Issue::state)
7677
.containsOnly("open");
7778
assertThat(issues).extracting(Issue::title)
7879
.contains("Open issue in concrete 0.1.1")
79-
.doesNotContain(issueTitles);
80+
.doesNotContain(closedIssueTitles);
8081
}
8182

8283
@Test
8384
void should_verify_generic_milestone() throws JsonProcessingException {
8485
Milestone milestone = githubClient.getMilestoneByTitle("0.1.x");
8586

8687
List<Issue> closedIssues = githubClient.getClosedIssuesForMilestone(milestone.number());
87-
assertThat(closedIssues).isEmpty();
88+
assertThat(closedIssues)
89+
.extracting(Issue::title)
90+
.matches(strings -> strings.stream()
91+
.noneMatch(s -> s.contains("in generic") || s.contains("in concrete")),
92+
"Must not contain any closed issues that we created");
8893
}
8994

9095
private static void runPostReleaseWorkflow() {
9196
log.info("Running post release action from tag");
92-
GithubActions.runWorkflow("post-release-workflow.yml", "v0.1.1", List.of("gh", "workflow", "run",
97+
GithubActions.runWorkflow("post-release-workflow.yml", "v0.1.1",
98+
List.of("gh", "workflow", "run",
9399
"post-release-workflow.yml", "--ref", "v0.1.1", "-f", "previous_ref_name=v0.1.0"));
94100
}
95101

0 commit comments

Comments
 (0)