Skip to content

Commit

Permalink
cnf-network: fixed Metallb metric tests (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenLevin authored Aug 22, 2024
1 parent f4f7035 commit 3c66af5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/cnf/core/network/metallb/internal/frr/frr.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func IsProtocolConfigured(frrPod *pod.Builder, protocol string) (bool, error) {

// GetMetricsByPrefix pulls all metrics from frr pods and sort them in the list by given prefix.
func GetMetricsByPrefix(frrPod *pod.Builder, metricPrefix string) ([]string, error) {
stdout, err := frrPod.ExecCommand([]string{"curl", "localhost:29151/metrics"}, "frr")
stdout, err := frrPod.ExecCommand([]string{"curl", "localhost:7573/metrics"}, "frr")

if err != nil {
return nil, err
Expand Down
9 changes: 5 additions & 4 deletions tests/cnf/core/network/metallb/internal/tsparams/mlbvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ var (
// TestLabel represents node label for testing.
TestLabel = map[string]string{"test": "label"}
// MetalLbBgpMetrics represents the list of expected metallb metrics.
MetalLbBgpMetrics = []string{"metallb_bgp_keepalives_sent", "metallb_bgp_keepalives_received",
"metallb_bgp_notifications_sent", "metallb_bgp_opens_received", "metallb_bgp_opens_sent",
"metallb_bgp_route_refresh_sent", "metallb_bgp_session_up", "metallb_bgp_total_received", "metallb_bgp_total_sent",
"metallb_bgp_updates_total", "metallb_bgp_updates_total_received", "metallb_bgp_announced_prefixes_total",
MetalLbBgpMetrics = []string{"frrk8s_bgp_keepalives_sent", "frrk8s_bgp_keepalives_received",
"frrk8s_bgp_notifications_sent", "frrk8s_bgp_opens_received", "frrk8s_bgp_opens_sent",
"frrk8s_bgp_route_refresh_sent", "frrk8s_bgp_session_up", "frrk8s_bgp_total_received", "frrk8s_bgp_total_sent",
"frrk8s_bgp_updates_total", "frrk8s_bgp_updates_total_received", "frrk8s_bgp_announced_prefixes_total",
"frrk8s_bgp_received_prefixes_total",
}
)

Expand Down
2 changes: 1 addition & 1 deletion tests/cnf/core/network/metallb/tests/bfd-test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ var _ = Describe("BFD", Ordered, Label(tsparams.LabelBFDTestCases), ContinueOnFa
})
Expect(err).ToNot(HaveOccurred(), "Failed to list prometheus pods")

verifyMetricPresentInPrometheus(frrk8sPods, prometheusPods[0], "metallb_bfd_")
verifyMetricPresentInPrometheus(frrk8sPods, prometheusPods[0], "frrk8s_bfd_")
})

AfterEach(func() {
Expand Down
2 changes: 1 addition & 1 deletion tests/cnf/core/network/metallb/tests/bgp-tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ var _ = Describe("BGP", Ordered, Label(tsparams.LabelBGPTestCases), ContinueOnFa
Expect(err).ToNot(HaveOccurred(), "Failed to list prometheus pods")

verifyMetricPresentInPrometheus(
frrk8sPods, prometheusPods[0], "metallb_bgp_", tsparams.MetalLbBgpMetrics)
frrk8sPods, prometheusPods[0], "frrk8s_bgp_", tsparams.MetalLbBgpMetrics)
})

AfterAll(func() {
Expand Down

0 comments on commit 3c66af5

Please sign in to comment.