mirror of
https://github.com/hanzoai/metrics.git
synced 2026-10-30 20:03:39 +00:00
This should help reducing load on backends when many concurrent clients send requests over slow networks (for example, when many IoT devices send metrics to vmauth over slow connections). Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10309 This commit is based on top of https://github.com/VictoriaMetrics/VictoriaMetrics/pull/10310 Thanks to @makasim for the initial idea.
27 lines
631 B
Go
27 lines
631 B
Go
package envflag
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil"
|
|
)
|
|
|
|
func TestApplySecretFlags(t *testing.T) {
|
|
defer flagutil.UnregisterAllSecretFlags()
|
|
|
|
secretFlagsList = &flagutil.ArrayString{}
|
|
if err := secretFlagsList.Set("foo,bar"); err != nil {
|
|
t.Fatalf("unexpected error: %s", err)
|
|
}
|
|
|
|
if flagutil.IsSecretFlag("foo") || flagutil.IsSecretFlag("bar") {
|
|
t.Fatalf("foo and bar shouldn't be secret before applySecretFlags")
|
|
}
|
|
|
|
applySecretFlags()
|
|
|
|
if !flagutil.IsSecretFlag("foo") || !flagutil.IsSecretFlag("bar") {
|
|
t.Fatalf("foo and bar should be secret after applySecretFlags")
|
|
}
|
|
}
|