wait for store update before modify

This commit is contained in:
Seth Jennings
2016-10-02 21:44:05 -05:00
parent 158dc1a863
commit 98ff390a63
3 changed files with 25 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ import (
fake_kubeclientset "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/fake"
"k8s.io/kubernetes/pkg/client/testing/core"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/wait"
"github.com/stretchr/testify/assert"
)
@@ -111,6 +112,12 @@ func TestNamespaceController(t *testing.T) {
assert.NotNil(t, createdNamespace)
assert.Equal(t, ns1.Name, createdNamespace.Name)
// Wait for the secret to appear in the informer store
err := WaitForStoreUpdate(
namespaceController.namespaceFederatedInformer.GetTargetStore(),
cluster1.Name, ns1.Name, wait.ForeverTestTimeout)
assert.Nil(t, err, "namespace should have appeared in the informer store")
// Test update federated namespace.
ns1.Annotations = map[string]string{
"A": "B",