https://github.com/datenhahn/golang-awaitility
golang-awaitility provides a simple mechanism to poll for conditions with a general timeout.
https://github.com/datenhahn/golang-awaitility
Last synced: about 1 year ago
JSON representation
golang-awaitility provides a simple mechanism to poll for conditions with a general timeout.
- Host: GitHub
- URL: https://github.com/datenhahn/golang-awaitility
- Owner: datenhahn
- License: mit
- Created: 2018-07-10T00:10:07.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-10T10:10:45.000Z (almost 8 years ago)
- Last Synced: 2025-04-11T23:52:15.346Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 6
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# golang-awaitility

Package golang_awaitility provides a simple mechanism to poll for conditions with a general timeout.
It is inspired by the great jvm lib "awaitility" (see https://github.com/awaitility/awaitility)
## Example
```go
package example
import (
"github.com/ecodia/golang-awaitility/awaitility"
"testing"
"time"
)
func TestSomething(t *testing.T) {
err := awaitility.Await(100 * time.Millisecond, 1000 * time.Millisecond, func() bool {
// do a real check here, e.g. some kind of isConnected()
return true
})
if err != nil {
t.Errorf("Unexpected error during await: %s", err)
}
}
```