From 6366f93d10006905d64dfc85c30db5e3ae1edd81 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Thu, 27 Jul 2017 14:56:30 -0400 Subject: [PATCH] Clear collections between each test of TestList --- pkg/registry/registrytest/etcd.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/registry/registrytest/etcd.go b/pkg/registry/registrytest/etcd.go index 13abeac2baa..344ce4629b2 100644 --- a/pkg/registry/registrytest/etcd.go +++ b/pkg/registry/registrytest/etcd.go @@ -202,6 +202,10 @@ func (t *Tester) createObject(ctx genericapirequest.Context, obj runtime.Object) func (t *Tester) setObjectsForList(objects []runtime.Object) []runtime.Object { key := t.storage.KeyRootFunc(t.tester.TestContext()) + if _, err := t.storage.DeleteCollection(t.tester.TestContext(), nil, nil); err != nil { + t.tester.Errorf("unable to clear collection: %v", err) + return nil + } if err := storagetesting.CreateObjList(key, t.storage.Storage, objects); err != nil { t.tester.Errorf("unexpected error: %v", err) return nil