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 test coverage to verify correct application order of update receipes duiring Quarkus update #2219

Merged
merged 1 commit into from
Nov 26, 2024
Merged
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
@@ -0,0 +1,58 @@
package io.quarkus.ts.quarkus.cli.update;

import static io.quarkus.test.util.QuarkusCLIUtils.getDependencies;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.IOException;
import java.util.List;

import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.apache.maven.model.Dependency;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import io.quarkus.test.bootstrap.QuarkusCliRestService;

public class QuarkusCli35to315UpdateIT extends AbstractQuarkusCliUpdateIT {
private static final DefaultArtifactVersion oldVersion = new DefaultArtifactVersion("3.5");
private static final DefaultArtifactVersion newVersion = new DefaultArtifactVersion("3.15");

public QuarkusCli35to315UpdateIT() {
super(oldVersion, newVersion);
}

/**
* Test that updating from Quarkus 3.5 to 3.15 correctly transforms
* the 'quarkus-rest-client-reactive-jackson' extension to 'quarkus-rest-client-jackson',
* and does not incorrectly transform it to 'quarkus-resteasy-client-jackson'.
* This test addresses a specific issue where the update recipes could apply in the wrong order,
* causing incorrect dependency transformations. More info here:https://github.com/quarkusio/quarkus/issues/44183
*
*/
@Tag("https://github.com/quarkusio/quarkus/issues/44183")
@Test
public void testCorrectRecipesOrder() throws XmlPullParserException, IOException {

QuarkusCliRestService app = quarkusCLIAppManager
.createApplicationWithExtensions("quarkus-rest-client-reactive-jackson");

quarkusCLIAppManager.updateApp(app);
List<Dependency> dependencies = getDependencies(app);
assertTrue(
dependencies.stream().anyMatch(dependency -> dependency.getArtifactId().equals("quarkus-rest-client-jackson")),
"'quarkus-rest-client-jackson' should be present after the update.");

assertFalse(
dependencies.stream()
.anyMatch(dependency -> dependency.getArtifactId().equals("quarkus-rest-client-reactive-jackson")),
"'quarkus-rest-client-reactive-jackson' should not be present after the update.");

assertFalse(
dependencies.stream()
.anyMatch(dependency -> dependency.getArtifactId().equals("quarkus-resteasy-client-jackson")),
"'quarkus-resteasy-client-jackson' should not be present after the update.");
}

}