Skip to content

Commit dd310d2

Browse files
authored
Zero linkage error shows zero (GoogleCloudPlatform#404)
1 parent d55aaab commit dd310d2

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎dashboard/src/main/resources/templates/component.ftl‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112

113113
<h2 id="static-linkage-errors">Static Linkage Check</h2>
114114

115+
<p id="static-linkage-errors-total">${totalLinkageErrorCount} static linkage error(s)</p>
115116
<#list jarLinkageReports as jarLinkageReport>
116117
<#if jarLinkageReport.getTotalErrorCount() gt 0>
117118
<h3>${jarLinkageReport.getJarPath().getFileName()?html}</h3>

‎dashboard/src/test/java/com/google/cloud/tools/opensource/dashboard/DashboardTest.java‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,21 @@ public void testLinkageErrorsUnderProvidedDependency() throws IOException, Parsi
279279
}
280280
}
281281

282+
@Test
283+
public void testZeroLinkageErrorShowsZero() throws IOException, ParsingException {
284+
// grpc-auth does not have a linkage error, and it should show zero in the section
285+
Path zeroLinkageErrorHtml = outputDirectory.resolve("io.grpc_grpc-auth_1.17.1.html");
286+
Assert.assertTrue(Files.isRegularFile(zeroLinkageErrorHtml));
287+
288+
try (InputStream source = Files.newInputStream(zeroLinkageErrorHtml)) {
289+
Document document = builder.build(source);
290+
Nodes staticLinkageTotalMessage = document.query("//p[@id='static-linkage-errors-total']");
291+
Truth.assertThat(staticLinkageTotalMessage.size()).isEqualTo(1);
292+
Truth.assertThat(staticLinkageTotalMessage.get(0).getValue())
293+
.contains("0 static linkage error(s)");
294+
}
295+
}
296+
282297
private static class SortWithoutVersion implements Comparator<String> {
283298

284299
@Override

0 commit comments

Comments
 (0)