config: set gogc default value when config body is empty (#16052)

* fix: set gogc default value when config body is empty

Signed-off-by: Danial Eskandari <doneskandari@gmail.com>

* refactor: explicitly check value 75 in `TestGoGCDefaultValueOnEmptyConfigBody`

add GoGC assertion in `TestEmptyConfig`, also removed the no longer needed runtime config assignment in `TestEmptyGlobalBlock`

Signed-off-by: Danial Eskandari <doneskandari@gmail.com>

* refactor: remove `TestGoGCDefaultValueOnEmptyConfigBody` to reduce duplicate assertions

Signed-off-by: Danial Eskandari <doneskandari@gmail.com>

---------

Signed-off-by: Danial Eskandari <doneskandari@gmail.com>
pull/16085/head
Danial Eskandari 10 months ago committed by GitHub
parent d72c1ec2c2
commit 5efaa84be1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      config/config.go
  2. 2
      config/config_test.go

@ -156,6 +156,7 @@ var (
// DefaultConfig is the default top-level configuration.
DefaultConfig = Config{
GlobalConfig: DefaultGlobalConfig,
Runtime: DefaultRuntimeConfig,
}
// DefaultGlobalConfig is the default global configuration.

@ -2222,6 +2222,7 @@ func TestEmptyConfig(t *testing.T) {
exp := DefaultConfig
exp.loaded = true
require.Equal(t, exp, *c)
require.Equal(t, 75, c.Runtime.GoGC)
}
func TestExpandExternalLabels(t *testing.T) {
@ -2269,7 +2270,6 @@ func TestEmptyGlobalBlock(t *testing.T) {
c, err := Load("global:\n", promslog.NewNopLogger())
require.NoError(t, err)
exp := DefaultConfig
exp.Runtime = DefaultRuntimeConfig
exp.loaded = true
require.Equal(t, exp, *c)
}

Loading…
Cancel
Save