8000 fix(inkless:test): test the inkless tag suffix without the baked version file by gqmelo · Pull Request #922 · aiven/inkless · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,22 @@ public static String getInklessTag() {

// INKLESS: true when an inkless tag was baked in (release build), false otherwise.
private static boolean hasInklessTag() {
return !INKLESS_TAG.isEmpty() && !DEFAULT_VALUE.equals(INKLESS_TAG);
return hasInklessTag(INKLESS_TAG);
}

private static boolean hasInklessTag(String inklessTag) {
return !inklessTag.isEmpty() && !DEFAULT_VALUE.equals(inklessTag);
}

// INKLESS: " (Inkless:<tag>)" suffix for --version output, or "" when the inkless
// tag was not baked in (keeps upstream output/tests intact off a release build).
public static String getInklessTagSuffix() {
return hasInklessTag() ? " (Inkless:" + INKLESS_TAG + ")" : "";
return inklessTagSuffix(INKLESS_TAG);
}

// Visible for testing
static String inklessTagSuffix(String inklessTag) {
return hasInklessTag(inklessTag) ? " (Inkless:" + inklessTag + ")" : "";
}

public static synchronized void registerAppInfo(String prefix, String id, Metrics metrics, long nowMs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ public void testUnregisterAppInfoUnregistersMetrics() throws JMException {
}
}

// INKLESS: without a baked kafka-version.properties on the test classpath the inkless
// tag defaults to "unknown" and the --version suffix is suppressed.
// INKLESS: pass the tag as an argument, because the baked tag changes with the build.
@Test
public void testInklessTagDefaultsToUnknownAndSuppressesSuffix() {
assertEquals(AppInfoParser.DEFAULT_VALUE, AppInfoParser.getInklessTag());
assertEquals("", AppInfoParser.getInklessTagSuffix());
public void testInklessTagSuffixSuppressedWithoutTag() {
assertEquals("", AppInfoParser.inklessTagSuffix(AppInfoParser.DEFAULT_VALUE));
assertEquals("", AppInfoParser.inklessTagSuffix(""));
assertEquals(" (Inkless:inkless-4.3.2-0.51)", AppInfoParser.inklessTagSuffix("inkless-4.3.2-0.51"));
}

private void registerAppInfo(Metrics metrics) throws JMException {
Expand Down
Loading
0