Skip to content

Commit

Permalink
Merge pull request kubernetes#2125 from brendandburns/flake
Browse files Browse the repository at this point in the history
Deflake the TestCreate test, by adding an explicit wait.
  • Loading branch information
dchen1107 committed Nov 3, 2014
2 parents e99eac0 + f02fe2d commit 6cc5b7d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/apiserver/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,14 @@ func TestUpdateMissing(t *testing.T) {
}

func TestCreate(t *testing.T) {
simpleStorage := &SimpleRESTStorage{}
wait := sync.WaitGroup{}
wait.Add(1)
simpleStorage := &SimpleRESTStorage{
injectedFunction: func(obj runtime.Object) (returnObj runtime.Object, err error) {
wait.Wait()
return &Simple{}, nil
},
}
handler := Handle(map[string]RESTStorage{
"foo": simpleStorage,
}, codec, "/prefix/version", selfLinker)
Expand Down Expand Up @@ -537,6 +544,7 @@ func TestCreate(t *testing.T) {
if itemOut.Status != api.StatusWorking || itemOut.Details == nil || itemOut.Details.ID == "" {
t.Errorf("Unexpected status: %#v (%s)", itemOut, string(body))
}
wait.Done()
}

func TestCreateNotFound(t *testing.T) {
Expand Down

0 comments on commit 6cc5b7d

Please sign in to comment.