11package cockpit_test
22
33import (
4+ "errors"
45 "fmt"
56 "strings"
67 "testing"
@@ -267,7 +268,7 @@ func testAccCheckAlertManagerEnabled(tt *acctest.TestTools, resourceName string,
267268 return func (s * terraform.State ) error {
268269 rs , ok := s .RootModule ().Resources [resourceName ]
269270 if ! ok {
270- return fmt . Errorf ("alert manager not found: %s" , resourceName )
271+ return errors . New ("alert manager not found: " + resourceName )
271272 }
272273
273274 api := cockpit .NewRegionalAPI (meta .ExtractScwClient (tt .Meta ))
@@ -292,7 +293,7 @@ func testAccCheckCockpitContactPointExists(tt *acctest.TestTools, resourceName s
292293 return func (s * terraform.State ) error {
293294 rs , ok := s .RootModule ().Resources [resourceName ]
294295 if ! ok {
295- return fmt . Errorf ("alert manager not found: %s" , resourceName )
296+ return errors . New ("alert manager not found: " + resourceName )
296297 }
297298
298299 api := cockpit .NewRegionalAPI (meta .ExtractScwClient (tt .Meta ))
@@ -311,7 +312,7 @@ func testAccCheckCockpitContactPointExists(tt *acctest.TestTools, resourceName s
311312 }
312313 }
313314
314- return fmt . Errorf ("contact point with email %s not found in project %s" , rs .Primary .Attributes ["emails.0" ], projectID )
315+ return errors . New ("contact point with email " + rs .Primary .Attributes ["emails.0" ] + " not found in project " + projectID )
315316 }
316317}
317318
@@ -339,7 +340,7 @@ func testAccCockpitAlertManagerAndContactsDestroy(tt *acctest.TestTools) resourc
339340 }
340341
341342 if alertManager .AlertManagerEnabled {
342- return fmt . Errorf ("cockpit alert manager (%s ) is still enabled" , rs . Primary . ID )
343+ return errors . New ("cockpit alert manager (" + rs . Primary . ID + " ) is still enabled" )
343344 }
344345 }
345346
@@ -352,42 +353,42 @@ func testAccCheckAlertManagerIDFormat(tt *acctest.TestTools, resourceName string
352353 return func (s * terraform.State ) error {
353354 rs , ok := s .RootModule ().Resources [resourceName ]
354355 if ! ok {
355- return fmt . Errorf ("alert manager not found: %s" , resourceName )
356+ return errors . New ("alert manager not found: " + resourceName )
356357 }
357358
358359 id := rs .Primary .ID
359360 if id == "" {
360- return fmt . Errorf ("alert manager ID is empty" )
361+ return errors . New ("alert manager ID is empty" )
361362 }
362363
363364 parts := strings .Split (id , "/" )
364365 if len (parts ) != 3 {
365- return fmt . Errorf ("alert manager ID should have 3 parts, got %d: %s " , len (parts ), id )
366+ return errors . New ("alert manager ID should have 3 parts, got " + fmt . Sprintf ( "%d " , len (parts )) + ": " + id )
366367 }
367368
368369 region := parts [0 ]
369370 projectID := parts [1 ]
370371
371372 if region == "" {
372- return fmt . Errorf ("region part of ID is empty" )
373+ return errors . New ("region part of ID is empty" )
373374 }
374375
375376 if projectID == "" {
376- return fmt . Errorf ("project ID part of ID is empty" )
377+ return errors . New ("project ID part of ID is empty" )
377378 }
378379
379380 if parts [2 ] != "1" {
380- return fmt . Errorf ("third part of ID should be '1', got %s" , parts [2 ])
381+ return errors . New ("third part of ID should be '1', got " + parts [2 ])
381382 }
382383
383384 expectedProjectID := rs .Primary .Attributes ["project_id" ]
384385 if expectedProjectID != projectID {
385- return fmt . Errorf ("project_id in attributes (%s ) doesn't match project_id in ID (%s)" , expectedProjectID , projectID )
386+ return errors . New ("project_id in attributes (" + expectedProjectID + " ) doesn't match project_id in ID (" + projectID + ")" )
386387 }
387388
388389 expectedRegion := rs .Primary .Attributes ["region" ]
389390 if expectedRegion != region {
390- return fmt . Errorf ("region in attributes (%s ) doesn't match region in ID (%s)" , expectedRegion , region )
391+ return errors . New ("region in attributes (" + expectedRegion + " ) doesn't match region in ID (" + region + ")" )
391392 }
392393
393394 return nil
0 commit comments