Adding tests to ensure plugins for container monitoring are running fine. (#3298)

This commit is contained in:
rashmichandrashekar 2018-06-20 11:08:05 -07:00 коммит произвёл Jack Francis
Родитель bbc665a3d3
Коммит 647dae5671
2 изменённых файлов: 81 добавлений и 0 удалений

Просмотреть файл

@ -222,6 +222,8 @@ metadata:
value: my_aks_cluster
- name: DISABLE_KUBE_SYSTEM_LOG_COLLECTION
value: "true"
- name: ISTEST
value: true
securityContext:
privileged: true
ports:

Просмотреть файл

@ -351,6 +351,85 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu
}
})
It("should have cluster-omsagent daemonset running", func() {
if hasContainerMonitoring, clusterContainerMonitoringAddon := eng.HasAddon("container-monitoring"); hasContainerMonitoring {
running, err := pod.WaitOnReady("omsagent-", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
By("Ensuring that the correct resources have been applied")
pods, err := pod.GetAllByPrefix("omsagent-", "kube-system")
Expect(err).NotTo(HaveOccurred())
for i, c := range clusterContainerMonitoringAddon.Containers {
err := pods[0].Spec.Containers[i].ValidateResources(c)
Expect(err).NotTo(HaveOccurred())
}
} else {
Skip("container monitoring disabled for this cluster, will not test")
}
})
It("should have cluster-omsagent replicaset running", func() {
if hasContainerMonitoring, clusterContainerMonitoringAddon := eng.HasAddon("container-monitoring"); hasContainerMonitoring {
running, err := pod.WaitOnReady("omsagent-rs", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
By("Ensuring that the correct resources have been applied")
pods, err := pod.GetAllByPrefix("omsagent-rs", "kube-system")
Expect(err).NotTo(HaveOccurred())
for i, c := range clusterContainerMonitoringAddon.Containers {
err := pods[0].Spec.Containers[i].ValidateResources(c)
Expect(err).NotTo(HaveOccurred())
}
} else {
Skip("container monitoring disabled for this cluster, will not test")
}
})
It("should be successfully running kubepodinventory plugin - ContainerMonitoring", func() {
if hasContainerMonitoring, _ := eng.HasAddon("container-monitoring"); hasContainerMonitoring {
running, err := pod.WaitOnReady("omsagent-rs", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
By("Ensuring that the kubepodinventory plugin is writing data successfully")
pods, err := pod.GetAllByPrefix("omsagent-rs", "kube-system")
Expect(err).NotTo(HaveOccurred())
_, err = pods[0].Exec("grep", "\"in_kube_podinventory::emit-stream : Success\"", "/var/opt/microsoft/omsagent/log/omsagent.log")
Expect(err).NotTo(HaveOccurred())
} else {
Skip("container monitoring disabled for this cluster, will not test")
}
})
It("should be successfully running kubenodeinventory plugin - ContainerMonitoring", func() {
if hasContainerMonitoring, _ := eng.HasAddon("container-monitoring"); hasContainerMonitoring {
running, err := pod.WaitOnReady("omsagent-rs", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
By("Ensuring that the kubenodeinventory plugin is writing data successfully")
pods, err := pod.GetAllByPrefix("omsagent-rs", "kube-system")
Expect(err).NotTo(HaveOccurred())
_, err = pods[0].Exec("grep", "\"in_kube_nodeinventory::emit-stream : Success\"", "/var/opt/microsoft/omsagent/log/omsagent.log")
Expect(err).NotTo(HaveOccurred())
} else {
Skip("container monitoring disabled for this cluster, will not test")
}
})
It("should be successfully running cadvisor_perf plugin - ContainerMonitoring", func() {
if hasContainerMonitoring, _ := eng.HasAddon("container-monitoring"); hasContainerMonitoring {
running, err := pod.WaitOnReady("omsagent-", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
By("Ensuring that the cadvisor_perf plugin is writing data successfully")
pods, err := pod.GetAllByPrefix("omsagent-", "kube-system")
Expect(err).NotTo(HaveOccurred())
_, err = pods[0].Exec("grep", "\"in_cadvisor_perf::emit-stream : Success\"", "/var/opt/microsoft/omsagent/log/omsagent.log")
Expect(err).NotTo(HaveOccurred())
} else {
Skip("container monitoring disabled for this cluster, will not test")
}
})
It("should have rescheduler running", func() {
if hasRescheduler, reschedulerAddon := eng.HasAddon("rescheduler"); hasRescheduler {
running, err := pod.WaitOnReady("rescheduler", "kube-system", 3, 30*time.Second, cfg.Timeout)