fix: add condition for OM fuzzing

Signed-off-by: Manik Rana <manikrana54@gmail.com>
This commit is contained in:
Manik Rana 2024-07-18 18:13:27 +05:30
parent 4a3e8d13ad
commit 86bd98d567

View file

@ -12,7 +12,6 @@
// limitations under the License. // limitations under the License.
// Only build when go-fuzz is in use // Only build when go-fuzz is in use
//go:build gofuzz
package promql package promql
@ -68,6 +67,13 @@ func fuzzParseMetricWithContentType(in []byte, contentType string) int {
panic(warning) panic(warning)
} }
switch contentType {
case "application/openmetrics-text":
p = textparse.NewOpenMetricsParserWithOpts(in, symbolTable, textparse.WithSkipCT(false))
default:
break
}
var err error var err error
for { for {
_, err = p.Next() _, err = p.Next()