Skip to content

Conversation

aSemy
Copy link
Contributor

@aSemy aSemy commented Jul 9, 2024

Add a seed to ensure consistent behaviour.

The test recently failed on CI:

https://github.com/kotest/kotest/actions/runs/9864899341/job/27240897776?pr=4141#step:7:976

> Task :kotest-property:jvmTest
com.***.kotest.property.arbitrary.BindShrinkTest[jvm]

  Test Shrinks all components to minimum value[jvm] FAILED

  java.lang.AssertionError: Test failed after 0s; attempted 5 times; underlying cause was "Property test failed for inputs
  
  0) MaximumComponents(a=1000, b=1000, c=1000, d=1000, e=1000, f=1000, g=1000, h=1000, i=1000, j=1000, k=1000, l=1000, m=1000, n=1000)
  
  Caused by java.lang.AssertionError: 1000 should be < 100 at
  	com.***.kotest.property.arbitrary.BindShrinkTest$1$2$2$stdout$1$1$1.invokeSuspend(BindShrinkTest.kt:54)
  	com.***.kotest.property.arbitrary.BindShrinkTest$1$2$2$stdout$1$1$1.invoke(BindShrinkTest.kt)
  	com.***.kotest.property.arbitrary.BindShrinkTest$1$2$2$stdout$1$1$1.invoke(BindShrinkTest.kt)
  	io.kotest.property.internal.ProptestKt$proptest$3$2.invokeSuspend(proptest.kt:49)
  
  " should include substring "Shrink result (after 45 shrinks) => MaximumComponents(a=0, b=0, c=0, d=0, e=0, f=0, g=0, h=0, i=0, j=0, k=0, l=0, m=100, n=0)"

  Caused by: java.lang.AssertionError: Test failed after 0s; attempted 5 times; underlying cause was "Property test failed for inputs
  
  0) MaximumComponents(a=1000, b=1000, c=1000, d=1000, e=1000, f=1000, g=1000, h=1000, i=1000, j=1000, k=1000, l=1000, m=1000, n=1000)
  
  Caused by java.lang.AssertionError: 1000 should be < 100 at
  	com.***.kotest.property.arbitrary.BindShrinkTest$1$2$2$stdout$1$1$1.invokeSuspend(BindShrinkTest.kt:54)
  	com.***.kotest.property.arbitrary.BindShrinkTest$1$2$2$stdout$1$1$1.invoke(BindShrinkTest.kt)
  	com.***.kotest.property.arbitrary.BindShrinkTest$1$2$2$stdout$1$1$1.invoke(BindShrinkTest.kt)
  	io.kotest.property.internal.ProptestKt$proptest$3$2.invokeSuspend(proptest.kt:49)
  
  " should include substring "Shrink result (after 45 shrinks) => MaximumComponents(a=0, b=0, c=0, d=0, e=0, f=0, g=0, h=0, i=0, j=0, k=0, l=0, m=100, n=0)"

  Caused by: java.lang.AssertionError: "Property test failed for inputs
  
  0) MaximumComponents(a=[1000](https://github.com/kotest/kotest/actions/runs/9864899341/job/27240897776?pr=4141#step:7:1001), b=1000, c=1000, d=1000, e=1000, f=1000, g=1000, h=1000, i=1000, j=1000, k=1000, l=1000, m=1000, n=1000)
  
  Caused by java.lang.AssertionError: 1000 should be < 100 at
  	com.***.kotest.property.arbitrary.BindShrinkTest$1$2$2$stdout$1$1$1.invokeSuspend(BindShrinkTest.kt:54)
  	com.***.kotest.property.arbitrary.BindShrinkTest$1$2$2$stdout$1$1$1.invoke(BindShrinkTest.kt)
  	com.***.kotest.property.arbitrary.BindShrinkTest$1$2$2$stdout$1$1$1.invoke(BindShrinkTest.kt)
  	io.kotest.property.internal.ProptestKt$proptest$3$2.invokeSuspend(proptest.kt:49)
  
  " should include substring "Shrink result (after 45 shrinks) => MaximumComponents(a=0, b=0, c=0, d=0, e=0, f=0, g=0, h=0, i=0, j=0, k=0, l=0, m=100, n=0)"

@aSemy aSemy marked this pull request as ready for review July 9, 2024 23:14
@aSemy aSemy requested a review from Kantis July 9, 2024 23:14
@aSemy aSemy mentioned this pull request Jul 9, 2024
20 tasks
Copy link
Member

@AlexCue987 AlexCue987 left a comment

Choose a reason for hiding this comment

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

It's a little bit difficult to review: apparently most changes are reformatting. I see one actual change:
checkAll(arb) => checkAll(PropTestConfig(seed = 0), arb).
Are there any other changes changes?

@aSemy
Copy link
Contributor Author

aSemy commented Jul 11, 2024

It's a little bit difficult to review: apparently most changes are reformatting. I see one actual change: checkAll(arb) => checkAll(PropTestConfig(seed = 0), arb). Are there any other changes changes?

Yeah, sorry, the file wasn't formatted with the default style. You're correct that there's only one change.

In GitHub there's an option to hide whitespace-only formatting, and that's helpful in this PR.

image

@AlexCue987
Copy link
Member

In GitHub there's an option to hide whitespace-only formatting, and that's helpful in this PR.

Nice, TIL!

@OliverO2
Copy link
Contributor

This is also ready to merge, right?

@aSemy
Copy link
Contributor Author

aSemy commented Jul 18, 2024

Yes, it's ready to merge. I would like @Kantis to review, since I'm re-doing his fix, but I think he'll be okay with it.

@sksamuel sksamuel enabled auto-merge July 20, 2024 03:43
@sksamuel sksamuel added this pull request to the merge queue Jul 20, 2024
Merged via the queue into master with commit ac3d370 Jul 20, 2024
7 checks passed
@sksamuel sksamuel deleted the adam/fix/BindShrinkTest-add-seed branch July 20, 2024 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants