helper/resource: wait should return obj

This commit is contained in:
Jack Pearkes 2014-06-30 18:18:36 -07:00
parent eb7c8c07c8
commit 5ae69778a1
1 changed files with 16 additions and 3 deletions

View File

@ -35,12 +35,16 @@ func TestWaitForState_timeout(t *testing.T) {
Timeout: 1 * time.Millisecond,
}
_, err := conf.WaitForState()
obj, err := conf.WaitForState()
if err == nil && err.Error() != "timeout while waiting for state to become 'running'" {
t.Fatalf("err: %s", err)
}
if obj != nil {
t.Fatalf("should not return obj")
}
}
func TestWaitForState_success(t *testing.T) {
@ -51,11 +55,16 @@ func TestWaitForState_success(t *testing.T) {
Timeout: 200 * time.Second,
}
_, err := conf.WaitForState()
obj, err := conf.WaitForState()
if err != nil {
t.Fatalf("err: %s", err)
}
if obj == nil {
t.Fatalf("should return obj")
}
}
func TestWaitForState_failure(t *testing.T) {
@ -66,9 +75,13 @@ func TestWaitForState_failure(t *testing.T) {
Timeout: 200 * time.Second,
}
_, err := conf.WaitForState()
obj, err := conf.WaitForState()
if err == nil && err.Error() != "failed" {
t.Fatalf("err: %s", err)
}
if obj != nil {
t.Fatalf("should not return obj")
}
}