27 lines
508 B
Go
27 lines
508 B
Go
|
//go:build dump_metrics
|
||
|
|
||
|
package metrics
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"flag"
|
||
|
"os"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
var metricsPath = flag.String("out", "", "File to export http gateway metrics to.")
|
||
|
|
||
|
func TestDescribeAll(t *testing.T) {
|
||
|
flag.Parse()
|
||
|
|
||
|
require.NotEmpty(t, metricsPath, "flag 'out' must be provided to dump metrics description")
|
||
|
|
||
|
data, err := json.Marshal(DescribeAll())
|
||
|
require.NoError(t, err)
|
||
|
|
||
|
err = os.WriteFile(*metricsPath, data, 0644)
|
||
|
require.NoError(t, err)
|
||
|
}
|