diff --git a/pkg/apiserver/operation_test.go b/pkg/apiserver/operation_test.go index d596f75d297..a322f958782 100644 --- a/pkg/apiserver/operation_test.go +++ b/pkg/apiserver/operation_test.go @@ -92,7 +92,15 @@ func TestOperation(t *testing.T) { } func TestOperationsList(t *testing.T) { - simpleStorage := &SimpleRESTStorage{} + testOver := make(chan struct{}) + defer close(testOver) + simpleStorage := &SimpleRESTStorage{ + injectedFunction: func(obj interface{}) (interface{}, error) { + // Eliminate flakes by ensuring the create operation takes longer than this test. + <-testOver + return obj, nil + }, + } handler := Handle(map[string]RESTStorage{ "foo": simpleStorage, }, codec, "/prefix/version")