From f02fe2da1bfa936cdfb3d5491abdd14879ba2dea Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Sun, 2 Nov 2014 12:38:31 -0800 Subject: [PATCH] Deflake the TestCreate test, by adding an explicit wait. --- pkg/apiserver/apiserver_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/apiserver/apiserver_test.go b/pkg/apiserver/apiserver_test.go index 286e42951fc..52a055c50fd 100644 --- a/pkg/apiserver/apiserver_test.go +++ b/pkg/apiserver/apiserver_test.go @@ -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) @@ -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) {