@@ -4293,44 +4293,47 @@ func TestThanosRulerRetentionConfig(t *testing.T) {
42934293 }
42944294}
42954295
4296- func TestPrometheusGoGC (t * testing.T ) {
4296+ func TestPrometheusGoGCRelatedConfig (t * testing.T ) {
42974297 for _ , tc := range []struct {
42984298 ir InfrastructureReader
42994299 promf func (* Factory ) (* monv1.Prometheus , error )
43004300
4301- exp string
4301+ expectedGOGC string
4302+ autoGOMEMLIMITDisabled bool
43024303 }{
43034304 {
43044305 ir : & fakeInfrastructureReader {highlyAvailableInfrastructure : false },
43054306 promf : func (f * Factory ) (* monv1.Prometheus , error ) {
43064307 return f .PrometheusK8s (& v1.Secret {ObjectMeta : metav1.ObjectMeta {Name : "foo" }}, nil )
43074308 },
43084309
4309- exp : "100" ,
4310+ expectedGOGC : "100" ,
4311+ autoGOMEMLIMITDisabled : true ,
43104312 },
43114313 {
43124314 ir : & fakeInfrastructureReader {highlyAvailableInfrastructure : true },
43134315 promf : func (f * Factory ) (* monv1.Prometheus , error ) {
43144316 return f .PrometheusK8s (& v1.Secret {ObjectMeta : metav1.ObjectMeta {Name : "foo" }}, nil )
43154317 },
43164318
4317- exp : "" ,
4319+ expectedGOGC : "" ,
43184320 },
43194321 {
43204322 ir : & fakeInfrastructureReader {highlyAvailableInfrastructure : false },
43214323 promf : func (f * Factory ) (* monv1.Prometheus , error ) {
43224324 return f .PrometheusUserWorkload (& v1.Secret {ObjectMeta : metav1.ObjectMeta {Name : "foo" }})
43234325 },
43244326
4325- exp : "100" ,
4327+ expectedGOGC : "100" ,
4328+ autoGOMEMLIMITDisabled : true ,
43264329 },
43274330 {
43284331 ir : & fakeInfrastructureReader {highlyAvailableInfrastructure : true },
43294332 promf : func (f * Factory ) (* monv1.Prometheus , error ) {
43304333 return f .PrometheusUserWorkload (& v1.Secret {ObjectMeta : metav1.ObjectMeta {Name : "foo" }})
43314334 },
43324335
4333- exp : "" ,
4336+ expectedGOGC : "" ,
43344337 },
43354338 } {
43364339 t .Run ("" , func (t * testing.T ) {
@@ -4346,14 +4349,17 @@ func TestPrometheusGoGC(t *testing.T) {
43464349 }
43474350 }
43484351 require .NotNil (t , c )
4349- if tc .exp == "" {
4352+ if tc .expectedGOGC == "" {
43504353 for _ , env := range c .Env {
43514354 require .NotEqual (t , env .Name , "GOGC" )
43524355 }
43534356 return
43544357 }
43554358
4356- require .Contains (t , c .Env , v1.EnvVar {Name : "GOGC" , Value : tc .exp })
4359+ require .Contains (t , c .Env , v1.EnvVar {Name : "GOGC" , Value : tc .expectedGOGC })
4360+ if tc .autoGOMEMLIMITDisabled {
4361+ require .Contains (t , p .Spec .AdditionalArgs , monv1.Argument {Name : "no-auto-gomemlimit" })
4362+ }
43574363 })
43584364 }
43594365}
0 commit comments