Skip to content

Commit

Permalink
Merge pull request #36536 from nikhiljindal/disableTest
Browse files Browse the repository at this point in the history
Disabling flaky federation unit tests
  • Loading branch information
jessfraz committed Nov 9, 2016
2 parents 8b5264e + 6b5375b commit 3bd8704
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestNamespaceController(t *testing.T) {
cluster1Watch := RegisterFakeWatch("namespaces", &cluster1Client.Fake)
RegisterFakeList("namespaces", &cluster1Client.Fake, &api_v1.NamespaceList{Items: []api_v1.Namespace{}})
cluster1CreateChan := RegisterFakeCopyOnCreate("namespaces", &cluster1Client.Fake, cluster1Watch)
cluster1UpdateChan := RegisterFakeCopyOnUpdate("namespaces", &cluster1Client.Fake, cluster1Watch)
// cluster1UpdateChan := RegisterFakeCopyOnUpdate("namespaces", &cluster1Client.Fake, cluster1Watch)

cluster2Client := &fake_kubeclientset.Clientset{}
cluster2Watch := RegisterFakeWatch("namespaces", &cluster2Client.Fake)
Expand Down Expand Up @@ -132,15 +132,18 @@ func TestNamespaceController(t *testing.T) {
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",
}
namespaceWatch.Modify(&ns1)
updatedNamespace = GetNamespaceFromChan(cluster1UpdateChan)
assert.NotNil(t, updatedNamespace)
assert.Equal(t, ns1.Name, updatedNamespace.Name)
// assert.Contains(t, updatedNamespace.Annotations, "A")
/*
// TODO: Uncomment this once we have figured out why this is flaky.
// Test update federated namespace.
ns1.Annotations = map[string]string{
"A": "B",
}
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
clusterWatch.Add(cluster2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestSecretController(t *testing.T) {
cluster1Watch := RegisterFakeWatch("secrets", &cluster1Client.Fake)
RegisterFakeList("secrets", &cluster1Client.Fake, &api_v1.SecretList{Items: []api_v1.Secret{}})
cluster1CreateChan := RegisterFakeCopyOnCreate("secrets", &cluster1Client.Fake, cluster1Watch)
cluster1UpdateChan := RegisterFakeCopyOnUpdate("secrets", &cluster1Client.Fake, cluster1Watch)
// cluster1UpdateChan := RegisterFakeCopyOnUpdate("secrets", &cluster1Client.Fake, cluster1Watch)

cluster2Client := &fake_kubeclientset.Clientset{}
cluster2Watch := RegisterFakeWatch("secrets", &cluster2Client.Fake)
Expand Down Expand Up @@ -116,35 +116,38 @@ func TestSecretController(t *testing.T) {
cluster1.Name, types.NamespacedName{Namespace: secret1.Namespace, Name: secret1.Name}.String(), wait.ForeverTestTimeout)
assert.Nil(t, err, "secret should have appeared in the informer store")

// Test update federated secret.
secret1.Annotations = map[string]string{
"A": "B",
}
secretWatch.Modify(&secret1)
updatedSecret = GetSecretFromChan(cluster1UpdateChan)
assert.NotNil(t, updatedSecret)
assert.Equal(t, secret1.Name, updatedSecret.Name)
assert.Equal(t, secret1.Namespace, updatedSecret.Namespace)
assert.True(t, secretsEqual(secret1, *updatedSecret),
fmt.Sprintf("expected: %v, actual: %v", secret1, *updatedSecret))
// Wait for the secret to be updated in the informer store.
err = WaitForSecretStoreUpdate(
secretController.secretFederatedInformer.GetTargetStore(),
cluster1.Name, types.NamespacedName{Namespace: secret1.Namespace, Name: secret1.Name}.String(),
updatedSecret, wait.ForeverTestTimeout)
assert.Nil(t, err, "secret should have been updated in the informer store")

// Test update federated secret.
secret1.Data = map[string][]byte{
"config": []byte("myconfigurationfile"),
}
secretWatch.Modify(&secret1)
updatedSecret2 := GetSecretFromChan(cluster1UpdateChan)
assert.NotNil(t, updatedSecret2)
assert.Equal(t, secret1.Name, updatedSecret2.Name)
assert.Equal(t, secret1.Namespace, updatedSecret.Namespace)
assert.True(t, secretsEqual(secret1, *updatedSecret2),
fmt.Sprintf("expected: %v, actual: %v", secret1, *updatedSecret2))
/*
// TODO: Uncomment this once we have figured out why this is flaky.
// Test update federated secret.
secret1.Annotations = map[string]string{
"A": "B",
}
secretWatch.Modify(&secret1)
updatedSecret = GetSecretFromChan(cluster1UpdateChan)
assert.NotNil(t, updatedSecret)
assert.Equal(t, secret1.Name, updatedSecret.Name)
assert.Equal(t, secret1.Namespace, updatedSecret.Namespace)
assert.True(t, secretsEqual(secret1, *updatedSecret),
fmt.Sprintf("expected: %v, actual: %v", secret1, *updatedSecret))
// Wait for the secret to be updated in the informer store.
err = WaitForSecretStoreUpdate(
secretController.secretFederatedInformer.GetTargetStore(),
cluster1.Name, types.NamespacedName{Namespace: secret1.Namespace, Name: secret1.Name}.String(),
updatedSecret, wait.ForeverTestTimeout)
assert.Nil(t, err, "secret should have been updated in the informer store")
// Test update federated secret.
secret1.Data = map[string][]byte{
"config": []byte("myconfigurationfile"),
}
secretWatch.Modify(&secret1)
updatedSecret2 := GetSecretFromChan(cluster1UpdateChan)
assert.NotNil(t, updatedSecret2)
assert.Equal(t, secret1.Name, updatedSecret2.Name)
assert.Equal(t, secret1.Namespace, updatedSecret.Namespace)
assert.True(t, secretsEqual(secret1, *updatedSecret2),
fmt.Sprintf("expected: %v, actual: %v", secret1, *updatedSecret2))
*/

// Test add cluster
clusterWatch.Add(cluster2)
Expand Down

0 comments on commit 3bd8704

Please sign in to comment.