forked from TrueCloudLab/frostfs-s3-gw
38 lines
775 B
Go
38 lines
775 B
Go
//go:build dump_metrics
|
|
|
|
package metrics
|
|
|
|
import (
|
|
"encoding/json"
|
|
"flag"
|
|
"os"
|
|
"testing"
|
|
|
|
"git.frostfs.info/mbiryukova/frostfs-sdk-go/pool"
|
|
"github.com/stretchr/testify/require"
|
|
"go.uber.org/zap/zaptest"
|
|
)
|
|
|
|
type mock struct {
|
|
}
|
|
|
|
func (m mock) Statistic() pool.Statistic {
|
|
return pool.Statistic{}
|
|
}
|
|
|
|
var metricsPath = flag.String("out", "", "File to export s3 gateway metrics to.")
|
|
|
|
func TestDescribeAll(t *testing.T) {
|
|
// to check correct metrics type mapping
|
|
_ = NewAppMetrics(zaptest.NewLogger(t), mock{}, true)
|
|
|
|
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)
|
|
}
|