Skip to content

Commit

Permalink
Merge pull request #496 from caseydavenport/fix-basic-pod
Browse files Browse the repository at this point in the history
Fix up flaky pod test in kdd FVs
  • Loading branch information
caseydavenport authored Aug 12, 2017
2 parents b4a8c62 + b4d753e commit 8ffc50b
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions lib/backend/k8s/k8s_fv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1012,39 +1012,39 @@ var _ = Describe("Test Syncer API for Kubernetes backend", func() {
Expect(err).NotTo(HaveOccurred())
})

expectedKeys := []api.Update{
api.Update{
model.KVPair{
Key: model.WorkloadEndpointKey{
Hostname: "127.0.0.1",
OrchestratorID: "k8s",
WorkloadID: fmt.Sprintf("default.%s", pod.ObjectMeta.Name),
EndpointID: "eth0",
},
},
api.UpdateTypeKVNew,
expectedKVP := model.KVPair{
Key: model.WorkloadEndpointKey{
Hostname: "127.0.0.1",
OrchestratorID: "k8s",
WorkloadID: fmt.Sprintf("default.%s", pod.ObjectMeta.Name),
EndpointID: "eth0",
},
}

By("Expecting an update on the Syncer API", func() {
cb.ExpectExists(expectedKeys)
By("Expecting an update with type 'KVUpdated' on the Syncer API", func() {
cb.ExpectExists([]api.Update{
{KVPair: expectedKVP, UpdateType: api.UpdateTypeKVUpdated},
})
})

By("Expecting a Syncer snapshot to include the update", func() {
By("Expecting a Syncer snapshot to include the update with type 'KVNew'", func() {
// Create a new syncer / callback pair so that it performs a snapshot.
cfg := capi.KubeConfig{K8sAPIEndpoint: "http://localhost:8080"}
_, snapshotCallbacks, snapshotSyncer := CreateClientAndSyncer(cfg)
go snapshotCallbacks.ProcessUpdates()
snapshotSyncer.Start()

// Expect the snapshot to include the right keys.
snapshotCallbacks.ExpectExists(expectedKeys)
// Expect the snapshot to include workload endpoint with type "KVNew".
snapshotCallbacks.ExpectExists([]api.Update{
{KVPair: expectedKVP, UpdateType: api.UpdateTypeKVNew},
})

})

By("Deleting the Pod and expecting the wep to be deleted", func() {
err = c.clientSet.Pods("default").Delete(pod.ObjectMeta.Name, &metav1.DeleteOptions{})
Expect(err).NotTo(HaveOccurred())
cb.ExpectDeleted([]model.KVPair{expectedKeys[0].KVPair})
cb.ExpectDeleted([]model.KVPair{expectedKVP})
})
})

Expand Down

0 comments on commit 8ffc50b

Please sign in to comment.