Skip to content

Conversation

@Rollczi
Copy link
Member

@Rollczi Rollczi commented Oct 29, 2025

example:

class SomeTest extends IntegrationBaseTest {

    @LitegrationTest
    void test() {
         assertThat(Bukkit.getServer()).isNotNull();
    }

}

@Rollczi Rollczi requested a review from a team as a code owner October 29, 2025 20:22
@Rollczi
Copy link
Member Author

Rollczi commented Oct 29, 2025

fajne czy nie fajne?

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces Litegration for running integration tests on a Paper server, which is a great step towards improving code quality and reliability. The changes include setting up the build files, adding a base test class, and an initial integration test for the CatboyService.

My review includes suggestions to improve the build script configuration by removing redundancies and hardcoded versions, and to enhance the readability and maintainability of the new test code. I've also raised a high-severity concern about disabling parallel execution in Gradle, which could impact build performance.

# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties

org.gradle.parallel=true
org.gradle.parallel=false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Disabling parallel execution can significantly increase build times. While this might be a necessary workaround for the integration tests to function correctly, the reason for this change should be documented with a comment. This will help other developers understand the limitation and potentially re-enable it in the future if the underlying issue is resolved. The same applies to org.gradle.configuration-cache.parallel on line 6.

Copy link
Member

@Jakubk15 Jakubk15 Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rollczi Can't we toggle this off per-task?

Comment on lines +9 to 11
repositories {
maven("https://repo.eternalcode.pl/releases/")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This repositories block is redundant. The eternalcore-repositories convention plugin is applied on line 3, and it already includes the https://repo.eternalcode.pl/releases/ repository. You can safely remove this block to avoid duplication.


tasks.testPaper {
eula = true
serverVersion = "1.21.7"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The server version 1.21.7 is hardcoded. To maintain consistency and ease of updates, it's better to define this version in your buildSrc/src/main/kotlin/Versions.kt file and reference it here.

For example, you could add const val PAPER_TEST_SERVER = "1.21.7" to Versions.kt and then use Versions.PAPER_TEST_SERVER here.


testPaperImplementation("dev.rollczi:litegration-client-mcprotocollib:${Versions.LITEGRATION}")

testPaperImplementation(platform("org.junit:junit-bom:6.0.0"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The JUnit BOM version is hardcoded. You have a JUNIT_BOM constant defined in Versions.kt. Please use it here to ensure version consistency across the project.

    testPaperImplementation(platform("org.junit:junit-bom:${Versions.JUNIT_BOM}"))

testPaperImplementation(platform("org.junit:junit-bom:6.0.0"))
testPaperImplementation("org.spigotmc:spigot-api:${Versions.SPIGOT_API}")

testPaperImplementation("org.assertj:assertj-core:3.27.6")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The AssertJ version 3.27.6 is hardcoded. It's a good practice to manage all dependency versions in the Versions.kt file. Please add a constant for this version there and use it here.

For example, you could add const val ASSERTJ_CORE = "3.27.6" to Versions.kt and then use Versions.ASSERTJ_CORE here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the AssertJ framework, we should migrate other tests to it in near future.

Comment on lines +28 to +32
Player rollczi = Objects.requireNonNull(Bukkit.getPlayer(client.getName()));
scheduler.runTask(plugin, () -> {
action.accept(rollczi);
client.quit();
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The variable rollczi is used to store the player object, but the player's name is passed as a parameter name. Using a generic name like player would make the code more readable and less confusing, as this method is intended to be a generic utility for joining any player. This change should also be reflected in the test that calls this method.

Suggested change
Player rollczi = Objects.requireNonNull(Bukkit.getPlayer(client.getName()));
scheduler.runTask(plugin, () -> {
action.accept(rollczi);
client.quit();
});
Player player = Objects.requireNonNull(Bukkit.getPlayer(client.getName()));
scheduler.runTask(plugin, () -> {
action.accept(player);
client.quit();
});

joinPlayer("Rollczi", rollczi -> {
catboyService.markAsCatboy(rollczi, Cat.Type.WHITE);
assertThat(catboyService.isCatboy(rollczi.getUniqueId())).isTrue();
assertThat(rollczi.getWalkSpeed()).isEqualTo(0.4F);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The walk speed value 0.4F is a magic number. It would be better to use a constant if one is defined in the production code (e.g., CatboyService.CATBOY_WALK_SPEED). This improves readability and maintainability. The same applies to the default walk speed 0.2F on line 31. If constants don't exist, consider adding them.

@noyzys
Copy link
Member

noyzys commented Oct 30, 2025

fajne czy nie fajne?

Czy to jest zarys kompatybilnosci w stylu bridge cross-version?
na pierwszy rzut fajne ale tez fajnie gdyby samo w sobie mialo automatyczne auto-discovery, lepsze version parsing bo obecnie troche moze sie psuc przy niektorych buildach PAPERA no chyba ze wspieramy sortowane w stylu ,,najlepsze''

@Rollczi
Copy link
Member Author

Rollczi commented Oct 30, 2025

fajne czy nie fajne?

Czy to jest zarys kompatybilnosci w stylu bridge cross-version?

Tzn? To testy E2E/integracyjne (jak zwał tak zwał)

gdyby samo w sobie mialo automatyczne auto-discovery

Ale czego auto discovery?

lepsze version parsing bo obecnie troche moze sie psuc przy niektorych buildach PAPERA no chyba ze wspieramy sortowane
w stylu ,,najlepsze''

Chodzi o pobieranie jar servera? jakiś przykład

@Rollczi Rollczi changed the title Litegration GH-1228 Litegration Oct 30, 2025
Copy link
Member

@Jakubk15 Jakubk15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjust to Gemini's suggestions

testPaperImplementation(platform("org.junit:junit-bom:6.0.0"))
testPaperImplementation("org.spigotmc:spigot-api:${Versions.SPIGOT_API}")

testPaperImplementation("org.assertj:assertj-core:3.27.6")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the AssertJ framework, we should migrate other tests to it in near future.

# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties

org.gradle.parallel=true
org.gradle.parallel=false
Copy link
Member

@Jakubk15 Jakubk15 Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rollczi Can't we toggle this off per-task?



protected static void joinPlayer(String name, Consumer<Player> action) {
Litegration litegration = Litegration.getCurrent();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The getCurrent could be changed imo on Litegration's end, "current" in english without any context means just electricity

EternalCoreApi api = EternalCoreApiProvider.provide();
CatboyService catboyService = api.getCatboyService();

joinPlayer("Rollczi", rollczi -> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
joinPlayer("Rollczi", rollczi -> {
joinPlayer("Rollczi", player -> {

No need to use player's name as parameter, as Rollczi is the only player anyway.

Copy link
Member

@Jakubk15 Jakubk15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving for now, but please adjust to my and Gemini's suggestions above @Rollczi

Copy link
Member

@CitralFlo CitralFlo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, check out review from Gemini

org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true
org.gradle.configuration-cache.parallel=false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Member

@P1otrulla P1otrulla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants