https://kotlinlang.org logo
Title
d

DanielZ

01/24/2021, 8:40 PM
Don’t get it why CookieTests are failing? (Java 11 and german locale settings).
CookieTest > cookie with various expires date formats parsed() FAILED
    java.lang.AssertionError at CookieTest.kt:215

ClientCookiesTest > cookie expiry uses the same timezone as cookie parsing() FAILED
    java.lang.NullPointerException at ClientCookiesTest.kt:88
When I run only “CookieTest > cookie with various expires date formats parsed()” test is passing - but running all tests it’s always failing. Any Ideas?
v

Vojtěch Knyttl

01/25/2021, 7:23 AM
note that gradle might run tests in several threads according to your cpu - so if any of the tests use static variables or mock static fields, the tests might influence each other. i usually use
tasks.test {
        // Gradle forks tests according to available cores, so the test might run differently on different machines.
        // This is to prevent failures with static mocks. Also one must make sure to call @AfterEach[clearAllMocks, unmockkAll].
        maxParallelForks = 1
    }
to prevent that
d

DanielZ

01/25/2021, 8:15 AM
oh forgotten to mention I just cloned http4k repository and tried ./gradlew clean build where result was two failing tests.
s

s4nchez

01/25/2021, 8:19 AM
@DanielZ thank you for spotting this. Can you please open an issue so we don’t loose track of it? I’ll try and investigate as well as soon as I get a chance
d

DanielZ

01/25/2021, 8:20 AM
@s4nchez sure I can do this. Was first thinking about I do some stupid mistake 😊
s

s4nchez

01/25/2021, 8:26 AM
From what you’ve described, most likely we’ve made a stupid mistake 😜 and because it may be related to timezones, it’s likely to be annoying to reproduce
Well, that was easy enough to reproduce (on a mac is just a case of changing Region/Language in system preferences). Now I just need to find a fix...
@DanielZ that should not be fixed on master. Please pull and give it another try. Also, If you let me know your github user I can give you credit in the changelog 🙂
d

DanielZ

01/25/2021, 12:24 PM
@s4nchez wow you where faster then raising me an issue 😳 Yes it’s working now 😊 Thanks for the quick fix! (There are only two println() left in Cookie.kt) My github account is dzappold (https://github.com/dzappold/).
s

s4nchez

01/25/2021, 12:31 PM
All done. The change will be out on the next minor release. Thank you again for spotting it 🙂
👍 1