@@ -134,11 +134,13 @@ func testAccCheckSystemDestroy(s *terraform.State) error {
134134}
135135
136136func TestAccSystemResource (t * testing.T ) {
137- firstName := acctest .RandString (10 )
138- secondName := acctest .RandString (10 )
139- thirdName := acctest .RandString (10 )
140- description := "This is a test description"
141- updatedDescription := "This is an updated description"
137+ // Generate a unique prefix for all resources in this test
138+ rPrefix := acctest .RandString (8 )
139+ firstName := fmt .Sprintf ("first-%s-%s" , rPrefix , acctest .RandString (5 ))
140+ secondName := fmt .Sprintf ("second-%s-%s" , rPrefix , acctest .RandString (5 ))
141+ thirdName := fmt .Sprintf ("third-%s-%s" , rPrefix , acctest .RandString (5 ))
142+ description := fmt .Sprintf ("Test description %s" , rPrefix )
143+ updatedDescription := fmt .Sprintf ("Updated description %s" , rPrefix )
142144
143145 resource .Test (t , resource.TestCase {
144146 PreCheck : func () { ctrlacctest .PreCheck (t ) },
@@ -209,7 +211,7 @@ func TestAccSystemResource(t *testing.T) {
209211 resource .TestCheckNoResourceAttr ("ctrlplane_system.test" , "description" ),
210212 ),
211213 },
212- // Update and Read testing - add description back
214+ // Update and Read testing - add description
213215 {
214216 Config : testAccSystemResourceConfig (thirdName , thirdName , & updatedDescription ),
215217 Check : resource .ComposeAggregateTestCheckFunc (
@@ -404,9 +406,11 @@ resource "ctrlplane_system" "second" {
404406}
405407
406408func TestAccSystemResourceSameNameDifferentSlug (t * testing.T ) {
407- sharedName := acctest .RandString (10 )
408- firstSlug := fmt .Sprintf ("%s-first" , sharedName )
409- secondSlug := fmt .Sprintf ("%s-second" , sharedName )
409+ // Generate a truly unique name and slugs
410+ rPrefix := acctest .RandString (8 )
411+ sharedName := fmt .Sprintf ("shared-%s-%s" , rPrefix , acctest .RandString (5 ))
412+ firstSlug := fmt .Sprintf ("first-%s-%s" , rPrefix , acctest .RandString (5 ))
413+ secondSlug := fmt .Sprintf ("second-%s-%s" , rPrefix , acctest .RandString (5 ))
410414
411415 resource .Test (t , resource.TestCase {
412416 PreCheck : func () { ctrlacctest .PreCheck (t ) },
0 commit comments