mirror of https://github.com/k3s-io/k3s
Enable update tests in federated namespace controller
parent
5e41d0904f
commit
b70e194fea
|
@ -62,7 +62,7 @@ func TestNamespaceController(t *testing.T) {
|
||||||
cluster1Watch := RegisterFakeWatch("namespaces", &cluster1Client.Fake)
|
cluster1Watch := RegisterFakeWatch("namespaces", &cluster1Client.Fake)
|
||||||
RegisterFakeList("namespaces", &cluster1Client.Fake, &apiv1.NamespaceList{Items: []apiv1.Namespace{}})
|
RegisterFakeList("namespaces", &cluster1Client.Fake, &apiv1.NamespaceList{Items: []apiv1.Namespace{}})
|
||||||
cluster1CreateChan := RegisterFakeCopyOnCreate("namespaces", &cluster1Client.Fake, cluster1Watch)
|
cluster1CreateChan := RegisterFakeCopyOnCreate("namespaces", &cluster1Client.Fake, cluster1Watch)
|
||||||
// cluster1UpdateChan := RegisterFakeCopyOnUpdate("namespaces", &cluster1Client.Fake, cluster1Watch)
|
cluster1UpdateChan := RegisterFakeCopyOnUpdate("namespaces", &cluster1Client.Fake, cluster1Watch)
|
||||||
|
|
||||||
cluster2Client := &fakekubeclientset.Clientset{}
|
cluster2Client := &fakekubeclientset.Clientset{}
|
||||||
cluster2Watch := RegisterFakeWatch("namespaces", &cluster2Client.Fake)
|
cluster2Watch := RegisterFakeWatch("namespaces", &cluster2Client.Fake)
|
||||||
|
@ -132,25 +132,19 @@ func TestNamespaceController(t *testing.T) {
|
||||||
cluster1.Name, ns1.Name, wait.ForeverTestTimeout)
|
cluster1.Name, ns1.Name, wait.ForeverTestTimeout)
|
||||||
assert.Nil(t, err, "namespace should have appeared in the informer store")
|
assert.Nil(t, err, "namespace should have appeared in the informer store")
|
||||||
|
|
||||||
/*
|
// Test update federated namespace.
|
||||||
// TODO: Uncomment this once we have figured out why this is flaky.
|
ns1.Annotations = map[string]string{
|
||||||
// Test update federated namespace.
|
"A": "B",
|
||||||
ns1.Annotations = map[string]string{
|
}
|
||||||
"A": "B",
|
namespaceWatch.Modify(&ns1)
|
||||||
}
|
assert.NoError(t, CheckObjectFromChan(cluster1UpdateChan, MetaAndSpecCheckingFunction(&ns1)))
|
||||||
namespaceWatch.Modify(&ns1)
|
|
||||||
updatedNamespace = GetNamespaceFromChan(cluster1UpdateChan)
|
|
||||||
assert.NotNil(t, updatedNamespace)
|
|
||||||
assert.Equal(t, ns1.Name, updatedNamespace.Name)
|
|
||||||
// assert.Contains(t, updatedNamespace.Annotations, "A")
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Test add cluster
|
// Test add cluster
|
||||||
clusterWatch.Add(cluster2)
|
clusterWatch.Add(cluster2)
|
||||||
createdNamespace2 := GetNamespaceFromChan(cluster2CreateChan)
|
createdNamespace2 := GetNamespaceFromChan(cluster2CreateChan)
|
||||||
assert.NotNil(t, createdNamespace2)
|
assert.NotNil(t, createdNamespace2)
|
||||||
assert.Equal(t, ns1.Name, createdNamespace2.Name)
|
assert.Equal(t, ns1.Name, createdNamespace2.Name)
|
||||||
// assert.Contains(t, createdNamespace2.Annotations, "A")
|
assert.Contains(t, createdNamespace2.Annotations, "A")
|
||||||
|
|
||||||
// Delete the namespace with orphan finalizer (let namespaces
|
// Delete the namespace with orphan finalizer (let namespaces
|
||||||
// in underlying clusters be as is).
|
// in underlying clusters be as is).
|
||||||
|
|
Loading…
Reference in New Issue