@@ -3274,7 +3274,7 @@ func TestSeriesCheck(t *testing.T) {
32743274 checker : newSeriesCheck ,
32753275 prometheus : newSimpleProm ,
32763276 otherProms : func (uri string ) []* promapi.FailoverGroup {
3277- var proms []* promapi.FailoverGroup
3277+ proms := make ( []* promapi.FailoverGroup , 0 , 5 )
32783278 for i := range 5 {
32793279 proms = append (proms , simpleProm (fmt .Sprintf ("prom%d" , i ), uri + "/other" , time .Second , false ))
32803280 }
@@ -3302,7 +3302,7 @@ func TestSeriesCheck(t *testing.T) {
33023302 checker : newSeriesCheck ,
33033303 prometheus : newSimpleProm ,
33043304 otherProms : func (uri string ) []* promapi.FailoverGroup {
3305- var proms []* promapi.FailoverGroup
3305+ proms := make ( []* promapi.FailoverGroup , 0 , 5 )
33063306 for i := range 5 {
33073307 proms = append (proms , simpleProm (fmt .Sprintf ("prom%d" , i ), uri + "/other" , time .Second , false ))
33083308 }
@@ -3330,7 +3330,7 @@ func TestSeriesCheck(t *testing.T) {
33303330 checker : newSeriesCheck ,
33313331 prometheus : newSimpleProm ,
33323332 otherProms : func (uri string ) []* promapi.FailoverGroup {
3333- var proms []* promapi.FailoverGroup
3333+ proms := make ( []* promapi.FailoverGroup , 0 , 15 )
33343334 for i := range 15 {
33353335 proms = append (proms , simpleProm (fmt .Sprintf ("prom%d" , i ), uri + "/other" , time .Second , false ))
33363336 }
@@ -3368,7 +3368,7 @@ func TestSeriesCheck(t *testing.T) {
33683368 return context .WithValue (ctx , checks .SettingsKey (checks .SeriesCheckName ), & s )
33693369 },
33703370 otherProms : func (uri string ) []* promapi.FailoverGroup {
3371- var proms []* promapi.FailoverGroup
3371+ proms := make ( []* promapi.FailoverGroup , 0 , 15 )
33723372 for i := range 15 {
33733373 proms = append (proms , simpleProm (fmt .Sprintf ("prom%d" , i ), fmt .Sprintf ("%s/other/%d" , uri , i ), time .Second , false ))
33743374 }
@@ -3417,7 +3417,7 @@ func TestSeriesCheck(t *testing.T) {
34173417 return context .WithValue (ctx , checks .SettingsKey (checks .SeriesCheckName ), & s )
34183418 },
34193419 otherProms : func (uri string ) []* promapi.FailoverGroup {
3420- var proms []* promapi.FailoverGroup
3420+ proms := make ( []* promapi.FailoverGroup , 0 , 30 )
34213421 for i := range 30 {
34223422 proms = append (proms , simpleProm (fmt .Sprintf ("prom%d" , i ), uri + "/other" , time .Second , false ))
34233423 }
@@ -3527,7 +3527,7 @@ func TestSeriesCheck(t *testing.T) {
35273527 return context .WithValue (ctx , checks .SettingsKey (checks .SeriesCheckName ), & s )
35283528 },
35293529 otherProms : func (uri string ) []* promapi.FailoverGroup {
3530- var proms []* promapi.FailoverGroup
3530+ proms := make ( []* promapi.FailoverGroup , 0 , 30 )
35313531 for i := range 30 {
35323532 proms = append (proms , simpleProm (fmt .Sprintf ("prom%d" , i ), uri + "/other" , time .Second , false ))
35333533 }
@@ -3605,7 +3605,7 @@ func TestSeriesCheck(t *testing.T) {
36053605 return context .WithValue (ctx , checks .SettingsKey (checks .SeriesCheckName ), & s )
36063606 },
36073607 otherProms : func (uri string ) []* promapi.FailoverGroup {
3608- var proms []* promapi.FailoverGroup
3608+ proms := make ( []* promapi.FailoverGroup , 0 , 30 )
36093609 for i := range 30 {
36103610 proms = append (proms , simpleProm (fmt .Sprintf ("prom%d" , i ), uri + "/other" , time .Second , false ))
36113611 }
@@ -3684,9 +3684,9 @@ func TestSeriesCheck(t *testing.T) {
36843684 return context .WithValue (ctx , checks .SettingsKey (checks .SeriesCheckName ), & s )
36853685 },
36863686 otherProms : func (uri string ) []* promapi.FailoverGroup {
3687- var proms []* promapi.FailoverGroup
3688- for i := range 30 {
3689- proms = append ( proms , simpleProm (fmt .Sprintf ("prom%d" , i ), uri + "/other" , time .Second , false ) )
3687+ proms := make ( []* promapi.FailoverGroup , 30 )
3688+ for i := range proms {
3689+ proms [ i ] = simpleProm (fmt .Sprintf ("prom%d" , i ), uri + "/other" , time .Second , false )
36903690 }
36913691 return proms
36923692 },
0 commit comments