Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional sync label tests, adjust the implementation to match #1033

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -205,7 +205,21 @@ public static List<Issue> findBackports(Issue primary, boolean resolvedOnly) {
.collect(Collectors.toList());
}

private static final Pattern featureFamilyPattern = Pattern.compile("^([^\\d]*)(\\d+)$");
// For Java 8, certain interim versions are considered to be different feature versions
private static String legacyFeatureSplit(JdkVersion version) {
if (version.feature().equals("8") && version.interim().isPresent()) {
var interim = Integer.parseInt(version.interim().get());
if (interim > 100) {
return version.feature() + "+100";
} else {
return version.feature() + "+0";
}
} else {
return version.feature();
}
}

private static final Pattern featureFamilyPattern = Pattern.compile("^([^\\d]*)(\\d+)u?$");

/**
* Classifies a given version as belonging to one or more release streams.
@@ -229,41 +243,49 @@ private static List<String> releaseStreams(JdkVersion jdkVersion) {
var featureFamily = featureFamilyMatcher.group(1);
var featureVersion = featureFamilyMatcher.group(2);
var numericFeature = Integer.parseInt(featureVersion);
var featureString = featureFamily + "-" + featureVersion;
if (numericFeature >= 9) {
if (jdkVersion.update().isPresent()) {
var numericUpdate = Integer.parseInt(jdkVersion.update().get());
if (numericUpdate == 1 || numericUpdate == 2) {
ret.add(jdkVersion.feature() + "+updates-oracle");
ret.add(jdkVersion.feature() + "+updates-openjdk");
ret.add(featureString + "+updates-oracle");
ret.add(featureString + "+updates-openjdk");
} else if (numericUpdate > 2) {
if (jdkVersion.opt().isPresent() && jdkVersion.opt().get().equals("oracle")) {
if (jdkVersion.patch().isPresent()) {
ret.add(jdkVersion.feature()+ "+bpr");
ret.add(featureString + "+bpr");
} else {
ret.add(jdkVersion.feature() + "+updates-oracle");
ret.add(featureString + "+updates-oracle");
}
} else {
ret.add(jdkVersion.feature() + "+updates-openjdk");
ret.add(featureString + "+updates-openjdk");
}
}
} else {
ret.add("features-" + featureFamily);
ret.add(jdkVersion.feature() + "+updates-oracle");
ret.add(jdkVersion.feature() + "+updates-openjdk");
if (jdkVersion.opt().isPresent() && jdkVersion.opt().get().equals("cpu")) {
ret.add(featureString + "+updates-oracle");
ret.add(featureString + "+updates-openjdk");
} else {
ret.add("features-" + featureFamily);
ret.add(featureString + "+updates-oracle");
ret.add(featureString + "+updates-openjdk");
}
}
} else if (numericFeature == 7 || numericFeature == 8) {
var feature = legacyFeatureSplit(jdkVersion);

var resolvedInBuild = jdkVersion.resolvedInBuild();
if (resolvedInBuild.isPresent()) {
if (!resolvedInBuild.get().equals("team")) { // Special case - team build resolved are ignored
int resolvedInBuildNumber = jdkVersion.resolvedInBuildNumber();
if (resolvedInBuildNumber < 31) {
ret.add(jdkVersion.feature());
ret.add(feature);
} else if (resolvedInBuildNumber < 60) {
ret.add(jdkVersion.feature() + "+bpr");
ret.add(feature + "+bpr");
}
}
} else {
ret.add(jdkVersion.feature());
ret.add(feature);
}
} else {
log.warning("Ignoring issue with unknown version: " + jdkVersion);
@@ -65,10 +65,6 @@ private static List<String> splitComponents(String raw) {
}

finalComponents.addAll(Arrays.asList(raw.split("\\.")));

// All components except the optional one must be numeric
finalComponents.forEach(Integer::parseUnsignedInt);

if (optional != null) {
finalComponents.add(null);
finalComponents.add(optional);
@@ -472,7 +472,117 @@ void labelTest8242283(TestInfo testInfo) throws IOException {
backports.assertLabeled();

backports.addBackports("14.0.2", "14u-cpu", "11.0.9-oracle", "11.0.9");
backports.assertLabeled("14u-cpu");
}
}

@Test
void exampleTest1(TestInfo testInfo) throws IOException {
try (var credentials = new HostCredentials(testInfo)) {
var backports = new BackportManager(credentials, "16");
backports.assertLabeled();

backports.addBackports("16.0.1", "16.0.2");
backports.assertLabeled("16.0.1", "16.0.2");
}
}

@Test
void exampleTest2(TestInfo testInfo) throws IOException {
try (var credentials = new HostCredentials(testInfo)) {
var backports = new BackportManager(credentials, "17");
backports.assertLabeled();

backports.addBackports("16", "16.0.1");
backports.assertLabeled("17", "16.0.1");
}
}

@Test
void exampleTest3(TestInfo testInfo) throws IOException {
try (var credentials = new HostCredentials(testInfo)) {
var backports = new BackportManager(credentials, "17");
backports.assertLabeled();

backports.addBackports("16u-cpu", "16.0.2");
backports.assertLabeled("16u-cpu");
}
}

@Test
void exampleTest4(TestInfo testInfo) throws IOException {
try (var credentials = new HostCredentials(testInfo)) {
var backports = new BackportManager(credentials, "17");
backports.assertLabeled();

backports.addBackports("16.0.1", "16.0.2");
backports.assertLabeled("16.0.2");
}
}

@Test
void exampleTest5(TestInfo testInfo) throws IOException {
try (var credentials = new HostCredentials(testInfo)) {
var backports = new BackportManager(credentials, "18");
backports.assertLabeled();

backports.addBackports("17.0.2", "17.0.3-oracle");
backports.assertLabeled("17.0.3-oracle");
}
}

@Test
void exampleTest6(TestInfo testInfo) throws IOException {
try (var credentials = new HostCredentials(testInfo)) {
var backports = new BackportManager(credentials, "8u291");
backports.assertLabeled();

backports.addBackports("8u281", "8u271/b34", "8u261/b32");
backports.assertLabeled("8u291", "8u271");
}
}

@Test
void exampleTest7(TestInfo testInfo) throws IOException {
try (var credentials = new HostCredentials(testInfo)) {
var backports = new BackportManager(credentials, "8u41");
backports.assertLabeled();

backports.addBackports("8u261", "8u251");
backports.assertLabeled("8u261");
}
}

@Test
void exampleTest8(TestInfo testInfo) throws IOException {
try (var credentials = new HostCredentials(testInfo)) {
var backports = new BackportManager(credentials, "11.0.9");
backports.assertLabeled();

backports.addBackports("11.0.9-oracle");
backports.assertLabeled();
}
}

@Test
void exampleTest9(TestInfo testInfo) throws IOException {
try (var credentials = new HostCredentials(testInfo)) {
var backports = new BackportManager(credentials, "11.0.9");
backports.assertLabeled();

backports.addBackports("11.0.10-oracle");
backports.assertLabeled();
}
}

@Test
void exampleTest10(TestInfo testInfo) throws IOException {
try (var credentials = new HostCredentials(testInfo)) {
var backports = new BackportManager(credentials, "11.0.12-oracle");
backports.assertLabeled();

backports.addBackports("11.0.13-oracle", "11.0.11.0.1-oracle");
backports.assertLabeled("11.0.13-oracle");
}
}
}