Skip to content

Commit

Permalink
Update grace period func test's node assignment
Browse files Browse the repository at this point in the history
Signed-off-by: David Vossel <[email protected]>
  • Loading branch information
davidvossel committed Dec 8, 2017
1 parent 25db069 commit 499f0c3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/vmlifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ var _ = Describe("Vmlifecycle", func() {
}, 30)

It("if grace period greater than 0, graceful shutdown should be attempted on delete", func(done Done) {
nodes, err := virtClient.CoreV1().Nodes().List(metav1.ListOptions{})
Expect(err).ToNot(HaveOccurred())
Expect(nodes.Items).ToNot(BeEmpty())
node := nodes.Items[0].Name

virtHandlerPod, err := kubecli.NewVirtHandlerClient(virtClient).ForNode(primaryNodeName).Pod()
virtHandlerPod, err := kubecli.NewVirtHandlerClient(virtClient).ForNode(node).Pod()
Expect(err).ToNot(HaveOccurred())

handlerName := virtHandlerPod.GetObjectMeta().GetName()
Expand All @@ -120,7 +124,7 @@ var _ = Describe("Vmlifecycle", func() {
// Give the VM a custom grace period
vm.Spec.TerminationGracePeriodSeconds = &gracePeriod
// Make sure we schedule the VM to master
vm.Spec.NodeSelector = map[string]string{"kubernetes.io/hostname": primaryNodeName}
vm.Spec.NodeSelector = map[string]string{"kubernetes.io/hostname": node}

obj, err := virtClient.RestClient().Post().Resource("virtualmachines").Namespace(tests.NamespaceTestDefault).Body(vm).Do().Get()
Expect(err).To(BeNil())
Expand Down

0 comments on commit 499f0c3

Please sign in to comment.