Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitoring web test fix #1730

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions test/web/monitoring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,24 +360,30 @@ var _ = Describe("Monitoring", Ordered, Label("web"), func() {
By("clicking the Save button")
b.Click("div.uninstall-capabilities-dialog .card-actions button.role-primary")

By("confirming that all agents have the capability uninstalled")
hasMetrics := func(c *corev1.Cluster) bool {
return capabilities.Has(c, capabilities.Cluster(wellknown.CapabilityMetrics))
}
Eventually(func() (*corev1.Cluster, error) {
return mgmtClient.GetCluster(context.Background(), &corev1.Reference{Id: "monitoring-test-agent1"})
}).Should(WithTransform(hasMetrics, BeFalse()))

Eventually(func() (*corev1.Cluster, error) {
return mgmtClient.GetCluster(context.Background(), &corev1.Reference{Id: "monitoring-test-agent2"})
}).Should(WithTransform(hasMetrics, BeFalse()))

Eventually(func() (*corev1.Cluster, error) {
return mgmtClient.GetCluster(context.Background(), &corev1.Reference{Id: "monitoring-test-agent3"})
}).Should(WithTransform(hasMetrics, BeFalse()))

By("refreshing the page")
b.Navigate(webUrl + "/monitoring") // this status is polled on a 10 second interval

By("confirming that the local agent has the Degraded badge")
Eventually(Table().Row(1)).Should(MatchCells(CheckBox(), HaveDegradedBadge(), b.HaveInnerText("monitoring-test-agent1")))
By("confirming that the other agents have the Not Installed badge")
Eventually(Table().Row(2)).Should(MatchCells(CheckBox(), Or(HaveNotInstalledBadge(), HaveUninstallingBadge()), b.HaveInnerText("monitoring-test-agent2")))
Eventually(Table().Row(3)).Should(MatchCells(CheckBox(), Or(HaveNotInstalledBadge(), HaveUninstallingBadge()), b.HaveInnerText("monitoring-test-agent3")))

By("confirming that all agents have the capability uninstalled")
c, err := mgmtClient.GetCluster(context.Background(), &corev1.Reference{Id: "monitoring-test-agent1"})
Expect(err).NotTo(HaveOccurred())
Expect(capabilities.Has(c, capabilities.Cluster(wellknown.CapabilityMetrics))).To(BeFalse())

c, err = mgmtClient.GetCluster(context.Background(), &corev1.Reference{Id: "monitoring-test-agent2"})
Expect(err).NotTo(HaveOccurred())
Expect(capabilities.Has(c, capabilities.Cluster(wellknown.CapabilityMetrics))).To(BeFalse())

c, err = mgmtClient.GetCluster(context.Background(), &corev1.Reference{Id: "monitoring-test-agent3"})
Expect(err).NotTo(HaveOccurred())
Expect(capabilities.Has(c, capabilities.Cluster(wellknown.CapabilityMetrics))).To(BeFalse())
})

It("should uninstall monitoring", func() {
Expand Down