Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When building Kotlin code where functions have extremely long names, I get a "permission denied" error on Linux Mint

When I'm compiling Kotlin code and some functions have extremely long names, I get an error saying "Permission denied" on Linux Mint 20.3.

The culprits are usually tests that have been named like this: fun ``This test fails when we get 500 from this external api but it should not really fail because this is a test with a really long name``() { // Test code }

The error I get then is this: `

Task :compileTestKotlin FAILED e: error while writing /home/dbrats/src/misc/my-repository/build/classes/kotlin/test/com/test/repo/MyClassTest$This test fails when we get 500 from this external api but it should not really fail because this is a test with a really long name$actualResponse$1.class (Permission denied) `

If I rename the function to something shorter (or clone the repo in /tmp/ so the path is shorter), it will build fine. So I figure it's related to some max path + filename length issues in my OS, but I can't figure out how to fix this without having to rename 50+ tests everytime I build someone's code (but I honestly think people should give their test functions shorter names than this...)

System: Linux Mint 20.3 ext4

Thanks!

like image 524
dbrats Avatar asked Feb 02 '26 17:02

dbrats


1 Answers

In JUnit 5, there is @DisplayName annotation:

Example:

@Test
@DisplayName("Your very long test name from the api")
public void longTestName() {
    assertEquals(true, true);
}

Choose a shorter test name and add your long name in the @DisplayName annotation.

like image 73
Fah Avatar answered Feb 05 '26 08:02

Fah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!