From e7ef1c0d9a0264e9b4119e5df68d135e1a988a3e Mon Sep 17 00:00:00 2001 From: Danial Eskandari <52372842+eskandaridanial@users.noreply.github.com> Date: Thu, 27 Feb 2025 13:55:52 +0330 Subject: [PATCH] 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 * 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 * refactor: remove `TestGoGCDefaultValueOnEmptyConfigBody` to reduce duplicate assertions Signed-off-by: Danial Eskandari --------- Signed-off-by: Danial Eskandari Signed-off-by: machine424 --- config/config.go | 1 + config/config_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 9defa10d48..ecf4d06dd5 100644 --- a/config/config.go +++ b/config/config.go @@ -139,6 +139,7 @@ var ( // DefaultConfig is the default top-level configuration. DefaultConfig = Config{ GlobalConfig: DefaultGlobalConfig, + Runtime: DefaultRuntimeConfig, } // DefaultGlobalConfig is the default global configuration. diff --git a/config/config_test.go b/config/config_test.go index ff056a2676..e3f4751ed8 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -2035,6 +2035,7 @@ func TestEmptyConfig(t *testing.T) { require.NoError(t, err) exp := DefaultConfig require.Equal(t, exp, *c) + require.Equal(t, 75, c.Runtime.GoGC) } func TestExpandExternalLabels(t *testing.T) { @@ -2086,7 +2087,6 @@ func TestEmptyGlobalBlock(t *testing.T) { c, err := Load("global:\n", false, log.NewNopLogger()) require.NoError(t, err) exp := DefaultConfig - exp.Runtime = DefaultRuntimeConfig require.Equal(t, exp, *c) }