Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func collectUpgradingDurationMetric(ch chan<- prometheus.Metric, clk clock.Clock

func collectLimitedSupportMetric(ch chan<- prometheus.Metric, hcluster *hyperv1.HostedCluster, hclusterLabelValues []string) {
limitedSupportValue := 0.0
if _, ok := hcluster.Labels[hyperv1.LimitedSupportLabel]; ok {
if v, ok := hcluster.Labels[hyperv1.LimitedSupportLabel]; ok && v == "true" {
limitedSupportValue = 1.0
}
ch <- prometheus.MustNewConstMetric(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,20 @@ func TestReportLimitedSuportEnabled(t *testing.T) {
expected *dto.MetricFamily
}{
{
name: "When limited support label is set, metric is reported as one",
name: "When limited support label is set to true, metric is reported as one",
labels: map[string]string{hyperv1.LimitedSupportLabel: "true"},
expected: wrapExpectedValueAsMetric(1),
},
{
name: "When limited support label is set to false, metric is reported as zero",
labels: map[string]string{hyperv1.LimitedSupportLabel: "false"},
expected: wrapExpectedValueAsMetric(0),
},
{
name: "When limited support label is set to anything unsupported, metric is reported as zero",
labels: map[string]string{hyperv1.LimitedSupportLabel: "foo"},
expected: wrapExpectedValueAsMetric(0),
},
{
name: "When limited support label is not set, metric is reported as zero",
labels: map[string]string{},
Expand Down