Skip to content

Commit

Permalink
Add unit test + skip integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
damemi committed Jul 18, 2023
1 parent 7431e34 commit 7395440
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions exporter/collector/googlemanagedprometheus/naming_test.go
Expand Up @@ -190,6 +190,21 @@ func TestGetMetricName(t *testing.T) {
},
expected: "bar/unknown:counter",
},
{
desc: "untyped sum with feature gate enabled + name normalization returns unknown:counter",
baseName: "bar",
metric: func(m pmetric.Metric) {
//nolint:errcheck
featuregate.GlobalRegistry().Set(gcpUntypedDoubleExportGateKey, true)
//nolint:errcheck
featuregate.GlobalRegistry().Set("pkg.translator.prometheus.NormalizeName", true)
m.SetName("bar")
m.SetEmptySum()
m.Sum().SetIsMonotonic(true)
m.Sum().DataPoints().AppendEmpty().Attributes().PutStr(GCPOpsAgentUntypedMetricKey, "true")
},
expected: "bar/unknown:counter",
},
} {
t.Run(tc.desc, func(t *testing.T) {
assert.True(t, gate.IsEnabled())
Expand Down
Expand Up @@ -395,6 +395,7 @@ var MetricsTestCases = []TestCase{
},
// prometheus_target is not supported by the SDK
SkipForSDK: true,
Skip: true,
},
// TODO: Add integration tests for workload.googleapis.com metrics from the ops agent
}

0 comments on commit 7395440

Please sign in to comment.