mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-07 11:22:10 +02:00
fn: remove flaky test
In this commit, we remove TestPropForEachConcOutperformsMapWhenExpensive as it's flaky and causes the CI to fail. The previous commit intro- duced a replacement, which benchmarked the functions.
This commit is contained in:
@@ -300,48 +300,6 @@ func TestPropForEachConcMapIsomorphism(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestPropForEachConcOutperformsMapWhenExpensive ensures the property that
|
|
||||||
// ForEachConc will beat Map in a race in circumstances where the computation in
|
|
||||||
// the argument closure is expensive.
|
|
||||||
func TestPropForEachConcOutperformsMapWhenExpensive(t *testing.T) {
|
|
||||||
f := func(incSize int, s []int) bool {
|
|
||||||
if len(s) < 2 {
|
|
||||||
// Intuitively we don't expect the extra overhead of
|
|
||||||
// ForEachConc to justify itself for list sizes of 1 or
|
|
||||||
// 0.
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
inc := func(i int) int {
|
|
||||||
time.Sleep(time.Millisecond)
|
|
||||||
return i + incSize
|
|
||||||
}
|
|
||||||
c := make(chan bool, 1)
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
Map(s, inc)
|
|
||||||
select {
|
|
||||||
case c <- false:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
ForEachConc(s, inc)
|
|
||||||
select {
|
|
||||||
case c <- true:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
return <-c
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := quick.Check(f, nil); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestPropFindIdxFindIdentity(t *testing.T) {
|
func TestPropFindIdxFindIdentity(t *testing.T) {
|
||||||
f := func(div, mod uint8, s []uint8) bool {
|
f := func(div, mod uint8, s []uint8) bool {
|
||||||
if div == 0 || div == 1 {
|
if div == 0 || div == 1 {
|
||||||
|
Reference in New Issue
Block a user