blob: 52ab8011e0c2cd33628c896fd090796264db3ddd [file] [log] [blame]
Jon Perritt59c68fc2014-10-06 17:32:15 -05001package gophercloud
2
3import (
4 "testing"
Jamie Hannafordb7a764d2014-10-27 14:40:55 +01005 "time"
Jon Perritt59c68fc2014-10-06 17:32:15 -05006
7 th "github.com/rackspace/gophercloud/testhelper"
8)
9
10func TestWaitFor(t *testing.T) {
11 err := WaitFor(0, func() (bool, error) {
Jamie Hannafordb7a764d2014-10-27 14:40:55 +010012 time.Sleep(1 * time.Second)
Jon Perritt59c68fc2014-10-06 17:32:15 -050013 return true, nil
14 })
15 if err == nil {
16 t.Errorf("Expected error: 'Time out in WaitFor'")
17 }
18
19 err = WaitFor(5, func() (bool, error) {
20 return true, nil
21 })
22 th.CheckNoErr(t, err)
23}