@@ -4288,44 +4288,47 @@ func TestThanosRulerRetentionConfig(t *testing.T) {
42884288 }
42894289}
42904290
4291- func TestPrometheusGoGC (t * testing.T ) {
4291+ func TestPrometheusGoGCRelatedConfig (t * testing.T ) {
42924292 for _ , tc := range []struct {
42934293 ir InfrastructureReader
42944294 promf func (* Factory ) (* monv1.Prometheus , error )
42954295
4296- exp string
4296+ expectedGOGC string
4297+ autoGOMEMLIMITDisabled bool
42974298 }{
42984299 {
42994300 ir : & fakeInfrastructureReader {highlyAvailableInfrastructure : false },
43004301 promf : func (f * Factory ) (* monv1.Prometheus , error ) {
43014302 return f .PrometheusK8s (& v1.Secret {ObjectMeta : metav1.ObjectMeta {Name : "foo" }}, nil )
43024303 },
43034304
4304- exp : "100" ,
4305+ expectedGOGC : "100" ,
4306+ autoGOMEMLIMITDisabled : true ,
43054307 },
43064308 {
43074309 ir : & fakeInfrastructureReader {highlyAvailableInfrastructure : true },
43084310 promf : func (f * Factory ) (* monv1.Prometheus , error ) {
43094311 return f .PrometheusK8s (& v1.Secret {ObjectMeta : metav1.ObjectMeta {Name : "foo" }}, nil )
43104312 },
43114313
4312- exp : "" ,
4314+ expectedGOGC : "" ,
43134315 },
43144316 {
43154317 ir : & fakeInfrastructureReader {highlyAvailableInfrastructure : false },
43164318 promf : func (f * Factory ) (* monv1.Prometheus , error ) {
43174319 return f .PrometheusUserWorkload (& v1.Secret {ObjectMeta : metav1.ObjectMeta {Name : "foo" }})
43184320 },
43194321
4320- exp : "100" ,
4322+ expectedGOGC : "100" ,
4323+ autoGOMEMLIMITDisabled : true ,
43214324 },
43224325 {
43234326 ir : & fakeInfrastructureReader {highlyAvailableInfrastructure : true },
43244327 promf : func (f * Factory ) (* monv1.Prometheus , error ) {
43254328 return f .PrometheusUserWorkload (& v1.Secret {ObjectMeta : metav1.ObjectMeta {Name : "foo" }})
43264329 },
43274330
4328- exp : "" ,
4331+ expectedGOGC : "" ,
43294332 },
43304333 } {
43314334 t .Run ("" , func (t * testing.T ) {
@@ -4341,14 +4344,17 @@ func TestPrometheusGoGC(t *testing.T) {
43414344 }
43424345 }
43434346 require .NotNil (t , c )
4344- if tc .exp == "" {
4347+ if tc .expectedGOGC == "" {
43454348 for _ , env := range c .Env {
43464349 require .NotEqual (t , env .Name , "GOGC" )
43474350 }
43484351 return
43494352 }
43504353
4351- require .Contains (t , c .Env , v1.EnvVar {Name : "GOGC" , Value : tc .exp })
4354+ require .Contains (t , c .Env , v1.EnvVar {Name : "GOGC" , Value : tc .expectedGOGC })
4355+ if tc .autoGOMEMLIMITDisabled {
4356+ require .Contains (t , p .Spec .AdditionalArgs , monv1.Argument {Name : "no-auto-gomemlimit" })
4357+ }
43524358 })
43534359 }
43544360}
0 commit comments