Skip to content

assert.Eventually with low ticks cause panic: send on closed channel #805

@pgarneau

Description

@pgarneau

Setup

If you put an:
assert.Eventually(t, func() bool { return true }, time.Millisecond, 50 * time.Microsecond) inside your test, you will get flaky results and more often then not, you will get a panic:
panic: send on closed channel

Workaround

Increasing the tick to around 100 * time.Microsecond removes the flakyness

Solution

Add a waitgroup potentially so that this channel close waits for the gofunc writing to the channel completes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    assert.EventuallyAbout assert.Eventually/EventuallyWithTbugpkg-assertChange related to package testify/assert

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions