Skip to content

Commit

Permalink
Fix machinehealthcheck test
Browse files Browse the repository at this point in the history
  • Loading branch information
vikaschoudhary16 authored and enxebre committed Apr 12, 2019
1 parent 21eb9e3 commit 39c10c5
Showing 1 changed file with 16 additions and 31 deletions.
47 changes: 16 additions & 31 deletions pkg/e2e/machinehealthcheck/machinehealthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,46 +104,31 @@ var _ = Describe("[Feature:MachineHealthCheck] MachineHealthCheck controller", f
glog.V(2).Infof("Create machine health check with label selector: %s", workerMachine.Labels)
err = e2e.CreateMachineHealthCheck(workerMachine.Labels)
Expect(err).ToNot(HaveOccurred())
})

Context("with node-unhealthy-conditions configmap", func() {
BeforeEach(func() {
unhealthyConditions := &conditions.UnhealthyConditions{
Items: []conditions.UnhealthyCondition{
{
Name: "Ready",
Status: "Unknown",
Timeout: "60s",
},
unhealthyConditions := &conditions.UnhealthyConditions{
Items: []conditions.UnhealthyCondition{
{
Name: "Ready",
Status: "Unknown",
Timeout: "60s",
},
}
glog.V(2).Infof("Create node-unhealthy-conditions configmap")
err := e2e.CreateUnhealthyConditionsConfigMap(unhealthyConditions)
Expect(err).ToNot(HaveOccurred())
})
},
}
glog.V(2).Infof("Create node-unhealthy-conditions configmap")
err = e2e.CreateUnhealthyConditionsConfigMap(unhealthyConditions)
Expect(err).ToNot(HaveOccurred())
})

Context("with node-unhealthy-conditions configmap", func() {
It("should delete unhealthy machine", func() {
stopKubeletAndValidateMachineDeletion(workerNode, workerMachine, 2*time.Minute)
stopKubeletAndValidateMachineDeletion(workerNode, workerMachine, 6*time.Minute)
})

AfterEach(func() {
glog.V(2).Infof("Delete node-unhealthy-conditions configmap")
err := e2e.DeleteUnhealthyConditionsConfigMap()
Expect(err).ToNot(HaveOccurred())
})
})

It("should delete unhealthy machine", func() {
stopKubeletAndValidateMachineDeletion(workerNode, workerMachine, 6*time.Minute)
})

AfterEach(func() {
isKubemarkProvider, err := e2e.IsKubemarkProvider(client)
glog.V(2).Infof("Delete node-unhealthy-conditions configmap")
err := e2e.DeleteUnhealthyConditionsConfigMap()
Expect(err).ToNot(HaveOccurred())
if isKubemarkProvider {
glog.V(2).Info("Can not run this tests with the 'KubeMark' provider")
Skip("Can not run this tests with the 'KubeMark' provider")
}

waitForWorkersToGetReady(numberOfReadyWorkers)
deleteMachineHealthCheck(e2e.MachineHealthCheckName)
Expand Down

0 comments on commit 39c10c5

Please sign in to comment.