@@ -134,11 +134,13 @@ func testAccCheckSystemDestroy(s *terraform.State) error {
134
134
}
135
135
136
136
func 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 )
142
144
143
145
resource .Test (t , resource.TestCase {
144
146
PreCheck : func () { ctrlacctest .PreCheck (t ) },
@@ -209,7 +211,7 @@ func TestAccSystemResource(t *testing.T) {
209
211
resource .TestCheckNoResourceAttr ("ctrlplane_system.test" , "description" ),
210
212
),
211
213
},
212
- // Update and Read testing - add description back
214
+ // Update and Read testing - add description
213
215
{
214
216
Config : testAccSystemResourceConfig (thirdName , thirdName , & updatedDescription ),
215
217
Check : resource .ComposeAggregateTestCheckFunc (
@@ -404,9 +406,11 @@ resource "ctrlplane_system" "second" {
404
406
}
405
407
406
408
func 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 ))
410
414
411
415
resource .Test (t , resource.TestCase {
412
416
PreCheck : func () { ctrlacctest .PreCheck (t ) },
0 commit comments